Add snapshot mode support (#13)
This commit is contained in:
parent
9cca954ec6
commit
658478d5ae
15
.drone.yml
15
.drone.yml
@ -15,6 +15,7 @@ steps:
|
|||||||
repo: plugins/kaniko
|
repo: plugins/kaniko
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64
|
auto_tag_suffix: linux-amd64
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/docker/Dockerfile.linux.amd64
|
dockerfile: docker/docker/Dockerfile.linux.amd64
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
@ -22,8 +23,8 @@ steps:
|
|||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
- name: gcr
|
- name: gcr
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
@ -31,6 +32,7 @@ steps:
|
|||||||
repo: plugins/kaniko-gcr
|
repo: plugins/kaniko-gcr
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64
|
auto_tag_suffix: linux-amd64
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/gcr/Dockerfile.linux.amd64
|
dockerfile: docker/gcr/Dockerfile.linux.amd64
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
@ -38,8 +40,8 @@ steps:
|
|||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
||||||
|
|
||||||
- name: ecr
|
- name: ecr
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
@ -47,6 +49,7 @@ steps:
|
|||||||
repo: plugins/kaniko-ecr
|
repo: plugins/kaniko-ecr
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64
|
auto_tag_suffix: linux-amd64
|
||||||
|
daemon_off: false
|
||||||
dockerfile: docker/ecr/Dockerfile.linux.amd64
|
dockerfile: docker/ecr/Dockerfile.linux.amd64
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
@ -54,5 +57,5 @@ steps:
|
|||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
exclude:
|
||||||
- tag
|
- pull_request
|
@ -49,5 +49,5 @@ docker run --rm \
|
|||||||
-e PLUGIN_PASSWORD=bar \
|
-e PLUGIN_PASSWORD=bar \
|
||||||
-v $(pwd):/drone \
|
-v $(pwd):/drone \
|
||||||
-w /drone \
|
-w /drone \
|
||||||
plugins/kaniko-docker
|
plugins/kaniko:linux-amd64
|
||||||
```
|
```
|
||||||
|
@ -99,6 +99,11 @@ func main() {
|
|||||||
Usage: "Skip registry tls verify",
|
Usage: "Skip registry tls verify",
|
||||||
EnvVar: "PLUGIN_SKIP_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 {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -122,6 +127,7 @@ func run(c *cli.Context) error {
|
|||||||
Repo: c.String("repo"),
|
Repo: c.String("repo"),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
SkipTlsVerify: c.Bool("skip-tls-verify"),
|
SkipTlsVerify: c.Bool("skip-tls-verify"),
|
||||||
|
SnapshotMode: c.String("snapshot-mode"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return plugin.Exec()
|
return plugin.Exec()
|
||||||
|
@ -89,6 +89,11 @@ func main() {
|
|||||||
Usage: "ECR secret key",
|
Usage: "ECR secret key",
|
||||||
EnvVar: "PLUGIN_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 {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -111,6 +116,7 @@ func run(c *cli.Context) error {
|
|||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
|
SnapshotMode: c.String("snapshot-mode"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return plugin.Exec()
|
return plugin.Exec()
|
||||||
|
@ -85,6 +85,11 @@ func main() {
|
|||||||
Usage: "docker username",
|
Usage: "docker username",
|
||||||
EnvVar: "PLUGIN_JSON_KEY",
|
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 {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@ -111,6 +116,7 @@ func run(c *cli.Context) error {
|
|||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
|
SnapshotMode: c.String("snapshot-mode"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return plugin.Exec()
|
return plugin.Exec()
|
||||||
|
@ -18,6 +18,7 @@ type (
|
|||||||
Repo string // Docker build repository
|
Repo string // Docker build repository
|
||||||
Labels []string // Label map
|
Labels []string // Label map
|
||||||
SkipTlsVerify bool // Docker skip tls certificate verify for registry
|
SkipTlsVerify bool // Docker skip tls certificate verify for registry
|
||||||
|
SnapshotMode string // Kaniko snapshot mode
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin defines the Docker plugin parameters.
|
// Plugin defines the Docker plugin parameters.
|
||||||
@ -62,6 +63,10 @@ func (p Plugin) Exec() error {
|
|||||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--skip-tls-verify=true"))
|
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 := exec.Command("/kaniko/executor", cmdArgs...)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
Loading…
Reference in New Issue
Block a user