diff --git a/docker/Dockerfile.linux.amd64 b/docker/Dockerfile.linux.amd64 index 1b2ad30..80d849d 100644 --- a/docker/Dockerfile.linux.amd64 +++ b/docker/Dockerfile.linux.amd64 @@ -1,7 +1,9 @@ -FROM alpine:3.6 as base +FROM alpine:3.10 as base + +ENV MANIFEST_TOOL_VERSION 1.0.0 RUN apk add --no-cache curl && \ - curl -sSLo /bin/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64 && \ + curl -sSLo /bin/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/manifest-tool-linux-amd64 && \ chmod +x /bin/manifest-tool FROM plugins/base:multiarch diff --git a/docker/Dockerfile.linux.arm b/docker/Dockerfile.linux.arm index 3afe8db..96e474a 100644 --- a/docker/Dockerfile.linux.arm +++ b/docker/Dockerfile.linux.arm @@ -1,7 +1,9 @@ -FROM alpine:3.6 as base +FROM alpine:3.10 as base + +ENV MANIFEST_TOOL_VERSION 1.0.0 RUN apk add --no-cache curl && \ - curl -sSLo /bin/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-armv7 && \ + curl -sSLo /bin/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/manifest-tool-linux-armv7 && \ chmod +x /bin/manifest-tool FROM plugins/base:multiarch diff --git a/docker/Dockerfile.linux.arm64 b/docker/Dockerfile.linux.arm64 index a664d1a..5d23a92 100644 --- a/docker/Dockerfile.linux.arm64 +++ b/docker/Dockerfile.linux.arm64 @@ -1,7 +1,9 @@ -FROM alpine:3.6 as base +FROM alpine:3.10 as base + +ENV MANIFEST_TOOL_VERSION 1.0.0 RUN apk add --no-cache curl && \ - curl -sSLo /bin/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-arm64 && \ + curl -sSLo /bin/manifest-tool https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/manifest-tool-linux-arm64 && \ chmod +x /bin/manifest-tool FROM plugins/base:multiarch diff --git a/docker/Dockerfile.windows.1803 b/docker/Dockerfile.windows.1803 index 740245d..d1575a7 100644 --- a/docker/Dockerfile.windows.1803 +++ b/docker/Dockerfile.windows.1803 @@ -8,7 +8,7 @@ LABEL maintainer="Drone.IO Community " ` org.label-schema.vendor="Drone.IO Community" ` org.label-schema.schema-version="1.0" -ENV MANIFEST_TOOL_VERSION 0.9.0 +ENV MANIFEST_TOOL_VERSION 1.0.0 RUN New-Item -ItemType directory -Path 'C:/bin'; ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` diff --git a/docker/Dockerfile.windows.1809 b/docker/Dockerfile.windows.1809 index 8fda16e..376dfc4 100644 --- a/docker/Dockerfile.windows.1809 +++ b/docker/Dockerfile.windows.1809 @@ -8,7 +8,7 @@ LABEL maintainer="Drone.IO Community " ` org.label-schema.vendor="Drone.IO Community" ` org.label-schema.schema-version="1.0" -ENV MANIFEST_TOOL_VERSION 0.9.0 +ENV MANIFEST_TOOL_VERSION 1.0.0 RUN New-Item -ItemType directory -Path 'C:/bin'; ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` diff --git a/main.go b/main.go index 3fc275c..5265cf1 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,11 @@ func main() { Usage: "password for registry", EnvVar: "PLUGIN_PASSWORD,MANIFEST_PASSWORD,DOCKER_PASSWORD", }, + cli.BoolFlag{ + Name: "insecure", + Usage: "enable allow insecure registry", + EnvVar: "PLUGIN_INSECURE", + }, cli.StringSliceFlag{ Name: "platforms", Usage: "platforms for manifests", @@ -189,6 +194,7 @@ func run(c *cli.Context) error { Config: Config{ Username: c.String("username"), Password: c.String("password"), + Insecure: c.Bool("insecure"), Platforms: c.StringSlice("platforms"), Target: c.String("target"), Template: c.String("template"), diff --git a/plugin.go b/plugin.go index 7c3e12a..edd055d 100644 --- a/plugin.go +++ b/plugin.go @@ -46,6 +46,7 @@ type ( Config struct { Username string Password string + Insecure bool Platforms []string Target string Template string @@ -73,18 +74,22 @@ func mainfestToolPath() string { func (p *Plugin) Exec() error { args := []string{} - if p.Config.Username == "" { + if p.Config.Username == "" && p.Config.Password != "" { return errors.New("you must provide a username") } else { args = append(args, fmt.Sprintf("--username=%s", p.Config.Username)) } - if p.Config.Password == "" { + if p.Config.Password == "" && p.Config.Username != "" { return errors.New("you must provide a password") } else { args = append(args, fmt.Sprintf("--password=%s", p.Config.Password)) } + if p.Config.Insecure { + args = append(args, "--insecure") + } + args = append(args, "push") if p.Config.Spec != "" {