Compare commits

..

1 Commits

Author SHA1 Message Date
Shubham Agrawal 55bcc90781 [Don't merge]: Test error in drone 2021-02-18 13:40:16 +05:30
6 changed files with 36 additions and 73 deletions
+6 -9
View File
@@ -15,7 +15,6 @@ steps:
repo: plugins/kaniko
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.amd64
username:
from_secret: docker_username
@@ -23,8 +22,8 @@ steps:
from_secret: docker_password
when:
event:
exclude:
- pull_request
- push
- tag
- name: gcr
image: plugins/docker
@@ -32,7 +31,6 @@ steps:
repo: plugins/kaniko-gcr
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.amd64
username:
from_secret: docker_username
@@ -40,8 +38,8 @@ steps:
from_secret: docker_password
when:
event:
exclude:
- pull_request
- push
- tag
- name: ecr
image: plugins/docker
@@ -49,7 +47,6 @@ steps:
repo: plugins/kaniko-ecr
auto_tag: true
auto_tag_suffix: linux-amd64
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.amd64
username:
from_secret: docker_username
@@ -57,5 +54,5 @@ steps:
from_secret: docker_password
when:
event:
exclude:
- pull_request
- push
- tag
+1 -1
View File
@@ -49,5 +49,5 @@ docker run --rm \
-e PLUGIN_PASSWORD=bar \
-v $(pwd):/drone \
-w /drone \
plugins/kaniko:linux-amd64
plugins/kaniko-docker
```
+7 -19
View File
@@ -94,16 +94,6 @@ func main() {
Usage: "docker password",
EnvVar: "PLUGIN_PASSWORD",
},
cli.BoolFlag{
Name: "skip-tls-verify",
Usage: "Skip registry tls verify",
EnvVar: "PLUGIN_SKIP_TLS_VERIFY",
},
cli.StringFlag{
Name: "snapshot-mode",
Usage: "Specify one of full, redo or time as snapshot mode",
EnvVar: "PLUGIN_SNAPSHOT_MODE",
},
}
if err := app.Run(os.Args); err != nil {
@@ -119,15 +109,13 @@ func run(c *cli.Context) error {
plugin := kaniko.Plugin{
Build: kaniko.Build{
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
Target: c.String("target"),
Repo: c.String("repo"),
Labels: c.StringSlice("custom-labels"),
SkipTlsVerify: c.Bool("skip-tls-verify"),
SnapshotMode: c.String("snapshot-mode"),
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
Target: c.String("target"),
Repo: c.String("repo"),
Labels: c.StringSlice("custom-labels"),
},
}
return plugin.Exec()
+7 -13
View File
@@ -89,11 +89,6 @@ func main() {
Usage: "ECR secret key",
EnvVar: "PLUGIN_SECRET_KEY",
},
cli.StringFlag{
Name: "snapshot-mode",
Usage: "Specify one of full, redo or time as snapshot mode",
EnvVar: "PLUGIN_SNAPSHOT_MODE",
},
}
if err := app.Run(os.Args); err != nil {
@@ -109,14 +104,13 @@ func run(c *cli.Context) error {
plugin := kaniko.Plugin{
Build: kaniko.Build{
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
Target: c.String("target"),
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
Labels: c.StringSlice("custom-labels"),
SnapshotMode: c.String("snapshot-mode"),
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
Target: c.String("target"),
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
Labels: c.StringSlice("custom-labels"),
},
}
return plugin.Exec()
+7 -13
View File
@@ -85,11 +85,6 @@ func main() {
Usage: "docker username",
EnvVar: "PLUGIN_JSON_KEY",
},
cli.StringFlag{
Name: "snapshot-mode",
Usage: "Specify one of full, redo or time as snapshot mode",
EnvVar: "PLUGIN_SNAPSHOT_MODE",
},
}
if err := app.Run(os.Args); err != nil {
@@ -109,14 +104,13 @@ func run(c *cli.Context) error {
plugin := kaniko.Plugin{
Build: kaniko.Build{
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
Target: c.String("target"),
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
Labels: c.StringSlice("custom-labels"),
SnapshotMode: c.String("snapshot-mode"),
Dockerfile: c.String("dockerfile"),
Context: c.String("context"),
Tags: c.StringSlice("tags"),
Args: c.StringSlice("args"),
Target: c.String("target"),
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
Labels: c.StringSlice("custom-labels"),
},
}
return plugin.Exec()
+8 -18
View File
@@ -10,15 +10,13 @@ import (
type (
// Build defines Docker build parameters.
Build struct {
Dockerfile string // Docker build Dockerfile
Context string // Docker build context
Tags []string // Docker build tags
Args []string // Docker build args
Target string // Docker build target
Repo string // Docker build repository
Labels []string // Label map
SkipTlsVerify bool // Docker skip tls certificate verify for registry
SnapshotMode string // Kaniko snapshot mode
Dockerfile string // Docker build Dockerfile
Context string // Docker build context
Tags []string // Docker build tags
Args []string // Docker build args
Target string // Docker build target
Repo string // Docker build repository
Labels []string // Label map
}
// Plugin defines the Docker plugin parameters.
@@ -29,7 +27,7 @@ type (
// Exec executes the plugin step
func (p Plugin) Exec() error {
if p.Build.Repo == "" {
if p.Build.Repo == ""
return fmt.Errorf("repository name to publish image must be specified")
}
@@ -59,14 +57,6 @@ func (p Plugin) Exec() error {
cmdArgs = append(cmdArgs, fmt.Sprintf("--target=%s", p.Build.Target))
}
if p.Build.SkipTlsVerify {
cmdArgs = append(cmdArgs, fmt.Sprintf("--skip-tls-verify=true"))
}
if p.Build.SnapshotMode != "" {
cmdArgs = append(cmdArgs, fmt.Sprintf("--snapshotMode=%s", p.Build.SnapshotMode))
}
cmd := exec.Command("/kaniko/executor", cmdArgs...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr