mirror of
https://github.com/drone-plugins/drone-manifest.git
synced 2026-06-04 18:24:08 +08:00
Merge pull request #29 from c0va23/feature/insecure-registry
Allow insecure and/or anonymous registry
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,7 +8,7 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
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; `
|
||||
|
||||
@@ -8,7 +8,7 @@ LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||
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; `
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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 != "" {
|
||||
|
||||
Reference in New Issue
Block a user