forked from Ivasoft/drone-docker
Compare commits
32 Commits
v18.09.1
...
update-win
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b71fe6cdd | ||
|
|
e4056d8499 | ||
|
|
a5076e74dc | ||
|
|
d913d6e7dc | ||
|
|
1482cb1143 | ||
|
|
eb6d634460 | ||
|
|
77396e3f59 | ||
|
|
675553c96d | ||
|
|
d929356ba1 | ||
|
|
9701f08184 | ||
|
|
6cc2e43e64 | ||
|
|
b5598ee56d | ||
|
|
8219e78eca | ||
|
|
23b5e6bcd9 | ||
|
|
56e470dcda | ||
|
|
8d54531f2f | ||
|
|
05c329ab6e | ||
|
|
0099cd6056 | ||
|
|
00ee2c290c | ||
|
|
65bb87f497 | ||
|
|
f2aeb0f7fc | ||
|
|
9488d3352e | ||
|
|
528dc0a7b3 | ||
|
|
cc112b3ed0 | ||
|
|
122443b3e6 | ||
|
|
063f479004 | ||
|
|
18c4e995d3 | ||
|
|
bae9d8ddbf | ||
|
|
af9fdad1d9 | ||
|
|
196c393da4 | ||
|
|
c69ad3dfaf | ||
|
|
c6dab33e03 |
39
.drone.yml
39
.drone.yml
@@ -115,6 +115,44 @@ trigger:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- testing
|
- testing
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: ssh
|
||||||
|
name: windows-1909-amd64-docker
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: windows
|
||||||
|
|
||||||
|
server:
|
||||||
|
host: windows.1909.amd64.plugins.drone.ci
|
||||||
|
password:
|
||||||
|
from_secret: windows_password
|
||||||
|
user:
|
||||||
|
from_secret: windows_username
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
commands:
|
||||||
|
# TODO use the new DRONE_SEMVER_SHORT environment variables to
|
||||||
|
# publish docker images for tag events.
|
||||||
|
- go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
|
||||||
|
- docker login -u $env:USERNAME -p $env:PASSWORD
|
||||||
|
- docker build -f docker/docker/Dockerfile.windows.1909 -t plugins/docker:windows-1909-amd64 .
|
||||||
|
- docker push plugins/docker:windows-1909-amd64
|
||||||
|
environment:
|
||||||
|
CGO_ENABLED: "0"
|
||||||
|
USERNAME:
|
||||||
|
from_secret: docker_username
|
||||||
|
PASSWORD:
|
||||||
|
from_secret: docker_password
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- testing
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: linux-amd64-docker
|
name: linux-amd64-docker
|
||||||
@@ -404,6 +442,7 @@ trigger:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- windows-1809-amd64-docker
|
- windows-1809-amd64-docker
|
||||||
- windows-1903-amd64-docker
|
- windows-1903-amd64-docker
|
||||||
|
- windows-1909-amd64-docker
|
||||||
- linux-amd64-docker
|
- linux-amd64-docker
|
||||||
- linux-arm64-docker
|
- linux-arm64-docker
|
||||||
- linux-arm-docker
|
- linux-arm-docker
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
[](http://godoc.org/github.com/drone-plugins/drone-docker)
|
[](http://godoc.org/github.com/drone-plugins/drone-docker)
|
||||||
[](https://goreportcard.com/report/github.com/drone-plugins/drone-docker)
|
[](https://goreportcard.com/report/github.com/drone-plugins/drone-docker)
|
||||||
|
|
||||||
Drone plugin to build and publish Docker images to a container registry. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-docker/).
|
Drone plugin uses Docker-in-Docker to build and publish Docker images to a container registry. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-docker/).
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,16 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Load env-file if it exists first
|
||||||
|
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
|
||||||
|
godotenv.Load(env)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
repo = getenv("PLUGIN_REPO")
|
repo = getenv("PLUGIN_REPO")
|
||||||
registry = getenv("PLUGIN_REGISTRY")
|
registry = getenv("PLUGIN_REGISTRY")
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
"github.com/drone-plugins/drone-docker"
|
docker "github.com/drone-plugins/drone-docker"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -147,6 +147,11 @@ func main() {
|
|||||||
Usage: "build args",
|
Usage: "build args",
|
||||||
EnvVar: "PLUGIN_BUILD_ARGS_FROM_ENV",
|
EnvVar: "PLUGIN_BUILD_ARGS_FROM_ENV",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "quiet",
|
||||||
|
Usage: "quiet docker build",
|
||||||
|
EnvVar: "PLUGIN_QUIET",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "target",
|
Name: "target",
|
||||||
Usage: "build target",
|
Usage: "build target",
|
||||||
@@ -208,6 +213,11 @@ func main() {
|
|||||||
Usage: "docker email",
|
Usage: "docker email",
|
||||||
EnvVar: "PLUGIN_EMAIL,DOCKER_EMAIL",
|
EnvVar: "PLUGIN_EMAIL,DOCKER_EMAIL",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "docker.config",
|
||||||
|
Usage: "docker json dockerconfig content",
|
||||||
|
EnvVar: "PLUGIN_CONFIG",
|
||||||
|
},
|
||||||
cli.BoolTFlag{
|
cli.BoolTFlag{
|
||||||
Name: "docker.purge",
|
Name: "docker.purge",
|
||||||
Usage: "docker should cleanup images",
|
Usage: "docker should cleanup images",
|
||||||
@@ -244,6 +254,7 @@ func run(c *cli.Context) error {
|
|||||||
Username: c.String("docker.username"),
|
Username: c.String("docker.username"),
|
||||||
Password: c.String("docker.password"),
|
Password: c.String("docker.password"),
|
||||||
Email: c.String("docker.email"),
|
Email: c.String("docker.email"),
|
||||||
|
Config: c.String("docker.config"),
|
||||||
},
|
},
|
||||||
Build: docker.Build{
|
Build: docker.Build{
|
||||||
Remote: c.String("remote.url"),
|
Remote: c.String("remote.url"),
|
||||||
@@ -263,6 +274,7 @@ func run(c *cli.Context) error {
|
|||||||
LabelSchema: c.StringSlice("label-schema"),
|
LabelSchema: c.StringSlice("label-schema"),
|
||||||
NoCache: c.Bool("no-cache"),
|
NoCache: c.Bool("no-cache"),
|
||||||
AddHost: c.StringSlice("add-host"),
|
AddHost: c.StringSlice("add-host"),
|
||||||
|
Quiet: c.Bool("quiet"),
|
||||||
},
|
},
|
||||||
Daemon: docker.Daemon{
|
Daemon: docker.Daemon{
|
||||||
Registry: c.String("docker.registry"),
|
Registry: c.String("docker.registry"),
|
||||||
@@ -286,10 +298,15 @@ func run(c *cli.Context) error {
|
|||||||
c.String("commit.ref"),
|
c.String("commit.ref"),
|
||||||
c.String("repo.branch"),
|
c.String("repo.branch"),
|
||||||
) {
|
) {
|
||||||
plugin.Build.Tags = docker.DefaultTagSuffix(
|
tag, err := docker.DefaultTagSuffix(
|
||||||
c.String("commit.ref"),
|
c.String("commit.ref"),
|
||||||
c.String("tags.suffix"),
|
c.String("tags.suffix"),
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Printf("cannot build docker image for %s, invalid semantic version", c.String("commit.ref"))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
plugin.Build.Tags = tag
|
||||||
} else {
|
} else {
|
||||||
logrus.Printf("skipping automated docker build for %s", c.String("commit.ref"))
|
logrus.Printf("skipping automated docker build for %s", c.String("commit.ref"))
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
|
|
||||||
"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"
|
||||||
@@ -20,6 +22,11 @@ import (
|
|||||||
const defaultRegion = "us-east-1"
|
const defaultRegion = "us-east-1"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Load env-file if it exists first
|
||||||
|
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
|
||||||
|
godotenv.Load(env)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
repo = getenv("PLUGIN_REPO")
|
repo = getenv("PLUGIN_REPO")
|
||||||
registry = getenv("PLUGIN_REGISTRY")
|
registry = getenv("PLUGIN_REGISTRY")
|
||||||
|
|||||||
@@ -6,12 +6,19 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// gcr default username
|
// gcr default username
|
||||||
const username = "_json_key"
|
const username = "_json_key"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Load env-file if it exists first
|
||||||
|
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
|
||||||
|
godotenv.Load(env)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
repo = getenv("PLUGIN_REPO")
|
repo = getenv("PLUGIN_REPO")
|
||||||
registry = getenv("PLUGIN_REGISTRY")
|
registry = getenv("PLUGIN_REGISTRY")
|
||||||
|
|||||||
@@ -4,9 +4,16 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Load env-file if it exists first
|
||||||
|
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
|
||||||
|
godotenv.Load(env)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
registry = "registry.heroku.com"
|
registry = "registry.heroku.com"
|
||||||
process = getenv("PLUGIN_PROCESS_TYPE")
|
process = getenv("PLUGIN_PROCESS_TYPE")
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
const dockerExe = "/usr/local/bin/docker"
|
const dockerExe = "/usr/local/bin/docker"
|
||||||
const dockerdExe = "/usr/local/bin/dockerd"
|
const dockerdExe = "/usr/local/bin/dockerd"
|
||||||
|
const dockerHome = "/root/.docker/"
|
||||||
|
|
||||||
func (p Plugin) startDaemon() {
|
func (p Plugin) startDaemon() {
|
||||||
cmd := commandDaemon(p.Daemon)
|
cmd := commandDaemon(p.Daemon)
|
||||||
@@ -23,4 +24,4 @@ func (p Plugin) startDaemon() {
|
|||||||
trace(cmd)
|
trace(cmd)
|
||||||
cmd.Run()
|
cmd.Run()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package docker
|
|||||||
|
|
||||||
const dockerExe = "C:\\bin\\docker.exe"
|
const dockerExe = "C:\\bin\\docker.exe"
|
||||||
const dockerdExe = ""
|
const dockerdExe = ""
|
||||||
|
const dockerHome = "C:\\ProgramData\\docker\\"
|
||||||
|
|
||||||
func (p Plugin) startDaemon() {
|
func (p Plugin) startDaemon() {
|
||||||
// this is a no-op on windows
|
// this is a no-op on windows
|
||||||
|
|||||||
49
docker.go
49
docker.go
@@ -2,8 +2,10 @@ package docker
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -32,6 +34,7 @@ type (
|
|||||||
Username string // Docker registry username
|
Username string // Docker registry username
|
||||||
Password string // Docker registry password
|
Password string // Docker registry password
|
||||||
Email string // Docker registry email
|
Email string // Docker registry email
|
||||||
|
Config string // Docker Auth Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build defines Docker build parameters.
|
// Build defines Docker build parameters.
|
||||||
@@ -53,6 +56,7 @@ type (
|
|||||||
Labels []string // Label map
|
Labels []string // Label map
|
||||||
NoCache bool // Docker build no-cache
|
NoCache bool // Docker build no-cache
|
||||||
AddHost []string // Docker build add-host
|
AddHost []string // Docker build add-host
|
||||||
|
Quiet bool // Docker build quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin defines the Docker plugin parameters.
|
// Plugin defines the Docker plugin parameters.
|
||||||
@@ -83,6 +87,17 @@ func (p Plugin) Exec() error {
|
|||||||
time.Sleep(time.Second * 1)
|
time.Sleep(time.Second * 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create Auth Config File
|
||||||
|
if p.Login.Config != "" {
|
||||||
|
os.MkdirAll(dockerHome, 0600)
|
||||||
|
|
||||||
|
path := filepath.Join(dockerHome, "config.json")
|
||||||
|
err := ioutil.WriteFile(path, []byte(p.Login.Config), 0600)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error writeing config.json: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// login to the Docker registry
|
// login to the Docker registry
|
||||||
if p.Login.Password != "" {
|
if p.Login.Password != "" {
|
||||||
cmd := commandLogin(p.Login)
|
cmd := commandLogin(p.Login)
|
||||||
@@ -90,8 +105,15 @@ func (p Plugin) Exec() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error authenticating: %s", err)
|
return fmt.Errorf("Error authenticating: %s", err)
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
fmt.Println("Registry credentials not provided. Guest mode enabled.")
|
|
||||||
|
switch {
|
||||||
|
case p.Login.Password != "":
|
||||||
|
fmt.Println("Detected registry credentials")
|
||||||
|
case p.Login.Config != "":
|
||||||
|
fmt.Println("Detected registry credentials file")
|
||||||
|
default:
|
||||||
|
fmt.Println("Registry credentials or Docker config not provided. Guest mode enabled.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.Build.Squash && !p.Daemon.Experimental {
|
if p.Build.Squash && !p.Daemon.Experimental {
|
||||||
@@ -135,6 +157,10 @@ func (p Plugin) Exec() error {
|
|||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil && isCommandPull(cmd.Args) {
|
if err != nil && isCommandPull(cmd.Args) {
|
||||||
fmt.Printf("Could not pull cache-from image %s. Ignoring...\n", cmd.Args[2])
|
fmt.Printf("Could not pull cache-from image %s. Ignoring...\n", cmd.Args[2])
|
||||||
|
} else if err != nil && isCommandPrune(cmd.Args) {
|
||||||
|
fmt.Printf("Could not prune system containers. Ignoring...\n")
|
||||||
|
} else if err != nil && isCommandRmi(cmd.Args) {
|
||||||
|
fmt.Printf("Could not remove image %s. Ignoring...\n", cmd.Args[2])
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -222,6 +248,9 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
if build.Target != "" {
|
if build.Target != "" {
|
||||||
args = append(args, "--target", build.Target)
|
args = append(args, "--target", build.Target)
|
||||||
}
|
}
|
||||||
|
if build.Quiet {
|
||||||
|
args = append(args, "--quiet")
|
||||||
|
}
|
||||||
|
|
||||||
labelSchema := []string{
|
labelSchema := []string{
|
||||||
"schema-version=1.0",
|
"schema-version=1.0",
|
||||||
@@ -309,7 +338,10 @@ func commandPush(build Build, tag string) *exec.Cmd {
|
|||||||
|
|
||||||
// helper function to create the docker daemon command.
|
// helper function to create the docker daemon command.
|
||||||
func commandDaemon(daemon Daemon) *exec.Cmd {
|
func commandDaemon(daemon Daemon) *exec.Cmd {
|
||||||
args := []string{"--data-root", daemon.StoragePath}
|
args := []string{
|
||||||
|
"--data-root", daemon.StoragePath,
|
||||||
|
"--host=unix:///var/run/docker.sock",
|
||||||
|
}
|
||||||
|
|
||||||
if daemon.StorageDriver != "" {
|
if daemon.StorageDriver != "" {
|
||||||
args = append(args, "-s", daemon.StorageDriver)
|
args = append(args, "-s", daemon.StorageDriver)
|
||||||
@@ -341,10 +373,21 @@ func commandDaemon(daemon Daemon) *exec.Cmd {
|
|||||||
return exec.Command(dockerdExe, args...)
|
return exec.Command(dockerdExe, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// helper to check if args match "docker prune"
|
||||||
|
func isCommandPrune(args []string) bool {
|
||||||
|
return len(args) > 3 && args[2] == "prune"
|
||||||
|
}
|
||||||
|
|
||||||
func commandPrune() *exec.Cmd {
|
func commandPrune() *exec.Cmd {
|
||||||
return exec.Command(dockerExe, "system", "prune", "-f")
|
return exec.Command(dockerExe, "system", "prune", "-f")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper to check if args match "docker rmi"
|
||||||
|
func isCommandRmi(args []string) bool {
|
||||||
|
return len(args) > 2 && args[1] == "rmi"
|
||||||
|
}
|
||||||
|
|
||||||
func commandRmi(tag string) *exec.Cmd {
|
func commandRmi(tag string) *exec.Cmd {
|
||||||
return exec.Command(dockerExe, "rmi", tag)
|
return exec.Command(dockerExe, "rmi", tag)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1809
|
FROM plugins/docker:windows-1809-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" `
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1803
|
FROM plugins/docker:windows-1903-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.1909
Normal file
10
docker/acr/Dockerfile.windows.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" ]
|
||||||
10
docker/acr/Dockerfile.windows.2004
Normal file
10
docker/acr/Dockerfile.windows.2004
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-2004-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,36 +1,43 @@
|
|||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
manifests:
|
manifests:
|
||||||
-
|
- image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
-
|
- image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
|
||||||
platform:
|
platform:
|
||||||
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
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
|
||||||
platform:
|
platform:
|
||||||
architecture: arm
|
architecture: arm
|
||||||
os: linux
|
os: linux
|
||||||
variant: v7
|
variant: v7
|
||||||
-
|
- image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-2004-amd64
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1803
|
version: 2004
|
||||||
-
|
- image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1909
|
||||||
|
- image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1903
|
||||||
|
- image: plugins/acr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
FROM docker:18.09.0-dind
|
FROM docker:19.03.8-dind
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
ADD release/linux/amd64/drone-docker /bin/
|
ADD release/linux/amd64/drone-docker /bin/
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
FROM arm32v6/docker:18.09.0-dind
|
FROM arm32v6/docker:19.03.8-dind
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
ADD release/linux/arm/drone-docker /bin/
|
ADD release/linux/arm/drone-docker /bin/
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
FROM arm64v8/docker:18.09.0-dind
|
FROM arm64v8/docker:19.03.8-dind
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
ADD release/linux/arm64/drone-docker /bin/
|
ADD release/linux/arm64/drone-docker /bin/
|
||||||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ FROM mcr.microsoft.com/windows/servercore:1809 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.9-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
Remove-Item -Path innoextract.zip
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
@@ -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:1809
|
FROM plugins/base:windows-1809-amd64
|
||||||
USER ContainerAdministrator
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
|
|||||||
|
|
||||||
ENV DOCKER_VERSION 19.03.1
|
ENV DOCKER_VERSION 19.03.1
|
||||||
|
|
||||||
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.9-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
Remove-Item -Path innoextract.zip
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
@@ -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 plugins/base:windows-1903-amd64
|
||||||
USER ContainerAdministrator
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
@@ -21,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,11 +1,11 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM mcr.microsoft.com/windows/servercore:1803 as download
|
FROM mcr.microsoft.com/windows/servercore:1909 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.9-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
Remove-Item -Path innoextract.zip
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
@@ -13,7 +13,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 plugins/base:windows-1803
|
FROM plugins/base:windows-1909-amd64
|
||||||
|
USER ContainerAdministrator
|
||||||
|
|
||||||
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
org.label-schema.name="Drone Docker" `
|
org.label-schema.name="Drone Docker" `
|
||||||
27
docker/docker/Dockerfile.windows.2004
Normal file
27
docker/docker/Dockerfile.windows.2004
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:2004 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.9-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-2004-amd64
|
||||||
|
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"
|
||||||
|
|
||||||
|
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,43 +1,44 @@
|
|||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
manifests:
|
manifests:
|
||||||
-
|
- image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
-
|
- image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
|
||||||
platform:
|
platform:
|
||||||
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
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
|
||||||
platform:
|
platform:
|
||||||
architecture: arm
|
architecture: arm
|
||||||
os: linux
|
os: linux
|
||||||
variant: v7
|
variant: v7
|
||||||
-
|
- image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-2004-amd64
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1803
|
version: 2004
|
||||||
-
|
- image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1809
|
version: 1909
|
||||||
-
|
- 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-1903-amd64
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1903
|
version: 1903
|
||||||
|
- image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1809
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1809
|
FROM plugins/docker:windows-1809-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" `
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1803
|
FROM plugins/docker:windows-1903-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.1909
Normal file
10
docker/ecr/Dockerfile.windows.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" ]
|
||||||
10
docker/ecr/Dockerfile.windows.2004
Normal file
10
docker/ecr/Dockerfile.windows.2004
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-2004-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,36 +1,43 @@
|
|||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
manifests:
|
manifests:
|
||||||
-
|
- image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
-
|
- image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
|
||||||
platform:
|
platform:
|
||||||
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
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
|
||||||
platform:
|
platform:
|
||||||
architecture: arm
|
architecture: arm
|
||||||
os: linux
|
os: linux
|
||||||
variant: v7
|
variant: v7
|
||||||
-
|
- image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-2004-amd64
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1803
|
version: 2004
|
||||||
-
|
- image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1909
|
||||||
|
- image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1903
|
||||||
|
- image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1809
|
FROM plugins/docker:windows-1809-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" `
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# escape=`
|
# escape=`
|
||||||
FROM plugins/docker:windows-1803
|
FROM plugins/docker:windows-1903-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.1909
Normal file
10
docker/gcr/Dockerfile.windows.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" ]
|
||||||
10
docker/gcr/Dockerfile.windows.2004
Normal file
10
docker/gcr/Dockerfile.windows.2004
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-2004-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,36 +1,43 @@
|
|||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
manifests:
|
manifests:
|
||||||
-
|
- image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
-
|
- image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
|
||||||
platform:
|
platform:
|
||||||
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
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
|
||||||
platform:
|
platform:
|
||||||
architecture: arm
|
architecture: arm
|
||||||
os: linux
|
os: linux
|
||||||
variant: v7
|
variant: v7
|
||||||
-
|
- image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-2004-amd64
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
version: 1803
|
version: 2004
|
||||||
-
|
- 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-1809
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1909
|
||||||
|
- image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1903
|
||||||
|
- image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: windows
|
os: windows
|
||||||
|
|||||||
@@ -1,24 +1,23 @@
|
|||||||
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
manifests:
|
manifests:
|
||||||
-
|
- image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
-
|
- image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
|
||||||
platform:
|
platform:
|
||||||
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
|
||||||
image: plugins/heroku:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
|
||||||
platform:
|
platform:
|
||||||
architecture: arm
|
architecture: arm
|
||||||
os: linux
|
os: linux
|
||||||
|
|||||||
7
go.mod
7
go.mod
@@ -1,14 +1,13 @@
|
|||||||
module github.com/drone-plugins/drone-docker
|
module github.com/drone-plugins/drone-docker
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/aws/aws-sdk-go v1.16.15
|
github.com/aws/aws-sdk-go v1.26.7
|
||||||
github.com/coreos/go-semver v0.2.0
|
github.com/coreos/go-semver v0.2.0
|
||||||
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.20.0
|
github.com/urfave/cli v1.22.2
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e // indirect
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e // indirect
|
||||||
golang.org/x/text v0.3.0 // indirect
|
golang.org/x/text v0.3.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.2.2 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/urfave/cli => github.com/bradrydzewski/cli v0.0.0-20190108225652-0d51abd87c77
|
go 1.13
|
||||||
|
|||||||
15
go.sum
15
go.sum
@@ -1,9 +1,10 @@
|
|||||||
github.com/aws/aws-sdk-go v1.16.15 h1:kQyxfRyjAwIYjf0225sn/pn+WAlncKyI8dmT3+ItMFE=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/aws/aws-sdk-go v1.16.15/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
github.com/aws/aws-sdk-go v1.26.7 h1:ObjEnmzvSdYy8KVd3me7v/UMyCn81inLy2SyoIPoBkg=
|
||||||
github.com/bradrydzewski/cli v0.0.0-20190108225652-0d51abd87c77 h1:bXc5tB7PFVzIHUfTECDt0Orw6mIAzHePWBmemvtnfiU=
|
github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||||
github.com/bradrydzewski/cli v0.0.0-20190108225652-0d51abd87c77/go.mod h1:4SmsVk3pOgYeJlG54e23Ztd/HucXeH5RmH5bNO+uOpk=
|
|
||||||
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
|
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
|
||||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
github.com/coreos/go-semver v0.2.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/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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
|
||||||
@@ -14,6 +15,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGi
|
|||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
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/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
|
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.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
|
||||||
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
@@ -21,6 +26,8 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
|
|||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
||||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
|
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
|
||||||
|
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=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
|
||||||
|
|||||||
23
tags.go
23
tags.go
@@ -9,10 +9,13 @@ import (
|
|||||||
|
|
||||||
// DefaultTagSuffix returns a set of default suggested tags
|
// DefaultTagSuffix returns a set of default suggested tags
|
||||||
// based on the commit ref with an attached suffix.
|
// based on the commit ref with an attached suffix.
|
||||||
func DefaultTagSuffix(ref, suffix string) []string {
|
func DefaultTagSuffix(ref, suffix string) ([]string, error) {
|
||||||
tags := DefaultTags(ref)
|
tags, err := DefaultTags(ref)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if len(suffix) == 0 {
|
if len(suffix) == 0 {
|
||||||
return tags
|
return tags, nil
|
||||||
}
|
}
|
||||||
for i, tag := range tags {
|
for i, tag := range tags {
|
||||||
if tag == "latest" {
|
if tag == "latest" {
|
||||||
@@ -21,7 +24,7 @@ func DefaultTagSuffix(ref, suffix string) []string {
|
|||||||
tags[i] = fmt.Sprintf("%s-%s", tag, suffix)
|
tags[i] = fmt.Sprintf("%s-%s", tag, suffix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tags
|
return tags, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func splitOff(input string, delim string) string {
|
func splitOff(input string, delim string) string {
|
||||||
@@ -36,19 +39,19 @@ func splitOff(input string, delim string) string {
|
|||||||
|
|
||||||
// DefaultTags returns a set of default suggested tags based on
|
// DefaultTags returns a set of default suggested tags based on
|
||||||
// the commit ref.
|
// the commit ref.
|
||||||
func DefaultTags(ref string) []string {
|
func DefaultTags(ref string) ([]string, error) {
|
||||||
if !strings.HasPrefix(ref, "refs/tags/") {
|
if !strings.HasPrefix(ref, "refs/tags/") {
|
||||||
return []string{"latest"}
|
return []string{"latest"}, nil
|
||||||
}
|
}
|
||||||
v := stripTagPrefix(ref)
|
v := stripTagPrefix(ref)
|
||||||
version, err := semver.NewVersion(v)
|
version, err := semver.NewVersion(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []string{"latest"}
|
return []string{"latest"}, err
|
||||||
}
|
}
|
||||||
if version.PreRelease != "" || version.Metadata != "" {
|
if version.PreRelease != "" || version.Metadata != "" {
|
||||||
return []string{
|
return []string{
|
||||||
version.String(),
|
version.String(),
|
||||||
}
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
v = stripTagPrefix(ref)
|
v = stripTagPrefix(ref)
|
||||||
@@ -59,13 +62,13 @@ func DefaultTags(ref string) []string {
|
|||||||
return []string{
|
return []string{
|
||||||
fmt.Sprintf("%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor),
|
fmt.Sprintf("%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor),
|
||||||
fmt.Sprintf("%0*d.%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor, len(dotParts[2]), version.Patch),
|
fmt.Sprintf("%0*d.%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor, len(dotParts[2]), version.Patch),
|
||||||
}
|
}, nil
|
||||||
}
|
}
|
||||||
return []string{
|
return []string{
|
||||||
fmt.Sprintf("%0*d", len(dotParts[0]), version.Major),
|
fmt.Sprintf("%0*d", len(dotParts[0]), version.Major),
|
||||||
fmt.Sprintf("%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor),
|
fmt.Sprintf("%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor),
|
||||||
fmt.Sprintf("%0*d.%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor, len(dotParts[2]), version.Patch),
|
fmt.Sprintf("%0*d.%0*d.%0*d", len(dotParts[0]), version.Major, len(dotParts[1]), version.Minor, len(dotParts[2]), version.Patch),
|
||||||
}
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UseDefaultTag for keep only default branch for latest tag
|
// UseDefaultTag for keep only default branch for latest tag
|
||||||
|
|||||||
32
tags_test.go
32
tags_test.go
@@ -34,20 +34,35 @@ func TestDefaultTags(t *testing.T) {
|
|||||||
{"refs/tags/1.0.0", []string{"1", "1.0", "1.0.0"}},
|
{"refs/tags/1.0.0", []string{"1", "1.0", "1.0.0"}},
|
||||||
{"refs/tags/v1.0.0", []string{"1", "1.0", "1.0.0"}},
|
{"refs/tags/v1.0.0", []string{"1", "1.0", "1.0.0"}},
|
||||||
{"refs/tags/v1.0.0-alpha.1", []string{"1.0.0-alpha.1"}},
|
{"refs/tags/v1.0.0-alpha.1", []string{"1.0.0-alpha.1"}},
|
||||||
|
|
||||||
// malformed or errors
|
|
||||||
{"refs/tags/x1.0.0", []string{"latest"}},
|
|
||||||
{"v1.0.0", []string{"latest"}},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
got, want := DefaultTags(test.Before), test.After
|
tags, err := DefaultTags(test.Before)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
got, want := tags, test.After
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("Got tag %v, want %v", got, want)
|
t.Errorf("Got tag %v, want %v", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDefaultTagsError(t *testing.T) {
|
||||||
|
var tests = []string{
|
||||||
|
"refs/tags/x1.0.0",
|
||||||
|
"refs/tags/20190203",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
_, err := DefaultTags(test)
|
||||||
|
if err == nil {
|
||||||
|
t.Errorf("Expect tag error for %s", test)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestDefaultTagSuffix(t *testing.T) {
|
func TestDefaultTagSuffix(t *testing.T) {
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
Before string
|
Before string
|
||||||
@@ -105,7 +120,12 @@ func TestDefaultTagSuffix(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
got, want := DefaultTagSuffix(test.Before, test.Suffix), test.After
|
tag, err := DefaultTagSuffix(test.Before, test.Suffix)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
got, want := tag, test.After
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
t.Errorf("Got tag %v, want %v", got, want)
|
t.Errorf("Got tag %v, want %v", got, want)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user