forked from Ivasoft/drone-docker
Compare commits
1 Commits
master
...
win_test_p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c898b40dd6 |
50
.drone.jsonnet
Normal file
50
.drone.jsonnet
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
local pipeline = import 'pipeline.libsonnet';
|
||||||
|
|
||||||
|
[
|
||||||
|
pipeline.test('linux', 'amd64'),
|
||||||
|
|
||||||
|
pipeline.build('docker', 'linux', 'amd64'),
|
||||||
|
pipeline.build('docker', 'linux', 'arm64'),
|
||||||
|
pipeline.build('docker', 'linux', 'arm'),
|
||||||
|
pipeline.notifications('docker', depends_on=[
|
||||||
|
'linux-amd64',
|
||||||
|
'linux-arm64',
|
||||||
|
'linux-arm',
|
||||||
|
]),
|
||||||
|
|
||||||
|
pipeline.build('gcr', 'linux', 'amd64'),
|
||||||
|
pipeline.build('gcr', 'linux', 'arm64'),
|
||||||
|
pipeline.build('gcr', 'linux', 'arm'),
|
||||||
|
pipeline.notifications('gcr', depends_on=[
|
||||||
|
'linux-amd64',
|
||||||
|
'linux-arm64',
|
||||||
|
'linux-arm',
|
||||||
|
]),
|
||||||
|
|
||||||
|
pipeline.build('acr', 'linux', 'amd64'),
|
||||||
|
pipeline.build('acr', 'linux', 'arm64'),
|
||||||
|
pipeline.build('acr', 'linux', 'arm'),
|
||||||
|
pipeline.notifications('acr', depends_on=[
|
||||||
|
'linux-amd64',
|
||||||
|
'linux-arm64',
|
||||||
|
'linux-arm',
|
||||||
|
]),
|
||||||
|
|
||||||
|
pipeline.build('ecr', 'linux', 'amd64'),
|
||||||
|
pipeline.build('ecr', 'linux', 'arm64'),
|
||||||
|
pipeline.build('ecr', 'linux', 'arm'),
|
||||||
|
pipeline.notifications('ecr', depends_on=[
|
||||||
|
'linux-amd64',
|
||||||
|
'linux-arm64',
|
||||||
|
'linux-arm',
|
||||||
|
]),
|
||||||
|
|
||||||
|
pipeline.build('heroku', 'linux', 'amd64'),
|
||||||
|
pipeline.build('heroku', 'linux', 'arm64'),
|
||||||
|
pipeline.build('heroku', 'linux', 'arm'),
|
||||||
|
pipeline.notifications('heroku', depends_on=[
|
||||||
|
'linux-amd64',
|
||||||
|
'linux-arm64',
|
||||||
|
'linux-arm',
|
||||||
|
]),
|
||||||
|
]
|
||||||
1518
.drone.yml
1518
.drone.yml
File diff suppressed because it is too large
Load Diff
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,3 @@
|
|||||||
release
|
release
|
||||||
coverage.out
|
coverage.out
|
||||||
vendor
|
vendor
|
||||||
.vscode/
|
|
||||||
Dockerfile
|
|
||||||
|
|||||||
73
CHANGELOG.md
73
CHANGELOG.md
@@ -1,82 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [v20.14.0](https://github.com/drone-plugins/drone-docker/tree/v20.14.0) (2022-11-17)
|
## [v20.10.9](https://github.com/drone-plugins/drone-docker/tree/v20.10.9) (2021-11-02)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.13.0...v20.14.0)
|
|
||||||
|
|
||||||
**Implemented enhancements:**
|
|
||||||
|
|
||||||
- Add support for docker --platform flag [\#376](https://github.com/drone-plugins/drone-docker/pull/376) ([tphoney](https://github.com/tphoney))
|
|
||||||
|
|
||||||
**Fixed bugs:**
|
|
||||||
|
|
||||||
- Use full path to docker when creating card [\#373](https://github.com/drone-plugins/drone-docker/pull/373) ([donny-dont](https://github.com/donny-dont))
|
|
||||||
|
|
||||||
## [v20.13.0](https://github.com/drone-plugins/drone-docker/tree/v20.13.0) (2022-06-08)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.12.0...v20.13.0)
|
|
||||||
|
|
||||||
**Implemented enhancements:**
|
|
||||||
|
|
||||||
- update docker linux amd64/arm64 to 20.10.14 [\#365](https://github.com/drone-plugins/drone-docker/pull/365) ([tphoney](https://github.com/tphoney))
|
|
||||||
|
|
||||||
**Merged pull requests:**
|
|
||||||
|
|
||||||
- v20.13.0 prep [\#367](https://github.com/drone-plugins/drone-docker/pull/367) ([tphoney](https://github.com/tphoney))
|
|
||||||
|
|
||||||
## [v20.12.0](https://github.com/drone-plugins/drone-docker/tree/v20.12.0) (2022-05-16)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.11.0...v20.12.0)
|
|
||||||
|
|
||||||
**Implemented enhancements:**
|
|
||||||
|
|
||||||
- Add support for multiple Buildkit secrets with env vars or files as source [\#359](https://github.com/drone-plugins/drone-docker/pull/359) ([ste93cry](https://github.com/ste93cry))
|
|
||||||
- \(DRON-237\) cards add link to image repo, minor cleanup [\#358](https://github.com/drone-plugins/drone-docker/pull/358) ([tphoney](https://github.com/tphoney))
|
|
||||||
- \(DRON-232\) enable build-kit for secrets consumption [\#356](https://github.com/drone-plugins/drone-docker/pull/356) ([tphoney](https://github.com/tphoney))
|
|
||||||
|
|
||||||
**Fixed bugs:**
|
|
||||||
|
|
||||||
- \(fix\) Update card.json with UX [\#355](https://github.com/drone-plugins/drone-docker/pull/355) ([tphoney](https://github.com/tphoney))
|
|
||||||
|
|
||||||
**Merged pull requests:**
|
|
||||||
|
|
||||||
- prep for v20.12.0 [\#363](https://github.com/drone-plugins/drone-docker/pull/363) ([tphoney](https://github.com/tphoney))
|
|
||||||
|
|
||||||
## [v20.11.0](https://github.com/drone-plugins/drone-docker/tree/v20.11.0) (2022-01-19)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.10.9.1...v20.11.0)
|
|
||||||
|
|
||||||
**Merged pull requests:**
|
|
||||||
|
|
||||||
- new release to fix window semver error [\#354](https://github.com/drone-plugins/drone-docker/pull/354) ([eoinmcafee00](https://github.com/eoinmcafee00))
|
|
||||||
- \(feat\) publish docker data to create drone card [\#347](https://github.com/drone-plugins/drone-docker/pull/347) ([eoinmcafee00](https://github.com/eoinmcafee00))
|
|
||||||
|
|
||||||
## [v20.10.9.1](https://github.com/drone-plugins/drone-docker/tree/v20.10.9.1) (2022-01-13)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.10.9...v20.10.9.1)
|
|
||||||
|
|
||||||
**Implemented enhancements:**
|
|
||||||
|
|
||||||
- Serialize windows 1809 pipelines [\#348](https://github.com/drone-plugins/drone-docker/pull/348) ([shubham149](https://github.com/shubham149))
|
|
||||||
- Support for windows images for tags [\#346](https://github.com/drone-plugins/drone-docker/pull/346) ([shubham149](https://github.com/shubham149))
|
|
||||||
|
|
||||||
**Fixed bugs:**
|
|
||||||
|
|
||||||
- Fix ECR & GCR docker publish on windows [\#352](https://github.com/drone-plugins/drone-docker/pull/352) ([shubham149](https://github.com/shubham149))
|
|
||||||
- Fix windows docker builds [\#351](https://github.com/drone-plugins/drone-docker/pull/351) ([shubham149](https://github.com/shubham149))
|
|
||||||
- Fix powershell script to publish windows images [\#350](https://github.com/drone-plugins/drone-docker/pull/350) ([shubham149](https://github.com/shubham149))
|
|
||||||
|
|
||||||
**Merged pull requests:**
|
|
||||||
|
|
||||||
- release prep for 20.10.9.1 [\#353](https://github.com/drone-plugins/drone-docker/pull/353) ([eoinmcafee00](https://github.com/eoinmcafee00))
|
|
||||||
|
|
||||||
## [v20.10.9](https://github.com/drone-plugins/drone-docker/tree/v20.10.9) (2021-11-03)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v19.03.9...v20.10.9)
|
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v19.03.9...v20.10.9)
|
||||||
|
|
||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
- bump to version 20.10.9: [\#342](https://github.com/drone-plugins/drone-docker/pull/342) ([eoinmcafee00](https://github.com/eoinmcafee00))
|
|
||||||
- Upgrade Docker dind to 20.10.9 for 64bit platforms [\#334](https://github.com/drone-plugins/drone-docker/pull/334) ([gzm0](https://github.com/gzm0))
|
- Upgrade Docker dind to 20.10.9 for 64bit platforms [\#334](https://github.com/drone-plugins/drone-docker/pull/334) ([gzm0](https://github.com/gzm0))
|
||||||
|
|
||||||
## [v19.03.9](https://github.com/drone-plugins/drone-docker/tree/v19.03.9) (2021-10-13)
|
## [v19.03.9](https://github.com/drone-plugins/drone-docker/tree/v19.03.9) (2021-10-13)
|
||||||
|
|||||||
47
README.md
47
README.md
@@ -62,46 +62,6 @@ docker build \
|
|||||||
|
|
||||||
> Notice: Be aware that the Docker plugin currently requires privileged capabilities, otherwise the integrated Docker daemon is not able to start.
|
> Notice: Be aware that the Docker plugin currently requires privileged capabilities, otherwise the integrated Docker daemon is not able to start.
|
||||||
|
|
||||||
### Using Docker buildkit Secrets
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build dummy docker file and publish
|
|
||||||
image: plugins/docker
|
|
||||||
pull: never
|
|
||||||
settings:
|
|
||||||
repo: tphoney/test
|
|
||||||
tags: latest
|
|
||||||
secret: id=mysecret,src=secret-file
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
```
|
|
||||||
|
|
||||||
Using a dockerfile that references the secret-file
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# syntax=docker/dockerfile:1.2
|
|
||||||
|
|
||||||
FROM alpine
|
|
||||||
|
|
||||||
# shows secret from default secret location:
|
|
||||||
RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret
|
|
||||||
```
|
|
||||||
|
|
||||||
and a secret file called secret-file
|
|
||||||
|
|
||||||
```
|
|
||||||
COOL BANANAS
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Running from the CLI
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e PLUGIN_TAG=latest \
|
-e PLUGIN_TAG=latest \
|
||||||
@@ -113,11 +73,6 @@ docker run --rm \
|
|||||||
plugins/docker --dry-run
|
plugins/docker --dry-run
|
||||||
```
|
```
|
||||||
|
|
||||||
## Developer Notes
|
|
||||||
|
|
||||||
- When updating the base image, you will need to update for each architecture and OS.
|
|
||||||
- Arm32 base images are no longer being updated.
|
|
||||||
|
|
||||||
## Release procedure
|
## Release procedure
|
||||||
|
|
||||||
Run the changelog generator.
|
Run the changelog generator.
|
||||||
@@ -136,4 +91,4 @@ Run the changelog generator again with the future version according to semver.
|
|||||||
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u drone-plugins -p drone-docker -t <secret token> --future-release v1.0.0
|
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u drone-plugins -p drone-docker -t <secret token> --future-release v1.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Create your pull request for the release. Get it merged then tag the release.
|
Create your pull request for the release. Get it merged then tag the release.
|
||||||
88
card.go
88
card.go
@@ -1,88 +0,0 @@
|
|||||||
package docker
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/base64"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"path"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/drone/drone-go/drone"
|
|
||||||
|
|
||||||
"github.com/inhies/go-bytesize"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (p Plugin) writeCard() error {
|
|
||||||
cmd := exec.Command(dockerExe, "inspect", p.Build.Name)
|
|
||||||
data, err := cmd.CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
out := Card{}
|
|
||||||
if err := json.Unmarshal(data, &out); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
inspect := out[0]
|
|
||||||
inspect.SizeString = fmt.Sprint(bytesize.New(float64(inspect.Size)))
|
|
||||||
inspect.VirtualSizeString = fmt.Sprint(bytesize.New(float64(inspect.VirtualSize)))
|
|
||||||
inspect.Time = fmt.Sprint(inspect.Metadata.LastTagTime.Format(time.RFC3339))
|
|
||||||
// change slice of tags to slice of TagStruct
|
|
||||||
var sliceTagStruct []TagStruct
|
|
||||||
for _, tag := range inspect.RepoTags {
|
|
||||||
sliceTagStruct = append(sliceTagStruct, TagStruct{Tag: tag})
|
|
||||||
}
|
|
||||||
inspect.ParsedRepoTags = sliceTagStruct[1:] // remove the first tag which is always "hash:latest"
|
|
||||||
// create the url from repo and registry
|
|
||||||
inspect.URL = mapRegistryToURL(p.Daemon.Registry, p.Build.Repo)
|
|
||||||
cardData, _ := json.Marshal(inspect)
|
|
||||||
|
|
||||||
card := drone.CardInput{
|
|
||||||
Schema: "https://drone-plugins.github.io/drone-docker/card.json",
|
|
||||||
Data: cardData,
|
|
||||||
}
|
|
||||||
|
|
||||||
writeCard(p.CardPath, &card)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func writeCard(path string, card interface{}) {
|
|
||||||
data, _ := json.Marshal(card)
|
|
||||||
switch {
|
|
||||||
case path == "/dev/stdout":
|
|
||||||
writeCardTo(os.Stdout, data)
|
|
||||||
case path == "/dev/stderr":
|
|
||||||
writeCardTo(os.Stderr, data)
|
|
||||||
case path != "":
|
|
||||||
ioutil.WriteFile(path, data, 0644)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func writeCardTo(out io.Writer, data []byte) {
|
|
||||||
encoded := base64.StdEncoding.EncodeToString(data)
|
|
||||||
io.WriteString(out, "\u001B]1338;")
|
|
||||||
io.WriteString(out, encoded)
|
|
||||||
io.WriteString(out, "\u001B]0m")
|
|
||||||
io.WriteString(out, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func mapRegistryToURL(registry, repo string) (url string) {
|
|
||||||
url = "https://"
|
|
||||||
var domain string
|
|
||||||
if strings.Contains(registry, "amazonaws.com") {
|
|
||||||
domain = "gallery.ecr.aws/"
|
|
||||||
} else if strings.Contains(registry, "gcr.io") {
|
|
||||||
domain = "console.cloud.google.com/gcr/images"
|
|
||||||
} else {
|
|
||||||
// default to docker hub
|
|
||||||
domain = "hub.docker.com/r/"
|
|
||||||
}
|
|
||||||
url = path.Join(url, domain, repo)
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
@@ -7,9 +7,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
docker "github.com/drone-plugins/drone-docker"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -43,12 +40,12 @@ func main() {
|
|||||||
os.Setenv("DOCKER_PASSWORD", password)
|
os.Setenv("DOCKER_PASSWORD", password)
|
||||||
|
|
||||||
// invoke the base docker plugin binary
|
// invoke the base docker plugin binary
|
||||||
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
cmd := exec.Command("drone-docker")
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@@ -249,47 +248,6 @@ func main() {
|
|||||||
Usage: "additional host:IP mapping",
|
Usage: "additional host:IP mapping",
|
||||||
EnvVar: "PLUGIN_ADD_HOST",
|
EnvVar: "PLUGIN_ADD_HOST",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
|
||||||
Name: "secret",
|
|
||||||
Usage: "secret key value pair eg id=MYSECRET",
|
|
||||||
EnvVar: "PLUGIN_SECRET",
|
|
||||||
},
|
|
||||||
cli.StringSliceFlag{
|
|
||||||
Name: "secrets-from-env",
|
|
||||||
Usage: "secret key value pair eg secret_name=secret",
|
|
||||||
EnvVar: "PLUGIN_SECRETS_FROM_ENV",
|
|
||||||
},
|
|
||||||
cli.StringSliceFlag{
|
|
||||||
Name: "secrets-from-file",
|
|
||||||
Usage: "secret key value pairs eg secret_name=/path/to/secret",
|
|
||||||
EnvVar: "PLUGIN_SECRETS_FROM_FILE",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "drone-card-path",
|
|
||||||
Usage: "card path location to write to",
|
|
||||||
EnvVar: "DRONE_CARD_PATH",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "platform",
|
|
||||||
Usage: "platform value to pass to docker",
|
|
||||||
EnvVar: "PLUGIN_PLATFORM",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "ssh-agent-key",
|
|
||||||
Usage: "ssh agent key to use",
|
|
||||||
EnvVar: "PLUGIN_SSH_AGENT_KEY",
|
|
||||||
},
|
|
||||||
cli.BoolFlag{
|
|
||||||
Name: "is-plugin",
|
|
||||||
Usage: "build a plugin instead of a regular image",
|
|
||||||
EnvVar: "PLUGIN_IS_PLUGIN",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "plugin-config",
|
|
||||||
Usage: "path to the plugin config.json. Defaults to config.json",
|
|
||||||
Value: "config.json",
|
|
||||||
EnvVar: "PLUGIN_PLUGIN_CONFIG",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@@ -308,35 +266,27 @@ func run(c *cli.Context) error {
|
|||||||
Email: c.String("docker.email"),
|
Email: c.String("docker.email"),
|
||||||
Config: c.String("docker.config"),
|
Config: c.String("docker.config"),
|
||||||
},
|
},
|
||||||
CardPath: c.String("drone-card-path"),
|
|
||||||
Build: docker.Build{
|
Build: docker.Build{
|
||||||
Remote: c.String("remote.url"),
|
Remote: c.String("remote.url"),
|
||||||
Name: c.String("commit.sha"),
|
Name: c.String("commit.sha"),
|
||||||
Dockerfile: c.String("dockerfile"),
|
Dockerfile: c.String("dockerfile"),
|
||||||
Context: c.String("context"),
|
Context: c.String("context"),
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
ArgsEnv: c.StringSlice("args-from-env"),
|
ArgsEnv: c.StringSlice("args-from-env"),
|
||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Squash: c.Bool("squash"),
|
Squash: c.Bool("squash"),
|
||||||
Pull: c.BoolT("pull-image"),
|
Pull: c.BoolT("pull-image"),
|
||||||
CacheFrom: c.StringSlice("cache-from"),
|
CacheFrom: c.StringSlice("cache-from"),
|
||||||
Compress: c.Bool("compress"),
|
Compress: c.Bool("compress"),
|
||||||
Repo: c.String("repo"),
|
Repo: c.String("repo"),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
LabelSchema: c.StringSlice("label-schema"),
|
LabelSchema: c.StringSlice("label-schema"),
|
||||||
AutoLabel: c.BoolT("auto-label"),
|
AutoLabel: c.BoolT("auto-label"),
|
||||||
Link: c.String("link"),
|
Link: c.String("link"),
|
||||||
NoCache: c.Bool("no-cache"),
|
NoCache: c.Bool("no-cache"),
|
||||||
Secret: c.String("secret"),
|
AddHost: c.StringSlice("add-host"),
|
||||||
SecretEnvs: c.StringSlice("secrets-from-env"),
|
Quiet: c.Bool("quiet"),
|
||||||
SecretFiles: c.StringSlice("secrets-from-file"),
|
|
||||||
AddHost: c.StringSlice("add-host"),
|
|
||||||
Quiet: c.Bool("quiet"),
|
|
||||||
Platform: c.String("platform"),
|
|
||||||
SSHAgentKey: c.String("ssh-agent-key"),
|
|
||||||
IsPlugin: c.Bool("is-plugin"),
|
|
||||||
PluginConfig: c.String("plugin-config"),
|
|
||||||
},
|
},
|
||||||
Daemon: docker.Daemon{
|
Daemon: docker.Daemon{
|
||||||
Registry: c.String("docker.registry"),
|
Registry: c.String("docker.registry"),
|
||||||
@@ -377,11 +327,3 @@ func run(c *cli.Context) error {
|
|||||||
|
|
||||||
return plugin.Exec()
|
return plugin.Exec()
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetExecCmd() string {
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
return "C:/bin/drone-docker.exe"
|
|
||||||
}
|
|
||||||
|
|
||||||
return "drone-docker"
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -11,15 +11,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
|
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ecr"
|
"github.com/aws/aws-sdk-go/service/ecr"
|
||||||
|
|
||||||
docker "github.com/drone-plugins/drone-docker"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultRegion = "us-east-1"
|
const defaultRegion = "us-east-1"
|
||||||
@@ -113,11 +110,11 @@ func main() {
|
|||||||
os.Setenv("DOCKER_PASSWORD", password)
|
os.Setenv("DOCKER_PASSWORD", password)
|
||||||
|
|
||||||
// invoke the base docker plugin binary
|
// invoke the base docker plugin binary
|
||||||
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
cmd := exec.Command("drone-docker")
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
if err = cmd.Run(); err != nil {
|
if err = cmd.Run(); err != nil {
|
||||||
logrus.Fatal(err)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
docker "github.com/drone-plugins/drone-docker"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// gcr default username
|
// gcr default username
|
||||||
@@ -57,12 +54,12 @@ func main() {
|
|||||||
os.Setenv("DOCKER_PASSWORD", password)
|
os.Setenv("DOCKER_PASSWORD", password)
|
||||||
|
|
||||||
// invoke the base docker plugin binary
|
// invoke the base docker plugin binary
|
||||||
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
cmd := exec.Command("drone-docker")
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
//go:build !windows
|
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,8 +17,8 @@ func (p Plugin) startDaemon() {
|
|||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
} else {
|
} else {
|
||||||
cmd.Stdout = io.Discard
|
cmd.Stdout = ioutil.Discard
|
||||||
cmd.Stderr = io.Discard
|
cmd.Stderr = ioutil.Discard
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
trace(cmd)
|
trace(cmd)
|
||||||
|
|||||||
227
docker.go
227
docker.go
@@ -2,10 +2,10 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -39,77 +39,40 @@ type (
|
|||||||
|
|
||||||
// Build defines Docker build parameters.
|
// Build defines Docker build parameters.
|
||||||
Build struct {
|
Build struct {
|
||||||
Remote string // Git remote URL
|
Remote string // Git remote URL
|
||||||
Name string // Docker build using default named tag
|
Name string // Docker build using default named tag
|
||||||
Dockerfile string // Docker build Dockerfile
|
Dockerfile string // Docker build Dockerfile
|
||||||
Context string // Docker build context
|
Context string // Docker build context
|
||||||
Tags []string // Docker build tags
|
Tags []string // Docker build tags
|
||||||
Args []string // Docker build args
|
Args []string // Docker build args
|
||||||
ArgsEnv []string // Docker build args from env
|
ArgsEnv []string // Docker build args from env
|
||||||
Target string // Docker build target
|
Target string // Docker build target
|
||||||
Squash bool // Docker build squash
|
Squash bool // Docker build squash
|
||||||
Pull bool // Docker build pull
|
Pull bool // Docker build pull
|
||||||
CacheFrom []string // Docker build cache-from
|
CacheFrom []string // Docker build cache-from
|
||||||
Compress bool // Docker build compress
|
Compress bool // Docker build compress
|
||||||
Repo string // Docker build repository
|
Repo string // Docker build repository
|
||||||
LabelSchema []string // label-schema Label map
|
LabelSchema []string // label-schema Label map
|
||||||
AutoLabel bool // auto-label bool
|
AutoLabel bool // auto-label bool
|
||||||
Labels []string // Label map
|
Labels []string // Label map
|
||||||
Link string // Git repo link
|
Link string // Git repo link
|
||||||
NoCache bool // Docker build no-cache
|
NoCache bool // Docker build no-cache
|
||||||
Secret string // secret keypair
|
AddHost []string // Docker build add-host
|
||||||
SecretEnvs []string // Docker build secrets with env var as source
|
Quiet bool // Docker build quiet
|
||||||
SecretFiles []string // Docker build secrets with file as source
|
|
||||||
AddHost []string // Docker build add-host
|
|
||||||
Quiet bool // Docker build quiet
|
|
||||||
Platform string // Docker build platform
|
|
||||||
SSHAgentKey string // Docker build ssh agent key
|
|
||||||
SSHKeyPath string // Docker build ssh key path
|
|
||||||
IsPlugin bool // Build docker plugin instead of plain image
|
|
||||||
PluginConfig string // Plugin config file path, defaults to config.json
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin defines the Docker plugin parameters.
|
// Plugin defines the Docker plugin parameters.
|
||||||
Plugin struct {
|
Plugin struct {
|
||||||
Login Login // Docker login configuration
|
Login Login // Docker login configuration
|
||||||
Build Build // Docker build configuration
|
Build Build // Docker build configuration
|
||||||
Daemon Daemon // Docker daemon configuration
|
Daemon Daemon // Docker daemon configuration
|
||||||
Dryrun bool // Docker push is skipped
|
Dryrun bool // Docker push is skipped
|
||||||
Cleanup bool // Docker purge is enabled
|
Cleanup bool // Docker purge is enabled
|
||||||
CardPath string // Card path to write file to
|
|
||||||
}
|
|
||||||
|
|
||||||
Card []struct {
|
|
||||||
ID string `json:"Id"`
|
|
||||||
RepoTags []string `json:"RepoTags"`
|
|
||||||
ParsedRepoTags []TagStruct `json:"ParsedRepoTags"`
|
|
||||||
RepoDigests []interface{} `json:"RepoDigests"`
|
|
||||||
Parent string `json:"Parent"`
|
|
||||||
Comment string `json:"Comment"`
|
|
||||||
Created time.Time `json:"Created"`
|
|
||||||
Container string `json:"Container"`
|
|
||||||
DockerVersion string `json:"DockerVersion"`
|
|
||||||
Author string `json:"Author"`
|
|
||||||
Architecture string `json:"Architecture"`
|
|
||||||
Os string `json:"Os"`
|
|
||||||
Size int `json:"Size"`
|
|
||||||
VirtualSize int `json:"VirtualSize"`
|
|
||||||
Metadata struct {
|
|
||||||
LastTagTime time.Time `json:"LastTagTime"`
|
|
||||||
} `json:"Metadata"`
|
|
||||||
SizeString string
|
|
||||||
VirtualSizeString string
|
|
||||||
Time string
|
|
||||||
URL string `json:"URL"`
|
|
||||||
}
|
|
||||||
TagStruct struct {
|
|
||||||
Tag string `json:"Tag"`
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// Exec executes the plugin step
|
// Exec executes the plugin step
|
||||||
func (p Plugin) Exec() error {
|
func (p Plugin) Exec() error {
|
||||||
|
|
||||||
// start the Docker daemon server
|
// start the Docker daemon server
|
||||||
if !p.Daemon.Disabled {
|
if !p.Daemon.Disabled {
|
||||||
p.startDaemon()
|
p.startDaemon()
|
||||||
@@ -148,7 +111,7 @@ func (p Plugin) Exec() error {
|
|||||||
os.MkdirAll(dockerHome, 0600)
|
os.MkdirAll(dockerHome, 0600)
|
||||||
|
|
||||||
path := filepath.Join(dockerHome, "config.json")
|
path := filepath.Join(dockerHome, "config.json")
|
||||||
err := os.WriteFile(path, []byte(p.Login.Config), 0600)
|
err := ioutil.WriteFile(path, []byte(p.Login.Config), 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error writing config.json: %s", err)
|
return fmt.Errorf("Error writing config.json: %s", err)
|
||||||
}
|
}
|
||||||
@@ -183,41 +146,19 @@ func (p Plugin) Exec() error {
|
|||||||
cmds = append(cmds, commandPull(img))
|
cmds = append(cmds, commandPull(img))
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup for using ssh agent (https://docs.docker.com/develop/develop-images/build_enhancements/#using-ssh-to-access-private-data-in-builds)
|
|
||||||
if p.Build.SSHAgentKey != "" {
|
|
||||||
var sshErr error
|
|
||||||
p.Build.SSHKeyPath, sshErr = writeSSHPrivateKey(p.Build.SSHAgentKey)
|
|
||||||
if sshErr != nil {
|
|
||||||
return sshErr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cmds = append(cmds, commandBuild(p.Build)) // docker build
|
cmds = append(cmds, commandBuild(p.Build)) // docker build
|
||||||
|
|
||||||
if p.Build.IsPlugin {
|
|
||||||
cmds = append(cmds, exec.Command("mkdir", "-p", "plugin/rootfs"))
|
|
||||||
cmds = append(cmds, exec.Command(dockerExe, "create", "--name", "tmp", p.Build.Name))
|
|
||||||
cmds = append(cmds, exec.Command(dockerExe, "export", "-o", "tmp.tar", "tmp"))
|
|
||||||
cmds = append(cmds, exec.Command(dockerExe, "rm", "tmp"))
|
|
||||||
cmds = append(cmds, exec.Command(dockerExe, "image", "rm", p.Build.Name))
|
|
||||||
cmds = append(cmds, exec.Command("tar", "x", "-C", "plugin/rootfs", "-f", "tmp.tar"))
|
|
||||||
cmds = append(cmds, exec.Command("cp", p.Build.PluginConfig, "plugin/config.json"))
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tag := range p.Build.Tags {
|
for _, tag := range p.Build.Tags {
|
||||||
if !p.Build.IsPlugin {
|
cmds = append(cmds, commandTag(p.Build, tag)) // docker tag
|
||||||
cmds = append(cmds, commandTag(p.Build, tag)) // docker tag
|
|
||||||
} else {
|
|
||||||
cmds = append(cmds, exec.Command(dockerExe, "plugin", "create", p.Build.Repo+":"+tag, "plugin"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if !p.Dryrun {
|
if p.Dryrun == false {
|
||||||
cmds = append(cmds, commandPush(p.Build, tag)) // docker push
|
cmds = append(cmds, commandPush(p.Build, tag)) // docker push
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if p.Build.IsPlugin {
|
if p.Cleanup {
|
||||||
cmds = append(cmds, exec.Command(dockerExe, "plugin", "rm", p.Build.Repo+":"+tag))
|
cmds = append(cmds, commandRmi(p.Build.Name)) // docker rmi
|
||||||
}
|
cmds = append(cmds, commandPrune()) // docker system prune -f
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute all commands in batch mode.
|
// execute all commands in batch mode.
|
||||||
@@ -238,26 +179,6 @@ func (p Plugin) Exec() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the adaptive card
|
|
||||||
if err := p.writeCard(); err != nil {
|
|
||||||
fmt.Printf("Could not create adaptive card. %s\n", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute cleanup routines in batch mode
|
|
||||||
if p.Cleanup {
|
|
||||||
// clear the slice
|
|
||||||
cmds = nil
|
|
||||||
|
|
||||||
cmds = append(cmds, commandRmi(p.Build.Name)) // docker rmi
|
|
||||||
cmds = append(cmds, commandPrune()) // docker system prune -f
|
|
||||||
|
|
||||||
for _, cmd := range cmds {
|
|
||||||
cmd.Stdout = os.Stdout
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
trace(cmd)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,31 +258,12 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
for _, host := range build.AddHost {
|
for _, host := range build.AddHost {
|
||||||
args = append(args, "--add-host", host)
|
args = append(args, "--add-host", host)
|
||||||
}
|
}
|
||||||
if build.Secret != "" {
|
|
||||||
args = append(args, "--secret", build.Secret)
|
|
||||||
}
|
|
||||||
for _, secret := range build.SecretEnvs {
|
|
||||||
if arg, err := getSecretStringCmdArg(secret); err == nil {
|
|
||||||
args = append(args, "--secret", arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, secret := range build.SecretFiles {
|
|
||||||
if arg, err := getSecretFileCmdArg(secret); err == nil {
|
|
||||||
args = append(args, "--secret", arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if build.Target != "" {
|
if build.Target != "" {
|
||||||
args = append(args, "--target", build.Target)
|
args = append(args, "--target", build.Target)
|
||||||
}
|
}
|
||||||
if build.Quiet {
|
if build.Quiet {
|
||||||
args = append(args, "--quiet")
|
args = append(args, "--quiet")
|
||||||
}
|
}
|
||||||
if build.Platform != "" {
|
|
||||||
args = append(args, "--platform", build.Platform)
|
|
||||||
}
|
|
||||||
if build.SSHKeyPath != "" {
|
|
||||||
args = append(args, "--ssh", build.SSHKeyPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if build.AutoLabel {
|
if build.AutoLabel {
|
||||||
labelSchema := []string{
|
labelSchema := []string{
|
||||||
@@ -387,41 +289,9 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to enable buildkit, for secret support and ssh agent support
|
|
||||||
if build.Secret != "" || len(build.SecretEnvs) > 0 || len(build.SecretFiles) > 0 || build.SSHAgentKey != "" {
|
|
||||||
os.Setenv("DOCKER_BUILDKIT", "1")
|
|
||||||
}
|
|
||||||
return exec.Command(dockerExe, args...)
|
return exec.Command(dockerExe, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSecretStringCmdArg(kvp string) (string, error) {
|
|
||||||
return getSecretCmdArg(kvp, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getSecretFileCmdArg(kvp string) (string, error) {
|
|
||||||
return getSecretCmdArg(kvp, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getSecretCmdArg(kvp string, file bool) (string, error) {
|
|
||||||
delimIndex := strings.IndexByte(kvp, '=')
|
|
||||||
if delimIndex == -1 {
|
|
||||||
return "", fmt.Errorf("%s is not a valid secret", kvp)
|
|
||||||
}
|
|
||||||
|
|
||||||
key := kvp[:delimIndex]
|
|
||||||
value := kvp[delimIndex+1:]
|
|
||||||
|
|
||||||
if key == "" || value == "" {
|
|
||||||
return "", fmt.Errorf("%s is not a valid secret", kvp)
|
|
||||||
}
|
|
||||||
|
|
||||||
if file {
|
|
||||||
return fmt.Sprintf("id=%s,src=%s", key, value), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("id=%s,env=%s", key, value), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// helper function to add proxy values from the environment
|
// helper function to add proxy values from the environment
|
||||||
func addProxyBuildArgs(build *Build) {
|
func addProxyBuildArgs(build *Build) {
|
||||||
addProxyValue(build, "http_proxy")
|
addProxyValue(build, "http_proxy")
|
||||||
@@ -479,11 +349,7 @@ func commandTag(build Build, tag string) *exec.Cmd {
|
|||||||
// helper function to create the docker push command.
|
// helper function to create the docker push command.
|
||||||
func commandPush(build Build, tag string) *exec.Cmd {
|
func commandPush(build Build, tag string) *exec.Cmd {
|
||||||
target := fmt.Sprintf("%s:%s", build.Repo, tag)
|
target := fmt.Sprintf("%s:%s", build.Repo, tag)
|
||||||
if build.IsPlugin {
|
return exec.Command(dockerExe, "push", target)
|
||||||
return exec.Command(dockerExe, "plugin", "push", target)
|
|
||||||
} else {
|
|
||||||
return exec.Command(dockerExe, "push", target)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper function to create the docker daemon command.
|
// helper function to create the docker daemon command.
|
||||||
@@ -545,33 +411,8 @@ func commandRmi(tag string) *exec.Cmd {
|
|||||||
return exec.Command(dockerExe, "rmi", tag)
|
return exec.Command(dockerExe, "rmi", tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeSSHPrivateKey(key string) (path string, err error) {
|
|
||||||
home, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("unable to determine home directory: %s", err)
|
|
||||||
}
|
|
||||||
if err := os.MkdirAll(filepath.Join(home, ".ssh"), 0700); err != nil {
|
|
||||||
return "", fmt.Errorf("unable to create .ssh directory: %s", err)
|
|
||||||
}
|
|
||||||
pathToKey := filepath.Join(home, ".ssh", "id_rsa")
|
|
||||||
if err := os.WriteFile(pathToKey, []byte(key), 0400); err != nil {
|
|
||||||
return "", fmt.Errorf("unable to write ssh key %s: %s", pathToKey, err)
|
|
||||||
}
|
|
||||||
path = fmt.Sprintf("default=%s", pathToKey)
|
|
||||||
|
|
||||||
return path, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// trace writes each command to stdout with the command wrapped in an xml
|
// trace writes each command to stdout with the command wrapped in an xml
|
||||||
// tag so that it can be extracted and displayed in the logs.
|
// tag so that it can be extracted and displayed in the logs.
|
||||||
func trace(cmd *exec.Cmd) {
|
func trace(cmd *exec.Cmd) {
|
||||||
fmt.Fprintf(os.Stdout, "+ %s\n", strings.Join(cmd.Args, " "))
|
fmt.Fprintf(os.Stdout, "+ %s\n", strings.Join(cmd.Args, " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDroneDockerExecCmd() string {
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
return "C:/bin/drone-docker.exe"
|
|
||||||
}
|
|
||||||
|
|
||||||
return "drone-docker"
|
|
||||||
}
|
|
||||||
|
|||||||
4
docker/acr/Dockerfile.linux.arm
Normal file
4
docker/acr/Dockerfile.linux.arm
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-acr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-acr"]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-ltsc2022-amd64
|
FROM plugins/docker:windows-1803-amd64
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
org.label-schema.name="Drone ACR" `
|
org.label-schema.name="Drone ACR" `
|
||||||
10
docker/acr/Dockerfile.windows.amd64.1909
Normal file
10
docker/acr/Dockerfile.windows.amd64.1909
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-1909-amd64
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone ACR" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-acr.exe C:/bin/drone-acr.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-acr.exe" ]
|
||||||
@@ -17,6 +17,18 @@ manifests:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
-
|
||||||
|
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1803
|
||||||
-
|
-
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
platform:
|
platform:
|
||||||
@@ -24,8 +36,14 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: ltsc2022
|
version: 1903
|
||||||
|
-
|
||||||
|
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1909
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM docker:20.10.14-dind
|
FROM docker:20.10.9-dind
|
||||||
|
|
||||||
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
|||||||
15
docker/docker/Dockerfile.linux.arm
Normal file
15
docker/docker/Dockerfile.linux.arm
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
FROM arm32v6/docker:19.03.8-dind
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
RUN apk --update add --virtual .build-deps curl && \
|
||||||
|
mkdir -p /etc/docker/ && \
|
||||||
|
curl -SsL -o /etc/docker/default.json https://raw.githubusercontent.com/moby/moby/19.03/profiles/seccomp/default.json && \
|
||||||
|
sed -i 's/SCMP_ACT_ERRNO/SCMP_ACT_TRACE/g' /etc/docker/default.json && \
|
||||||
|
chmod 600 /etc/docker/default.json && \
|
||||||
|
apk del .build-deps && \
|
||||||
|
rm -rf /var/cache/apk/* && \
|
||||||
|
rm -rf /tmp/*
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-docker /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM arm64v8/docker:20.10.14-dind
|
FROM arm64v8/docker:20.10.9-dind
|
||||||
|
|
||||||
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
|||||||
26
docker/docker/Dockerfile.windows.amd64.1803
Normal file
26
docker/docker/Dockerfile.windows.amd64.1803
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:1803 as download
|
||||||
|
|
||||||
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
|
ENV DOCKER_VERSION 18.09.1
|
||||||
|
|
||||||
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
|
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||||
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
|
FROM plugins/base:windows-1803
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Docker" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||||
|
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||||
|
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
# using 1809-KB5021237-amd64 as base image, 1809-KB5022286-amd64 does not work
|
FROM mcr.microsoft.com/windows/servercore:1809 as download
|
||||||
FROM mcr.microsoft.com/windows/servercore:1809-KB5021237 as download
|
|
||||||
|
|
||||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
ENV DOCKER_VERSION 19.03.1
|
ENV DOCKER_VERSION 18.09.1
|
||||||
|
|
||||||
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
@@ -14,8 +13,7 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
|
|||||||
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
RUN /innoextract.exe dockertoolbox.exe
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
FROM mcr.microsoft.com/windows/nanoserver:1809-KB5021237-amd64
|
FROM mcr.microsoft.com/windows/nanoserver:1809
|
||||||
|
|
||||||
USER ContainerAdministrator
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
@@ -23,7 +21,6 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
|||||||
org.label-schema.vendor="Drone.IO Community" `
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
org.label-schema.schema-version="1.0"
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
RUN mkdir C:\bin
|
|
||||||
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||||
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||||
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM mcr.microsoft.com/windows/servercore:ltsc2022 as download
|
FROM mcr.microsoft.com/windows/servercore:1903 as download
|
||||||
|
|
||||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tl
|
|||||||
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
RUN /innoextract.exe dockertoolbox.exe
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
|
FROM mcr.microsoft.com/windows/nanoserver:1903
|
||||||
USER ContainerAdministrator
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
28
docker/docker/Dockerfile.windows.amd64.1909
Normal file
28
docker/docker/Dockerfile.windows.amd64.1909
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:1909 as download
|
||||||
|
|
||||||
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
|
ENV DOCKER_VERSION 19.03.1
|
||||||
|
|
||||||
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
|
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||||
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/windows/nanoserver:1909
|
||||||
|
USER ContainerAdministrator
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Docker" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
RUN mkdir C:\bin
|
||||||
|
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||||
|
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||||
|
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]
|
||||||
@@ -17,6 +17,18 @@ manifests:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1803
|
||||||
-
|
-
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
platform:
|
platform:
|
||||||
@@ -24,8 +36,14 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: ltsc2022
|
version: 1903
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1909
|
||||||
|
|||||||
4
docker/ecr/Dockerfile.linux.arm
Normal file
4
docker/ecr/Dockerfile.linux.arm
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-ecr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-ltsc2022-amd64
|
FROM plugins/docker:windows-1803-amd64
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
org.label-schema.name="Drone ECR" `
|
org.label-schema.name="Drone ECR" `
|
||||||
10
docker/ecr/Dockerfile.windows.amd64.1909
Normal file
10
docker/ecr/Dockerfile.windows.amd64.1909
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-1909-amd64
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone ECR" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-ecr.exe C:/bin/drone-ecr.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-ecr.exe" ]
|
||||||
@@ -17,6 +17,18 @@ manifests:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1803
|
||||||
-
|
-
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
platform:
|
platform:
|
||||||
@@ -24,8 +36,14 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: ltsc2022
|
version: 1903
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1909
|
||||||
|
|||||||
4
docker/gcr/Dockerfile.linux.arm
Normal file
4
docker/gcr/Dockerfile.linux.arm
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-gcr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-ltsc2022-amd64
|
FROM plugins/docker:windows-1803-amd64
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
org.label-schema.name="Drone GCR" `
|
org.label-schema.name="Drone GCR" `
|
||||||
10
docker/gcr/Dockerfile.windows.amd64.1909
Normal file
10
docker/gcr/Dockerfile.windows.amd64.1909
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-1909-amd64
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone GCR" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-gcr.exe C:/bin/drone-gcr.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-gcr.exe" ]
|
||||||
@@ -17,6 +17,18 @@ manifests:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
-
|
||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1803
|
||||||
-
|
-
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
platform:
|
platform:
|
||||||
@@ -24,8 +36,8 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: ltsc2022
|
version: 1909
|
||||||
|
|||||||
4
docker/heroku/Dockerfile.linux.arm
Normal file
4
docker/heroku/Dockerfile.linux.arm
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-heroku /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"]
|
||||||
@@ -17,3 +17,9 @@ manifests:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
os: linux
|
os: linux
|
||||||
variant: v8
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
|||||||
170
docker_test.go
170
docker_test.go
@@ -1,171 +1 @@
|
|||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
|
||||||
"os/exec"
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCommandBuild(t *testing.T) {
|
|
||||||
tcs := []struct {
|
|
||||||
name string
|
|
||||||
build Build
|
|
||||||
want *exec.Cmd
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "secret from env var",
|
|
||||||
build: Build{
|
|
||||||
Name: "plugins/drone-docker:latest",
|
|
||||||
Dockerfile: "Dockerfile",
|
|
||||||
Context: ".",
|
|
||||||
SecretEnvs: []string{
|
|
||||||
"foo_secret=FOO_SECRET_ENV_VAR",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
want: exec.Command(
|
|
||||||
dockerExe,
|
|
||||||
"build",
|
|
||||||
"--rm=true",
|
|
||||||
"-f",
|
|
||||||
"Dockerfile",
|
|
||||||
"-t",
|
|
||||||
"plugins/drone-docker:latest",
|
|
||||||
".",
|
|
||||||
"--secret id=foo_secret,env=FOO_SECRET_ENV_VAR",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "secret from file",
|
|
||||||
build: Build{
|
|
||||||
Name: "plugins/drone-docker:latest",
|
|
||||||
Dockerfile: "Dockerfile",
|
|
||||||
Context: ".",
|
|
||||||
SecretFiles: []string{
|
|
||||||
"foo_secret=/path/to/foo_secret",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
want: exec.Command(
|
|
||||||
dockerExe,
|
|
||||||
"build",
|
|
||||||
"--rm=true",
|
|
||||||
"-f",
|
|
||||||
"Dockerfile",
|
|
||||||
"-t",
|
|
||||||
"plugins/drone-docker:latest",
|
|
||||||
".",
|
|
||||||
"--secret id=foo_secret,src=/path/to/foo_secret",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "multiple mixed secrets",
|
|
||||||
build: Build{
|
|
||||||
Name: "plugins/drone-docker:latest",
|
|
||||||
Dockerfile: "Dockerfile",
|
|
||||||
Context: ".",
|
|
||||||
SecretEnvs: []string{
|
|
||||||
"foo_secret=FOO_SECRET_ENV_VAR",
|
|
||||||
"bar_secret=BAR_SECRET_ENV_VAR",
|
|
||||||
},
|
|
||||||
SecretFiles: []string{
|
|
||||||
"foo_secret=/path/to/foo_secret",
|
|
||||||
"bar_secret=/path/to/bar_secret",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
want: exec.Command(
|
|
||||||
dockerExe,
|
|
||||||
"build",
|
|
||||||
"--rm=true",
|
|
||||||
"-f",
|
|
||||||
"Dockerfile",
|
|
||||||
"-t",
|
|
||||||
"plugins/drone-docker:latest",
|
|
||||||
".",
|
|
||||||
"--secret id=foo_secret,env=FOO_SECRET_ENV_VAR",
|
|
||||||
"--secret id=bar_secret,env=BAR_SECRET_ENV_VAR",
|
|
||||||
"--secret id=foo_secret,src=/path/to/foo_secret",
|
|
||||||
"--secret id=bar_secret,src=/path/to/bar_secret",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "invalid mixed secrets",
|
|
||||||
build: Build{
|
|
||||||
Name: "plugins/drone-docker:latest",
|
|
||||||
Dockerfile: "Dockerfile",
|
|
||||||
Context: ".",
|
|
||||||
SecretEnvs: []string{
|
|
||||||
"foo_secret=",
|
|
||||||
"=FOO_SECRET_ENV_VAR",
|
|
||||||
"",
|
|
||||||
},
|
|
||||||
SecretFiles: []string{
|
|
||||||
"foo_secret=",
|
|
||||||
"=/path/to/bar_secret",
|
|
||||||
"",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
want: exec.Command(
|
|
||||||
dockerExe,
|
|
||||||
"build",
|
|
||||||
"--rm=true",
|
|
||||||
"-f",
|
|
||||||
"Dockerfile",
|
|
||||||
"-t",
|
|
||||||
"plugins/drone-docker:latest",
|
|
||||||
".",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "platform argument",
|
|
||||||
build: Build{
|
|
||||||
Name: "plugins/drone-docker:latest",
|
|
||||||
Dockerfile: "Dockerfile",
|
|
||||||
Context: ".",
|
|
||||||
Platform: "test/platform",
|
|
||||||
},
|
|
||||||
want: exec.Command(
|
|
||||||
dockerExe,
|
|
||||||
"build",
|
|
||||||
"--rm=true",
|
|
||||||
"-f",
|
|
||||||
"Dockerfile",
|
|
||||||
"-t",
|
|
||||||
"plugins/drone-docker:latest",
|
|
||||||
".",
|
|
||||||
"--platform",
|
|
||||||
"test/platform",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ssh agent",
|
|
||||||
build: Build{
|
|
||||||
Name: "plugins/drone-docker:latest",
|
|
||||||
Dockerfile: "Dockerfile",
|
|
||||||
Context: ".",
|
|
||||||
SSHKeyPath: "id_rsa=/root/.ssh/id_rsa",
|
|
||||||
},
|
|
||||||
want: exec.Command(
|
|
||||||
dockerExe,
|
|
||||||
"build",
|
|
||||||
"--rm=true",
|
|
||||||
"-f",
|
|
||||||
"Dockerfile",
|
|
||||||
"-t",
|
|
||||||
"plugins/drone-docker:latest",
|
|
||||||
".",
|
|
||||||
"--ssh id_rsa=/root/.ssh/id_rsa",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tc := range tcs {
|
|
||||||
tc := tc
|
|
||||||
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
|
||||||
cmd := commandBuild(tc.build)
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(cmd.String(), tc.want.String()) {
|
|
||||||
t.Errorf("Got cmd %v, want %v", cmd, tc.want)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
"Id": "sha256:3b0709c9afb41629c79c93355feed114d08a8c1bedd975eb53af08f4b867fd91",
|
|
||||||
"RepoTags": [
|
|
||||||
"798a0dae10d63d281eff4c06eaa12001ffd23740:latest",
|
|
||||||
"tphoney/test:latest"
|
|
||||||
],
|
|
||||||
"ParsedRepoTags": [
|
|
||||||
{
|
|
||||||
"Tag": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Tag": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Tag": "798a0dae10d63d281eff4c06eaa12001ffd23740:latest"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Tag": "tphoney/test:latest"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"RepoDigests": [
|
|
||||||
"tphoney/test@sha256:93f8b95aaae7d194208b72e94a3a90544b00c8f2ad45aeb89d81a0c6ccbc5e19"
|
|
||||||
],
|
|
||||||
"Parent": "sha256:493aa330a5929027dd8ecded9fa8c473a1508d17c0fd7d6a94a7f197f8d22c60",
|
|
||||||
"Comment": "",
|
|
||||||
"Created": "2022-02-16T11:13:40.8956582Z",
|
|
||||||
"Container": "a57c0ca4dd2e081df8758e00549f7abe83803f1a1a7aaaf1cd8e685a5eb5a097",
|
|
||||||
"DockerVersion": "20.10.9",
|
|
||||||
"Author": "",
|
|
||||||
"Architecture": "amd64",
|
|
||||||
"Os": "linux",
|
|
||||||
"Size": 14045949,
|
|
||||||
"VirtualSize": 14045949,
|
|
||||||
"Metadata": {
|
|
||||||
"LastTagTime": "2022-02-16T11:13:40.9433973Z"
|
|
||||||
},
|
|
||||||
"SizeString": "13.40MB",
|
|
||||||
"VirtualSizeString": "13.40MB",
|
|
||||||
"Time": "2022-02-16T11:13:40Z",
|
|
||||||
"URL": "http://hub.docker.com/repositories/tphoney/test/"
|
|
||||||
}
|
|
||||||
138
docs/card.json
138
docs/card.json
@@ -1,138 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "AdaptiveCard",
|
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "ColumnSet",
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"type": "Column",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "Image",
|
|
||||||
"url": "https://d36jcksde1wxzq.cloudfront.net/be7833db9bddb4494d2a7c3dd659199a.png",
|
|
||||||
"size": "small"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"width": "auto"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Column",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "TextBlock",
|
|
||||||
"text": "Plugin: Drone Docker",
|
|
||||||
"wrap": true,
|
|
||||||
"size": "Small",
|
|
||||||
"weight": "Bolder",
|
|
||||||
"isSubtle": false,
|
|
||||||
"spacing": "Small"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TextBlock",
|
|
||||||
"text": "DIGEST: ${RepoDigests[0]}",
|
|
||||||
"wrap": true,
|
|
||||||
"size": "Small",
|
|
||||||
"weight": "Lighter",
|
|
||||||
"isSubtle": true,
|
|
||||||
"spacing": "Small"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"width": "stretch"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"style": "default"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "ColumnSet",
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"type": "Column",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "TextBlock",
|
|
||||||
"weight": "Lighter",
|
|
||||||
"text": "TAGS",
|
|
||||||
"wrap": true,
|
|
||||||
"size": "Small",
|
|
||||||
"isSubtle": true,
|
|
||||||
"spacing": "Medium"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "FactSet",
|
|
||||||
"facts": [
|
|
||||||
{
|
|
||||||
"title": "${Tag}",
|
|
||||||
"value": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"spacing": "Small",
|
|
||||||
"$data": "${ParsedRepoTags}",
|
|
||||||
"wrap": true,
|
|
||||||
"size": "Small",
|
|
||||||
"weight": "Bolder"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"separator": true,
|
|
||||||
"width": "auto"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Column",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "TextBlock",
|
|
||||||
"weight": "Lighter",
|
|
||||||
"text": "SIZE",
|
|
||||||
"wrap": true,
|
|
||||||
"size": "Small",
|
|
||||||
"isSubtle": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TextBlock",
|
|
||||||
"spacing": "Small",
|
|
||||||
"text": "${SizeString}",
|
|
||||||
"wrap": true,
|
|
||||||
"weight": "Bolder"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"width": "auto",
|
|
||||||
"separator": true,
|
|
||||||
"spacing": "Medium"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Column",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "TextBlock",
|
|
||||||
"weight": "Lighter",
|
|
||||||
"text": "LAST PUSHED",
|
|
||||||
"wrap": true,
|
|
||||||
"size": "Small",
|
|
||||||
"isSubtle": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TextBlock",
|
|
||||||
"spacing": "Small",
|
|
||||||
"text": "{{DATE(${Time})}} - {{TIME(${Time})}}",
|
|
||||||
"wrap": true,
|
|
||||||
"weight": "Bolder"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"width": "auto",
|
|
||||||
"separator": true,
|
|
||||||
"spacing": "Medium"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"style": "default",
|
|
||||||
"separator": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"actions": [
|
|
||||||
{
|
|
||||||
"type": "Action.OpenUrl",
|
|
||||||
"title": "Go to image",
|
|
||||||
"url": "${url}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
||||||
"version": "1.5"
|
|
||||||
}
|
|
||||||
3
go.mod
3
go.mod
@@ -3,8 +3,6 @@ module github.com/drone-plugins/drone-docker
|
|||||||
require (
|
require (
|
||||||
github.com/aws/aws-sdk-go v1.26.7
|
github.com/aws/aws-sdk-go v1.26.7
|
||||||
github.com/coreos/go-semver v0.3.0
|
github.com/coreos/go-semver v0.3.0
|
||||||
github.com/drone/drone-go v1.7.1
|
|
||||||
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743
|
|
||||||
github.com/joho/godotenv v1.3.0
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/sirupsen/logrus v1.3.0
|
github.com/sirupsen/logrus v1.3.0
|
||||||
github.com/urfave/cli v1.22.2
|
github.com/urfave/cli v1.22.2
|
||||||
@@ -18,7 +16,6 @@ require (
|
|||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 // indirect
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 // indirect
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 // indirect
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 // indirect
|
||||||
gopkg.in/yaml.v2 v2.2.8 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|||||||
10
go.sum
10
go.sum
@@ -1,4 +1,3 @@
|
|||||||
github.com/99designs/httpsignatures-go v0.0.0-20170731043157-88528bf4ca7e/go.mod h1:Xa6lInWHNQnuWoF0YPSsx+INFA9qk7/7pTjwb3PInkY=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/aws/aws-sdk-go v1.26.7 h1:ObjEnmzvSdYy8KVd3me7v/UMyCn81inLy2SyoIPoBkg=
|
github.com/aws/aws-sdk-go v1.26.7 h1:ObjEnmzvSdYy8KVd3me7v/UMyCn81inLy2SyoIPoBkg=
|
||||||
github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||||
@@ -8,12 +7,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSY
|
|||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/drone/drone-go v1.7.1 h1:ZX+3Rs8YHUSUQ5mkuMLmm1zr1ttiiE2YGNxF3AnyDKw=
|
|
||||||
github.com/drone/drone-go v1.7.1/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
|
|
||||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743 h1:X3Xxno5Ji8idrNiUoFc7QyXpqhSYlDRYQmc7mlpMBzU=
|
|
||||||
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743/go.mod h1:KrtyD5PFj++GKkFS/7/RRrfnRhAMGQwy75GLCHWrCNs=
|
|
||||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
|
||||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
@@ -38,6 +31,5 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf
|
|||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
|
|||||||
206
pipeline.libsonnet
Normal file
206
pipeline.libsonnet
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
local windows_pipe = '\\\\\\\\.\\\\pipe\\\\docker_engine';
|
||||||
|
local windows_pipe_volume = 'docker_pipe';
|
||||||
|
local test_pipeline_name = 'testing';
|
||||||
|
|
||||||
|
local windows(os) = os == 'windows';
|
||||||
|
|
||||||
|
local golang_image(os, version) =
|
||||||
|
'golang:' + '1.13' + if windows(os) then '-windowsservercore-' + version else '';
|
||||||
|
|
||||||
|
{
|
||||||
|
test(os='linux', arch='amd64', version='')::
|
||||||
|
local is_windows = windows(os);
|
||||||
|
local golang = golang_image(os, version);
|
||||||
|
local volumes = if is_windows then [{name: 'gopath', path: 'C:\\\\gopath'}] else [{name: 'gopath', path: '/go',}];
|
||||||
|
{
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: test_pipeline_name,
|
||||||
|
platform: {
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
version: if std.length(version) > 0 then version,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'vet',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go vet ./...',
|
||||||
|
],
|
||||||
|
volumes: volumes,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'test',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go test -cover ./...',
|
||||||
|
],
|
||||||
|
volumes: volumes,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: [
|
||||||
|
'refs/heads/master',
|
||||||
|
'refs/tags/**',
|
||||||
|
'refs/pull/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
volumes: [{name: 'gopath', temp: {}}]
|
||||||
|
},
|
||||||
|
|
||||||
|
build(name, os='linux', arch='amd64', version='')::
|
||||||
|
local is_windows = windows(os);
|
||||||
|
local tag = if is_windows then os + '-' + version else os + '-' + arch;
|
||||||
|
local file_suffix = std.strReplace(tag, '-', '.');
|
||||||
|
local volumes = if is_windows then [{ name: windows_pipe_volume, path: windows_pipe }] else [];
|
||||||
|
local golang = golang_image(os, version);
|
||||||
|
local plugin_repo = 'plugins/' + name;
|
||||||
|
local extension = if is_windows then '.exe' else '';
|
||||||
|
local depends_on = if name == 'docker' then [test_pipeline_name] else [tag + '-docker'];
|
||||||
|
{
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: tag + '-' + name,
|
||||||
|
platform: {
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
version: if std.length(version) > 0 then version,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'build-push',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
CGO_ENABLED: '0',
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/' + os + '/' + arch + '/drone-' + name + extension + ' ./cmd/drone-' + name,
|
||||||
|
],
|
||||||
|
when: {
|
||||||
|
event: {
|
||||||
|
exclude: ['tag'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'build-tag',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
environment: {
|
||||||
|
CGO_ENABLED: '0',
|
||||||
|
GO111MODULE: 'on',
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/' + os + '/' + arch + '/drone-' + name + extension + ' ./cmd/drone-' + name,
|
||||||
|
],
|
||||||
|
when: {
|
||||||
|
event: ['tag'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
if name == "docker" then {
|
||||||
|
name: 'executable',
|
||||||
|
image: golang,
|
||||||
|
pull: 'always',
|
||||||
|
commands: [
|
||||||
|
'./release/' + os + '/' + arch + '/drone-' + name + extension + ' --help',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'dryrun',
|
||||||
|
image: 'plugins/docker:' + tag,
|
||||||
|
pull: 'always',
|
||||||
|
settings: {
|
||||||
|
dry_run: true,
|
||||||
|
tags: tag,
|
||||||
|
dockerfile: 'docker/'+ name +'/Dockerfile.' + file_suffix,
|
||||||
|
daemon_off: if is_windows then 'true' else 'false',
|
||||||
|
repo: plugin_repo,
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
},
|
||||||
|
volumes: if std.length(volumes) > 0 then volumes,
|
||||||
|
when: {
|
||||||
|
event: ['pull_request'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish',
|
||||||
|
image: 'plugins/docker:' + tag,
|
||||||
|
pull: 'always',
|
||||||
|
settings: {
|
||||||
|
auto_tag: true,
|
||||||
|
auto_tag_suffix: tag,
|
||||||
|
daemon_off: if is_windows then 'true' else 'false',
|
||||||
|
dockerfile: 'docker/' + name + '/Dockerfile.' + file_suffix,
|
||||||
|
repo: plugin_repo,
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
},
|
||||||
|
volumes: if std.length(volumes) > 0 then volumes,
|
||||||
|
when: {
|
||||||
|
event: {
|
||||||
|
exclude: ['pull_request'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: [
|
||||||
|
'refs/heads/master',
|
||||||
|
'refs/tags/**',
|
||||||
|
'refs/pull/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
depends_on: depends_on,
|
||||||
|
volumes: if is_windows then [{ name: windows_pipe_volume, host: { path: windows_pipe } }],
|
||||||
|
},
|
||||||
|
|
||||||
|
notifications(name, os='linux', arch='amd64', version='', depends_on=[])::
|
||||||
|
{
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: 'notifications-' + name,
|
||||||
|
platform: {
|
||||||
|
os: os,
|
||||||
|
arch: arch,
|
||||||
|
version: if std.length(version) > 0 then version,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'manifest',
|
||||||
|
image: 'plugins/manifest',
|
||||||
|
pull: 'always',
|
||||||
|
settings: {
|
||||||
|
username: { from_secret: 'docker_username' },
|
||||||
|
password: { from_secret: 'docker_password' },
|
||||||
|
spec: 'docker/' + name + '/manifest.tmpl',
|
||||||
|
ignore_missing: true,
|
||||||
|
auto_tag: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'microbadger',
|
||||||
|
image: 'plugins/webhook',
|
||||||
|
pull: 'always',
|
||||||
|
settings: {
|
||||||
|
urls: { from_secret: 'microbadger_' + name },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [x + '-' + name for x in depends_on],
|
||||||
|
trigger: {
|
||||||
|
ref: [
|
||||||
|
'refs/heads/master',
|
||||||
|
'refs/tags/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
# this script is used by the continuous integration server to
|
# this script is used by the continuous integration server to
|
||||||
# build and publish the docker image for a commit to master.
|
# build and publish the docker image for a commit to master.
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$env:GOOS="windows"
|
$env:GOOS="windows"
|
||||||
$env:GOARCH="amd64"
|
$env:GOARCH="amd64"
|
||||||
@@ -14,22 +13,23 @@ if (-not (Test-Path env:REGISTRY)) {
|
|||||||
$env:REGISTRY="docker"
|
$env:REGISTRY="docker"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo $env:GOOS
|
echo $env:GOOS
|
||||||
echo $env:GOARCH
|
echo $env:GOARCH
|
||||||
echo $env:VERSION
|
echo $env:VERSION
|
||||||
echo $env:REGISTRY
|
echo $env:REGISTRY
|
||||||
|
|
||||||
# build the binary
|
# build the binary
|
||||||
Write-Host "+ go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}";
|
Write-Host "+ go build -o release/windows/amd64/drone-$env:REGISTRY.exe";
|
||||||
go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}
|
go build -o release/windows/amd64/drone-$env:REGISTRY.exe
|
||||||
|
|
||||||
# build and publish the docker image
|
# build and publish the docker image
|
||||||
docker login -u ${env:USERNAME} -p ${env:PASSWORD}
|
docker login -u $env:USERNAME -p $env:PASSWORD
|
||||||
Write-Host "+ docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64 .";
|
Write-Host "+ docker build -f docker/$env:REGISTRY/Dockerfile.windows.amd64.$env:VERSION -t plugins/$env:REGISTRY:windows-$env:VERSION-amd64 .";
|
||||||
docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64 .
|
docker build -f docker/$env:REGISTRY/Dockerfile.windows.amd64.$env:VERSION -t plugins/$env:REGISTRY:windows-$env:VERSION-amd64 .
|
||||||
Write-Host "+ docker push plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64"
|
Write-Host "+ docker push plugins/$env:REGISTRY:windows-$env:VERSION-amd64"
|
||||||
docker push plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64
|
docker push plugins/$env:REGISTRY:windows-$env:VERSION-amd64
|
||||||
|
|
||||||
# remove images from local cache
|
# remove images from local cache
|
||||||
Write-Host "+ docker rmi plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64"
|
Write-Host "+ docker rmi plugins/$env:REGISTRY:windows-$env:VERSION-amd64"
|
||||||
docker rmi plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64
|
docker rmi plugins/$env:REGISTRY:windows-$env:VERSION-amd64
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# this script is used by the continuous integration server to
|
# this script is used by the continuous integration server to
|
||||||
# build and publish the docker image for a tagged revsision.
|
# build and publish the docker image for a tagged revsision.
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$env:GOOS="windows"
|
$env:GOOS="windows"
|
||||||
$env:GOARCH="amd64"
|
$env:GOARCH="amd64"
|
||||||
@@ -20,9 +19,9 @@ if (-not (Test-Path env:REGISTRY)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# define the image tags
|
# define the image tags
|
||||||
$env:IMAGE_PATCH="plugins/${env:REGISTRY}:${env:DRONE_SEMVER_SHORT}-windows-${env:VERSION}-amd64"
|
$env:IMAGE_PATCH="plugins/$env:REGISTRY:$env:DRONE_SEMVER_SHORT-windows-$env:VERSION-amd64"
|
||||||
$env:IMAGE_MAJOR="plugins/${env:REGISTRY}:${env:DRONE_SEMVER_MAJOR}-windows-${env:VERSION}-amd64"
|
$env:IMAGE_MAJOR="plugins/$env:REGISTRY:$env:DRONE_SEMVER_MAJOR-windows-$env:VERSION-amd64"
|
||||||
$env:IMAGE_MINOR="plugins/${env:REGISTRY}:${env:DRONE_SEMVER_MAJOR}.${env:DRONE_SEMVER_MINOR}-windows-${env:VERSION}-amd64"
|
$env:IMAGE_MINOR="plugins/$env:REGISTRY:$env:DRONE_SEMVER_MAJOR.$env:DRONE_SEMVER_MINOR-windows-$env:VERSION-amd64"
|
||||||
|
|
||||||
echo "build environment:"
|
echo "build environment:"
|
||||||
echo $env:GOOS
|
echo $env:GOOS
|
||||||
@@ -30,37 +29,27 @@ echo $env:GOARCH
|
|||||||
echo $env:VERSION
|
echo $env:VERSION
|
||||||
|
|
||||||
# build the binary
|
# build the binary
|
||||||
Write-Host "+ go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}"
|
go build -o release/windows/amd64/drone-$env:REGISTRY.exe
|
||||||
go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}
|
|
||||||
|
|
||||||
# authenticate with the docker registry
|
# authenticate with the docker registry
|
||||||
docker login -u ${env:USERNAME} -p ${env:PASSWORD}
|
docker login -u $env:USERNAME -p $env:PASSWORD
|
||||||
|
|
||||||
echo "building images:"
|
echo "building images:"
|
||||||
echo ${env:IMAGE_PATCH}
|
echo $env:IMAGE_PATCH
|
||||||
echo ${env:IMAGE_MINOR}
|
echo $env:IMAGE_MINOR
|
||||||
echo ${env:IMAGE_MAJOR}
|
echo $env:IMAGE_MAJOR
|
||||||
|
|
||||||
# build and tag the docker images
|
# build and tag the docker images
|
||||||
Write-Host "+ docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t ${env:IMAGE_PATCH} ."
|
docker build -f docker/$env:REGISTRY/Dockerfile.windows.amd64.$env:VERSION -t $env:IMAGE_PATCH .
|
||||||
docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t ${env:IMAGE_PATCH} .
|
docker tag $env:IMAGE_PATCH $env:IMAGE_MAJOR
|
||||||
Write-Host "+ docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MAJOR}"
|
docker tag $env:IMAGE_PATCH $env:IMAGE_MINOR
|
||||||
docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MAJOR}
|
|
||||||
Write-Host "+ docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MINOR}"
|
|
||||||
docker tag ${env:IMAGE_PATCH} ${env:IMAGE_MINOR}
|
|
||||||
|
|
||||||
# publish the docker images
|
# publish the docker images
|
||||||
Write-Host "+ docker push ${env:IMAGE_MAJOR}"
|
docker push $env:IMAGE_MAJOR
|
||||||
docker push ${env:IMAGE_MAJOR}
|
docker push $env:IMAGE_MINOR
|
||||||
Write-Host "+ docker push ${env:IMAGE_MINOR}"
|
docker push $env:IMAGE_PATCH
|
||||||
docker push ${env:IMAGE_MINOR}
|
|
||||||
Write-Host "+ docker push ${env:IMAGE_PATCH}"
|
|
||||||
docker push ${env:IMAGE_PATCH}
|
|
||||||
|
|
||||||
# remove images after from local cache
|
# remove images after from local cache
|
||||||
Write-Host "+ docker rmi ${env:IMAGE_MAJOR}"
|
docker rmi $env:IMAGE_MAJOR
|
||||||
docker rmi ${env:IMAGE_MAJOR}
|
docker rmi $env:IMAGE_MINOR
|
||||||
Write-Host "+ docker rmi ${env:IMAGE_MINOR}"
|
docker rmi $env:IMAGE_PATCH
|
||||||
docker rmi ${env:IMAGE_MINOR}
|
|
||||||
Write-Host "+ docker rmi ${env:IMAGE_PATCH}"
|
|
||||||
docker rmi ${env:IMAGE_PATCH}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user