mirror of
https://github.com/drone-plugins/drone-docker.git
synced 2026-06-14 22:12:20 +08:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6cf4d8e9e9 | |||
| fcf616c7ad | |||
| f6d94e4ab8 | |||
| 7ce09b0eba | |||
| 024f906d29 | |||
| 475bb7a004 | |||
| 2dcf4a5d49 | |||
| d70414892d | |||
| 84d8664c70 | |||
| 4d92e8103d | |||
| 94c8139150 | |||
| 7888a798b1 | |||
| 8a12346d2f | |||
| 12be10a7ce | |||
| 5a691ae1e4 | |||
| 0d40d7fa5a | |||
| a1fb315f3b |
@@ -1,50 +0,0 @@
|
|||||||
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',
|
|
||||||
]),
|
|
||||||
]
|
|
||||||
+713
-1204
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
|||||||
release
|
release
|
||||||
coverage.out
|
coverage.out
|
||||||
vendor
|
vendor
|
||||||
|
.vscode/
|
||||||
|
Dockerfile
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [v20.14.0](https://github.com/drone-plugins/drone-docker/tree/v20.14.0) (2022-11-17)
|
||||||
|
|
||||||
|
[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)
|
## [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)
|
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.12.0...v20.13.0)
|
||||||
@@ -8,6 +20,10 @@
|
|||||||
|
|
||||||
- update docker linux amd64/arm64 to 20.10.14 [\#365](https://github.com/drone-plugins/drone-docker/pull/365) ([tphoney](https://github.com/tphoney))
|
- 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)
|
## [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)
|
[Full Changelog](https://github.com/drone-plugins/drone-docker/compare/v20.11.0...v20.12.0)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ func main() {
|
|||||||
os.Setenv("PLUGIN_REGISTRY", registry)
|
os.Setenv("PLUGIN_REGISTRY", registry)
|
||||||
os.Setenv("DOCKER_USERNAME", username)
|
os.Setenv("DOCKER_USERNAME", username)
|
||||||
os.Setenv("DOCKER_PASSWORD", password)
|
os.Setenv("DOCKER_PASSWORD", password)
|
||||||
|
os.Setenv("PLUGIN_REGISTRY_TYPE", "ACR")
|
||||||
|
|
||||||
// invoke the base docker plugin binary
|
// invoke the base docker plugin binary
|
||||||
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
docker "github.com/drone-plugins/drone-docker"
|
docker "github.com/drone-plugins/drone-docker"
|
||||||
|
"github.com/drone-plugins/drone-plugin-lib/drone"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -269,6 +270,26 @@ func main() {
|
|||||||
Usage: "card path location to write to",
|
Usage: "card path location to write to",
|
||||||
EnvVar: "DRONE_CARD_PATH",
|
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.StringFlag{
|
||||||
|
Name: "artifact-file",
|
||||||
|
Usage: "Artifact file location that will be generated by the plugin. This file will include information of docker images that are uploaded by the plugin.",
|
||||||
|
EnvVar: "PLUGIN_ARTIFACT_FILE",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "registry-type",
|
||||||
|
Usage: "registry type",
|
||||||
|
EnvVar: "PLUGIN_REGISTRY_TYPE",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@@ -277,6 +298,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func run(c *cli.Context) error {
|
func run(c *cli.Context) error {
|
||||||
|
registryType := drone.Docker
|
||||||
|
if c.String("registry-type") != "" {
|
||||||
|
registryType = drone.RegistryType(c.String("registry-type"))
|
||||||
|
}
|
||||||
|
|
||||||
plugin := docker.Plugin{
|
plugin := docker.Plugin{
|
||||||
Dryrun: c.Bool("dry-run"),
|
Dryrun: c.Bool("dry-run"),
|
||||||
Cleanup: c.BoolT("docker.purge"),
|
Cleanup: c.BoolT("docker.purge"),
|
||||||
@@ -287,7 +313,8 @@ 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"),
|
CardPath: c.String("drone-card-path"),
|
||||||
|
ArtifactFile: c.String("artifact-file"),
|
||||||
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"),
|
||||||
@@ -312,6 +339,8 @@ func run(c *cli.Context) error {
|
|||||||
SecretFiles: c.StringSlice("secrets-from-file"),
|
SecretFiles: c.StringSlice("secrets-from-file"),
|
||||||
AddHost: c.StringSlice("add-host"),
|
AddHost: c.StringSlice("add-host"),
|
||||||
Quiet: c.Bool("quiet"),
|
Quiet: c.Bool("quiet"),
|
||||||
|
Platform: c.String("platform"),
|
||||||
|
SSHAgentKey: c.String("ssh-agent-key"),
|
||||||
},
|
},
|
||||||
Daemon: docker.Daemon{
|
Daemon: docker.Daemon{
|
||||||
Registry: c.String("docker.registry"),
|
Registry: c.String("docker.registry"),
|
||||||
@@ -327,6 +356,7 @@ func run(c *cli.Context) error {
|
|||||||
DNSSearch: c.StringSlice("daemon.dns-search"),
|
DNSSearch: c.StringSlice("daemon.dns-search"),
|
||||||
MTU: c.String("daemon.mtu"),
|
MTU: c.String("daemon.mtu"),
|
||||||
Experimental: c.Bool("daemon.experimental"),
|
Experimental: c.Bool("daemon.experimental"),
|
||||||
|
RegistryType: registryType,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ func main() {
|
|||||||
os.Setenv("PLUGIN_REGISTRY", registry)
|
os.Setenv("PLUGIN_REGISTRY", registry)
|
||||||
os.Setenv("DOCKER_USERNAME", username)
|
os.Setenv("DOCKER_USERNAME", username)
|
||||||
os.Setenv("DOCKER_PASSWORD", password)
|
os.Setenv("DOCKER_PASSWORD", password)
|
||||||
|
os.Setenv("PLUGIN_REGISTRY_TYPE", "ECR")
|
||||||
|
|
||||||
// invoke the base docker plugin binary
|
// invoke the base docker plugin binary
|
||||||
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ func main() {
|
|||||||
os.Setenv("PLUGIN_REGISTRY", registry)
|
os.Setenv("PLUGIN_REGISTRY", registry)
|
||||||
os.Setenv("DOCKER_USERNAME", username)
|
os.Setenv("DOCKER_USERNAME", username)
|
||||||
os.Setenv("DOCKER_PASSWORD", password)
|
os.Setenv("DOCKER_PASSWORD", password)
|
||||||
|
os.Setenv("PLUGIN_REGISTRY_TYPE", "GCR")
|
||||||
|
|
||||||
// invoke the base docker plugin binary
|
// invoke the base docker plugin binary
|
||||||
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
cmd := exec.Command(docker.GetDroneDockerExecCmd())
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
//go:build !windows
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -17,8 +18,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 = ioutil.Discard
|
cmd.Stdout = io.Discard
|
||||||
cmd.Stderr = ioutil.Discard
|
cmd.Stderr = io.Discard
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
trace(cmd)
|
trace(cmd)
|
||||||
|
|||||||
@@ -1,32 +1,35 @@
|
|||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/drone-plugins/drone-plugin-lib/drone"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// Daemon defines Docker daemon parameters.
|
// Daemon defines Docker daemon parameters.
|
||||||
Daemon struct {
|
Daemon struct {
|
||||||
Registry string // Docker registry
|
Registry string // Docker registry
|
||||||
Mirror string // Docker registry mirror
|
Mirror string // Docker registry mirror
|
||||||
Insecure bool // Docker daemon enable insecure registries
|
Insecure bool // Docker daemon enable insecure registries
|
||||||
StorageDriver string // Docker daemon storage driver
|
StorageDriver string // Docker daemon storage driver
|
||||||
StoragePath string // Docker daemon storage path
|
StoragePath string // Docker daemon storage path
|
||||||
Disabled bool // DOcker daemon is disabled (already running)
|
Disabled bool // DOcker daemon is disabled (already running)
|
||||||
Debug bool // Docker daemon started in debug mode
|
Debug bool // Docker daemon started in debug mode
|
||||||
Bip string // Docker daemon network bridge IP address
|
Bip string // Docker daemon network bridge IP address
|
||||||
DNS []string // Docker daemon dns server
|
DNS []string // Docker daemon dns server
|
||||||
DNSSearch []string // Docker daemon dns search domain
|
DNSSearch []string // Docker daemon dns search domain
|
||||||
MTU string // Docker daemon mtu setting
|
MTU string // Docker daemon mtu setting
|
||||||
IPv6 bool // Docker daemon IPv6 networking
|
IPv6 bool // Docker daemon IPv6 networking
|
||||||
Experimental bool // Docker daemon enable experimental mode
|
Experimental bool // Docker daemon enable experimental mode
|
||||||
|
RegistryType drone.RegistryType // Docker registry type
|
||||||
}
|
}
|
||||||
|
|
||||||
// Login defines Docker login parameters.
|
// Login defines Docker login parameters.
|
||||||
@@ -63,16 +66,20 @@ type (
|
|||||||
SecretFiles []string // Docker build secrets with file as source
|
SecretFiles []string // Docker build secrets with file as source
|
||||||
AddHost []string // Docker build add-host
|
AddHost []string // Docker build add-host
|
||||||
Quiet bool // Docker build quiet
|
Quiet bool // Docker build quiet
|
||||||
|
Platform string // Docker build platform
|
||||||
|
SSHAgentKey string // Docker build ssh agent key
|
||||||
|
SSHKeyPath string // Docker build ssh key path
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
CardPath string // Card path to write file to
|
||||||
|
ArtifactFile string // Artifact path to write file to
|
||||||
}
|
}
|
||||||
|
|
||||||
Card []struct {
|
Card []struct {
|
||||||
@@ -105,6 +112,7 @@ type (
|
|||||||
|
|
||||||
// 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()
|
||||||
@@ -143,7 +151,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 := ioutil.WriteFile(path, []byte(p.Login.Config), 0600)
|
err := os.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)
|
||||||
}
|
}
|
||||||
@@ -178,6 +186,15 @@ 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
|
||||||
|
|
||||||
for _, tag := range p.Build.Tags {
|
for _, tag := range p.Build.Tags {
|
||||||
@@ -211,6 +228,16 @@ func (p Plugin) Exec() error {
|
|||||||
fmt.Printf("Could not create adaptive card. %s\n", err)
|
fmt.Printf("Could not create adaptive card. %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.ArtifactFile != "" {
|
||||||
|
if digest, err := getDigest(p.Build.Name); err == nil {
|
||||||
|
if err = drone.WritePluginArtifactFile(p.Daemon.RegistryType, p.ArtifactFile, p.Daemon.Registry, p.Build.Repo, digest, p.Build.Tags); err != nil {
|
||||||
|
fmt.Printf("failed to write plugin artifact file at path: %s with error: %s\n", p.ArtifactFile, err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("Could not fetch the digest. %s\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// execute cleanup routines in batch mode
|
// execute cleanup routines in batch mode
|
||||||
if p.Cleanup {
|
if p.Cleanup {
|
||||||
// clear the slice
|
// clear the slice
|
||||||
@@ -324,6 +351,12 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
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{
|
||||||
@@ -349,8 +382,8 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to enable buildkit, for secret support
|
// we need to enable buildkit, for secret support and ssh agent support
|
||||||
if build.Secret != "" || len(build.SecretEnvs) > 0 || len(build.SecretFiles) > 0 {
|
if build.Secret != "" || len(build.SecretEnvs) > 0 || len(build.SecretFiles) > 0 || build.SSHAgentKey != "" {
|
||||||
os.Setenv("DOCKER_BUILDKIT", "1")
|
os.Setenv("DOCKER_BUILDKIT", "1")
|
||||||
}
|
}
|
||||||
return exec.Command(dockerExe, args...)
|
return exec.Command(dockerExe, args...)
|
||||||
@@ -503,6 +536,23 @@ 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) {
|
||||||
@@ -516,3 +566,19 @@ func GetDroneDockerExecCmd() string {
|
|||||||
|
|
||||||
return "drone-docker"
|
return "drone-docker"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDigest(buildName string) (string, error) {
|
||||||
|
cmd := exec.Command("docker", "inspect", "--format='{{index .RepoDigests 0}}'", buildName)
|
||||||
|
output, err := cmd.Output()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the output to extract the repo digest.
|
||||||
|
digest := strings.Trim(string(output), "'\n")
|
||||||
|
parts := strings.Split(digest, "@")
|
||||||
|
if len(parts) > 1 {
|
||||||
|
return parts[1], nil
|
||||||
|
}
|
||||||
|
return "", errors.New("unable to fetch digest")
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM plugins/docker:linux-arm
|
|
||||||
|
|
||||||
ADD release/linux/arm/drone-acr /bin/
|
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-acr"]
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# 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" ]
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1803-amd64
|
FROM plugins/docker:windows-ltsc2022-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" `
|
||||||
@@ -17,18 +17,6 @@ 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:
|
||||||
@@ -36,14 +24,8 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1903
|
version: ltsc2022
|
||||||
-
|
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: windows
|
|
||||||
version: 1909
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
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,26 +0,0 @@
|
|||||||
# 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,9 +1,10 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM mcr.microsoft.com/windows/servercore:1809 as download
|
# using 1809-KB5021237-amd64 as base image, 1809-KB5022286-amd64 does not work
|
||||||
|
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 18.09.1
|
ENV DOCKER_VERSION 19.03.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:\ ; `
|
||||||
@@ -13,7 +14,8 @@ 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
|
FROM mcr.microsoft.com/windows/nanoserver:1809-KB5021237-amd64
|
||||||
|
|
||||||
USER ContainerAdministrator
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
@@ -21,6 +23,7 @@ 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,28 +0,0 @@
|
|||||||
# 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" ]
|
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM mcr.microsoft.com/windows/servercore:1903 as download
|
FROM mcr.microsoft.com/windows/servercore:ltsc2022 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:1903
|
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
|
||||||
USER ContainerAdministrator
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
@@ -17,18 +17,6 @@ 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:
|
||||||
@@ -36,14 +24,8 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1903
|
version: ltsc2022
|
||||||
-
|
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: windows
|
|
||||||
version: 1909
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM plugins/docker:linux-arm
|
|
||||||
|
|
||||||
ADD release/linux/arm/drone-ecr /bin/
|
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# escape=`
|
|
||||||
FROM plugins/docker:windows-1803-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" ]
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1909-amd64
|
FROM plugins/docker:windows-ltsc2022-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" `
|
||||||
@@ -17,18 +17,6 @@ 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:
|
||||||
@@ -36,14 +24,8 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1903
|
version: ltsc2022
|
||||||
-
|
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: windows
|
|
||||||
version: 1909
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM plugins/docker:linux-arm
|
|
||||||
|
|
||||||
ADD release/linux/arm/drone-gcr /bin/
|
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# 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" ]
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1803-amd64
|
FROM plugins/docker:windows-ltsc2022-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" `
|
||||||
@@ -17,18 +17,6 @@ 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:
|
||||||
@@ -36,8 +24,8 @@ manifests:
|
|||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1809
|
||||||
-
|
-
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1909
|
version: ltsc2022
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM plugins/docker:linux-arm
|
|
||||||
|
|
||||||
ADD release/linux/arm/drone-heroku /bin/
|
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"]
|
|
||||||
@@ -17,9 +17,3 @@ 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
|
|
||||||
|
|||||||
@@ -114,6 +114,47 @@ func TestCommandBuild(t *testing.T) {
|
|||||||
".",
|
".",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
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 {
|
for _, tc := range tcs {
|
||||||
|
|||||||
@@ -3,22 +3,21 @@ 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-plugins/drone-plugin-lib v0.4.1
|
||||||
github.com/drone/drone-go v1.7.1
|
github.com/drone/drone-go v1.7.1
|
||||||
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743
|
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.9.0
|
||||||
github.com/urfave/cli v1.22.2
|
github.com/urfave/cli v1.22.2
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.0.1 // indirect
|
golang.org/x/sys v0.0.0-20220731174439-a90be440212d // indirect
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 // indirect
|
|
||||||
gopkg.in/yaml.v2 v2.2.8 // indirect
|
gopkg.in/yaml.v2 v2.2.8 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
github.com/99designs/httpsignatures-go v0.0.0-20170731043157-88528bf4ca7e/go.mod h1:Xa6lInWHNQnuWoF0YPSsx+INFA9qk7/7pTjwb3PInkY=
|
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/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
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=
|
||||||
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
|
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
|
||||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
|
||||||
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/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
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-plugins/drone-plugin-lib v0.4.1 h1:47rZlmcMpr1hSp+6Gl+1Z4t+efi/gMQU3lxukC1Yg64=
|
||||||
|
github.com/drone-plugins/drone-plugin-lib v0.4.1/go.mod h1:KwCu92jFjHV3xv2hu5Qg/8zBNvGwbhoJDQw/EwnTvoM=
|
||||||
github.com/drone/drone-go v1.7.1 h1:ZX+3Rs8YHUSUQ5mkuMLmm1zr1ttiiE2YGNxF3AnyDKw=
|
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/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 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||||
@@ -18,26 +23,28 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5i
|
|||||||
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=
|
||||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
|
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||||
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
|
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
|
||||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
|
github.com/urfave/cli/v2 v2.23.6/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20220731174439-a90be440212d h1:Sv5ogFZatcgIMMtBSTTAgMYsicp25MXBubjXNDKwm80=
|
||||||
|
golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
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/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 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -1,206 +0,0 @@
|
|||||||
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/**',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user