mirror of
https://github.com/drone/drone-kaniko.git
synced 2026-06-14 14:02:35 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| adee644baf | |||
| f5669f55eb | |||
| 984d34fe9f | |||
| 89b4f6b0c9 | |||
| c39a1155b5 | |||
| ea64d40995 | |||
| 0cd3e162fa | |||
| f492271f45 | |||
| 7c6c33d174 |
+13
-13
@@ -4,7 +4,7 @@ name: default
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang:1.17.7
|
image: golang:1.17.8
|
||||||
commands:
|
commands:
|
||||||
- go test ./...
|
- go test ./...
|
||||||
- sh scripts/build.sh
|
- sh scripts/build.sh
|
||||||
@@ -65,9 +65,9 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
repo: plugins/kaniko
|
repo: plugins/kaniko
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64-kaniko1.8.0
|
auto_tag_suffix: linux-amd64-kaniko1.8.1
|
||||||
daemon_off: false
|
daemon_off: false
|
||||||
dockerfile: docker/docker/Dockerfile.linux.amd64.kaniko1.8.0
|
dockerfile: docker/docker/Dockerfile.linux.amd64.kaniko1.8.1
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
@@ -82,9 +82,9 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
repo: plugins/kaniko-gcr
|
repo: plugins/kaniko-gcr
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64-kaniko1.8.0
|
auto_tag_suffix: linux-amd64-kaniko1.8.1
|
||||||
daemon_off: false
|
daemon_off: false
|
||||||
dockerfile: docker/gcr/Dockerfile.linux.amd64.kaniko1.8.0
|
dockerfile: docker/gcr/Dockerfile.linux.amd64.kaniko1.8.1
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
@@ -99,9 +99,9 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
repo: plugins/kaniko-ecr
|
repo: plugins/kaniko-ecr
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: linux-amd64-kaniko1.8.0
|
auto_tag_suffix: linux-amd64-kaniko1.8.1
|
||||||
daemon_off: false
|
daemon_off: false
|
||||||
dockerfile: docker/ecr/Dockerfile.linux.amd64.kaniko1.8.0
|
dockerfile: docker/ecr/Dockerfile.linux.amd64.kaniko1.8.1
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
@@ -178,11 +178,11 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/manifest
|
image: plugins/manifest
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: false
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
spec: docker/docker/manifest-kaniko1.8.0.tmpl
|
spec: docker/docker/manifest-kaniko1.8.1.tmpl
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
|
||||||
@@ -190,11 +190,11 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/manifest
|
image: plugins/manifest
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: false
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
spec: docker/gcr/manifest-kaniko1.8.0.tmpl
|
spec: docker/gcr/manifest-kaniko1.8.1.tmpl
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
|
||||||
@@ -202,11 +202,11 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: plugins/manifest
|
image: plugins/manifest
|
||||||
settings:
|
settings:
|
||||||
auto_tag: true
|
auto_tag: false
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
spec: docker/ecr/manifest-kaniko1.8.0.tmpl
|
spec: docker/ecr/manifest-kaniko1.8.1.tmpl
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
|
|
||||||
|
|||||||
+36
-25
@@ -75,6 +75,11 @@ func main() {
|
|||||||
EnvVar: "PLUGIN_TAGS",
|
EnvVar: "PLUGIN_TAGS",
|
||||||
FilePath: ".tags",
|
FilePath: ".tags",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "expand-repo",
|
||||||
|
Usage: "Prepends the registry url to the repo if registry url is not specified in repo name",
|
||||||
|
EnvVar: "PLUGIN_EXPAND_REPO",
|
||||||
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "expand-tag",
|
Name: "expand-tag",
|
||||||
Usage: "enable for semver tagging",
|
Usage: "enable for semver tagging",
|
||||||
@@ -176,6 +181,11 @@ func main() {
|
|||||||
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
|
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
|
||||||
EnvVar: "PLUGIN_PLATFORM",
|
EnvVar: "PLUGIN_PLATFORM",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "skip-unused-stages",
|
||||||
|
Usage: "build only used stages",
|
||||||
|
EnvVar: "PLUGIN_SKIP_UNUSED_STAGES",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@@ -196,32 +206,33 @@ func run(c *cli.Context) error {
|
|||||||
|
|
||||||
plugin := kaniko.Plugin{
|
plugin := kaniko.Plugin{
|
||||||
Build: kaniko.Build{
|
Build: kaniko.Build{
|
||||||
DroneCommitRef: c.String("drone-commit-ref"),
|
DroneCommitRef: c.String("drone-commit-ref"),
|
||||||
DroneRepoBranch: c.String("drone-repo-branch"),
|
DroneRepoBranch: c.String("drone-repo-branch"),
|
||||||
Dockerfile: c.String("dockerfile"),
|
Dockerfile: c.String("dockerfile"),
|
||||||
Context: c.String("context"),
|
Context: c.String("context"),
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
AutoTag: c.Bool("auto-tag"),
|
AutoTag: c.Bool("auto-tag"),
|
||||||
AutoTagSuffix: c.String("auto-tag-suffix"),
|
AutoTagSuffix: c.String("auto-tag-suffix"),
|
||||||
ExpandTag: c.Bool("expand-tag"),
|
ExpandTag: c.Bool("expand-tag"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
Target: c.String("target"),
|
Target: c.String("target"),
|
||||||
Repo: buildRepo(c.String("registry"), c.String("repo")),
|
Repo: buildRepo(c.String("registry"), c.String("repo"), c.Bool("expand-repo")),
|
||||||
Mirrors: c.StringSlice("registry-mirrors"),
|
Mirrors: c.StringSlice("registry-mirrors"),
|
||||||
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"),
|
SnapshotMode: c.String("snapshot-mode"),
|
||||||
EnableCache: c.Bool("enable-cache"),
|
EnableCache: c.Bool("enable-cache"),
|
||||||
CacheRepo: buildRepo(c.String("registry"), c.String("cache-repo")),
|
CacheRepo: buildRepo(c.String("registry"), c.String("cache-repo"), c.Bool("expand-repo")),
|
||||||
CacheTTL: c.Int("cache-ttl"),
|
CacheTTL: c.Int("cache-ttl"),
|
||||||
DigestFile: defaultDigestFile,
|
DigestFile: defaultDigestFile,
|
||||||
NoPush: noPush,
|
NoPush: noPush,
|
||||||
Verbosity: c.String("verbosity"),
|
Verbosity: c.String("verbosity"),
|
||||||
Platform: c.String("platform"),
|
Platform: c.String("platform"),
|
||||||
|
SkipUnusedStages: c.Bool("skip-unused-stages"),
|
||||||
},
|
},
|
||||||
Artifact: kaniko.Artifact{
|
Artifact: kaniko.Artifact{
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
Repo: buildRepo(c.String("registry"), c.String("repo")),
|
Repo: buildRepo(c.String("registry"), c.String("repo"), c.Bool("expand-repo")),
|
||||||
Registry: c.String("registry"),
|
Registry: c.String("registry"),
|
||||||
ArtifactFile: c.String("artifact-file"),
|
ArtifactFile: c.String("artifact-file"),
|
||||||
RegistryType: artifact.Docker,
|
RegistryType: artifact.Docker,
|
||||||
@@ -263,8 +274,8 @@ func createDockerCfgFile(username, password, registry string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildRepo(registry, repo string) string {
|
func buildRepo(registry, repo string, expandRepo bool) string {
|
||||||
if registry == "" {
|
if !expandRepo || registry == "" || registry == v1RegistryURL {
|
||||||
// No custom registry, just return the repo name
|
// No custom registry, just return the repo name
|
||||||
return repo
|
return repo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func Test_buildRepo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if got := buildRepo(tt.registry, tt.repo); got != tt.want {
|
if got := buildRepo(tt.registry, tt.repo, true); got != tt.want {
|
||||||
t.Errorf("buildRepo(%q, %q) = %v, want %v", tt.registry, tt.repo, got, tt.want)
|
t.Errorf("buildRepo(%q, %q) = %v, want %v", tt.registry, tt.repo, got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+28
-22
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go-v2/config"
|
"github.com/aws/aws-sdk-go-v2/config"
|
||||||
"github.com/aws/aws-sdk-go-v2/service/ecr"
|
"github.com/aws/aws-sdk-go-v2/service/ecr"
|
||||||
"github.com/aws/aws-sdk-go-v2/service/ecrpublic"
|
"github.com/aws/aws-sdk-go-v2/service/ecrpublic"
|
||||||
"github.com/aws/smithy-go"
|
"github.com/aws/smithy-go"
|
||||||
kaniko "github.com/drone/drone-kaniko"
|
kaniko "github.com/drone/drone-kaniko"
|
||||||
"github.com/drone/drone-kaniko/pkg/artifact"
|
"github.com/drone/drone-kaniko/pkg/artifact"
|
||||||
"github.com/drone/drone-kaniko/pkg/docker"
|
"github.com/drone/drone-kaniko/pkg/docker"
|
||||||
@@ -204,6 +204,11 @@ func main() {
|
|||||||
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
|
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
|
||||||
EnvVar: "PLUGIN_PLATFORM",
|
EnvVar: "PLUGIN_PLATFORM",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "skip-unused-stages",
|
||||||
|
Usage: "build only used stages",
|
||||||
|
EnvVar: "PLUGIN_SKIP_UNUSED_STAGES",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@@ -267,27 +272,28 @@ func run(c *cli.Context) error {
|
|||||||
|
|
||||||
plugin := kaniko.Plugin{
|
plugin := kaniko.Plugin{
|
||||||
Build: kaniko.Build{
|
Build: kaniko.Build{
|
||||||
DroneCommitRef: c.String("drone-commit-ref"),
|
DroneCommitRef: c.String("drone-commit-ref"),
|
||||||
DroneRepoBranch: c.String("drone-repo-branch"),
|
DroneRepoBranch: c.String("drone-repo-branch"),
|
||||||
Dockerfile: c.String("dockerfile"),
|
Dockerfile: c.String("dockerfile"),
|
||||||
Context: c.String("context"),
|
Context: c.String("context"),
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
AutoTag: c.Bool("auto-tag"),
|
AutoTag: c.Bool("auto-tag"),
|
||||||
AutoTagSuffix: c.String("auto-tag-suffix"),
|
AutoTagSuffix: c.String("auto-tag-suffix"),
|
||||||
ExpandTag: c.Bool("expand-tag"),
|
ExpandTag: c.Bool("expand-tag"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
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")),
|
||||||
Mirrors: c.StringSlice("registry-mirrors"),
|
Mirrors: c.StringSlice("registry-mirrors"),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
SnapshotMode: c.String("snapshot-mode"),
|
SnapshotMode: c.String("snapshot-mode"),
|
||||||
EnableCache: c.Bool("enable-cache"),
|
EnableCache: c.Bool("enable-cache"),
|
||||||
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
||||||
CacheTTL: c.Int("cache-ttl"),
|
CacheTTL: c.Int("cache-ttl"),
|
||||||
DigestFile: defaultDigestFile,
|
DigestFile: defaultDigestFile,
|
||||||
NoPush: noPush,
|
NoPush: noPush,
|
||||||
Verbosity: c.String("verbosity"),
|
Verbosity: c.String("verbosity"),
|
||||||
Platform: c.String("platform"),
|
Platform: c.String("platform"),
|
||||||
|
SkipUnusedStages: c.Bool("skip-unused-stages"),
|
||||||
},
|
},
|
||||||
Artifact: kaniko.Artifact{
|
Artifact: kaniko.Artifact{
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
|
|||||||
+27
-21
@@ -160,6 +160,11 @@ func main() {
|
|||||||
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
|
Usage: "Allows to build with another default platform than the host, similarly to docker build --platform",
|
||||||
EnvVar: "PLUGIN_PLATFORM",
|
EnvVar: "PLUGIN_PLATFORM",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "skip-unused-stages",
|
||||||
|
Usage: "build only used stages",
|
||||||
|
EnvVar: "PLUGIN_SKIP_UNUSED_STAGES",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
@@ -182,27 +187,28 @@ func run(c *cli.Context) error {
|
|||||||
|
|
||||||
plugin := kaniko.Plugin{
|
plugin := kaniko.Plugin{
|
||||||
Build: kaniko.Build{
|
Build: kaniko.Build{
|
||||||
DroneCommitRef: c.String("drone-commit-ref"),
|
DroneCommitRef: c.String("drone-commit-ref"),
|
||||||
DroneRepoBranch: c.String("drone-repo-branch"),
|
DroneRepoBranch: c.String("drone-repo-branch"),
|
||||||
Dockerfile: c.String("dockerfile"),
|
Dockerfile: c.String("dockerfile"),
|
||||||
Context: c.String("context"),
|
Context: c.String("context"),
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
AutoTag: c.Bool("auto-tag"),
|
AutoTag: c.Bool("auto-tag"),
|
||||||
AutoTagSuffix: c.String("auto-tag-suffix"),
|
AutoTagSuffix: c.String("auto-tag-suffix"),
|
||||||
ExpandTag: c.Bool("expand-tag"),
|
ExpandTag: c.Bool("expand-tag"),
|
||||||
Args: c.StringSlice("args"),
|
Args: c.StringSlice("args"),
|
||||||
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")),
|
||||||
Mirrors: c.StringSlice("registry-mirrors"),
|
Mirrors: c.StringSlice("registry-mirrors"),
|
||||||
Labels: c.StringSlice("custom-labels"),
|
Labels: c.StringSlice("custom-labels"),
|
||||||
SnapshotMode: c.String("snapshot-mode"),
|
SnapshotMode: c.String("snapshot-mode"),
|
||||||
EnableCache: c.Bool("enable-cache"),
|
EnableCache: c.Bool("enable-cache"),
|
||||||
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
CacheRepo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("cache-repo")),
|
||||||
CacheTTL: c.Int("cache-ttl"),
|
CacheTTL: c.Int("cache-ttl"),
|
||||||
DigestFile: defaultDigestFile,
|
DigestFile: defaultDigestFile,
|
||||||
NoPush: noPush,
|
NoPush: noPush,
|
||||||
Verbosity: c.String("verbosity"),
|
Verbosity: c.String("verbosity"),
|
||||||
Platform: c.String("platform"),
|
Platform: c.String("platform"),
|
||||||
|
SkipUnusedStages: c.Bool("skip-unused-stages"),
|
||||||
},
|
},
|
||||||
Artifact: kaniko.Artifact{
|
Artifact: kaniko.Artifact{
|
||||||
Tags: c.StringSlice("tags"),
|
Tags: c.StringSlice("tags"),
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.8.0
|
FROM gcr.io/kaniko-project/executor:v1.8.1
|
||||||
|
|
||||||
ADD release/linux/amd64/kaniko-docker /kaniko/
|
ADD release/linux/amd64/kaniko-docker /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-docker"]
|
ENTRYPOINT ["/kaniko/kaniko-docker"]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.0{{else}}latest-kaniko1.8.0{{/if}}
|
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.1{{else}}latest-kaniko1.8.1{{/if}}
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
@@ -7,7 +7,7 @@ tags:
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
manifests:
|
manifests:
|
||||||
-
|
-
|
||||||
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.0
|
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.1
|
||||||
platform:
|
platform:
|
||||||
architecture: amd64
|
architecture: amd64
|
||||||
os: linux
|
os: linux
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.8.0
|
FROM gcr.io/kaniko-project/executor:v1.8.1
|
||||||
|
|
||||||
ADD release/linux/amd64/kaniko-ecr /kaniko/
|
ADD release/linux/amd64/kaniko-ecr /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-ecr"]
|
ENTRYPOINT ["/kaniko/kaniko-ecr"]
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.0{{else}}latest-kaniko1.8.0{{/if}}
|
|
||||||
{{#if build.tags}}
|
|
||||||
tags:
|
|
||||||
{{#each build.tags}}
|
|
||||||
- {{this}}
|
|
||||||
{{/each}}
|
|
||||||
{{/if}}
|
|
||||||
manifests:
|
|
||||||
-
|
|
||||||
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.0
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: linux
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.1{{else}}latest-kaniko1.8.1{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.1
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.8.0
|
FROM gcr.io/kaniko-project/executor:v1.8.1
|
||||||
|
|
||||||
ADD release/linux/amd64/kaniko-gcr /kaniko/
|
ADD release/linux/amd64/kaniko-gcr /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-gcr"]
|
ENTRYPOINT ["/kaniko/kaniko-gcr"]
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.0{{else}}latest-kaniko1.8.0{{/if}}
|
|
||||||
{{#if build.tags}}
|
|
||||||
tags:
|
|
||||||
{{#each build.tags}}
|
|
||||||
- {{this}}
|
|
||||||
{{/each}}
|
|
||||||
{{/if}}
|
|
||||||
manifests:
|
|
||||||
-
|
|
||||||
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.0
|
|
||||||
platform:
|
|
||||||
architecture: amd64
|
|
||||||
os: linux
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.1{{else}}latest-kaniko1.8.1{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.1
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
@@ -15,28 +15,29 @@ import (
|
|||||||
type (
|
type (
|
||||||
// Build defines Docker build parameters.
|
// Build defines Docker build parameters.
|
||||||
Build struct {
|
Build struct {
|
||||||
DroneCommitRef string // Drone git commit reference
|
DroneCommitRef string // Drone git commit reference
|
||||||
DroneRepoBranch string // Drone repo branch
|
DroneRepoBranch string // Drone repo branch
|
||||||
Dockerfile string // Docker build Dockerfile
|
Dockerfile string // Docker build Dockerfile
|
||||||
Context string // Docker build context
|
Context string // Docker build context
|
||||||
Tags []string // Docker build tags
|
Tags []string // Docker build tags
|
||||||
AutoTag bool // Set this to auto detect tags from git commits and semver-tagged labels
|
AutoTag bool // Set this to auto detect tags from git commits and semver-tagged labels
|
||||||
AutoTagSuffix string // Suffix to append to the auto detect tags
|
AutoTagSuffix string // Suffix to append to the auto detect tags
|
||||||
ExpandTag bool // Set this to expand the `Tags` into semver-tagged labels
|
ExpandTag bool // Set this to expand the `Tags` into semver-tagged labels
|
||||||
Args []string // Docker build args
|
Args []string // Docker build args
|
||||||
Target string // Docker build target
|
Target string // Docker build target
|
||||||
Repo string // Docker build repository
|
Repo string // Docker build repository
|
||||||
Mirrors []string // Docker repository mirrors
|
Mirrors []string // Docker repository mirrors
|
||||||
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
|
SnapshotMode string // Kaniko snapshot mode
|
||||||
EnableCache bool // Whether to enable kaniko cache
|
EnableCache bool // Whether to enable kaniko cache
|
||||||
CacheRepo string // Remote repository that will be used to store cached layers
|
CacheRepo string // Remote repository that will be used to store cached layers
|
||||||
CacheTTL int // Cache timeout in hours
|
CacheTTL int // Cache timeout in hours
|
||||||
DigestFile string // Digest file location
|
DigestFile string // Digest file location
|
||||||
NoPush bool // Set this flag if you only want to build the image, without pushing to a registry
|
NoPush bool // Set this flag if you only want to build the image, without pushing to a registry
|
||||||
Verbosity string // Log level
|
Verbosity string // Log level
|
||||||
Platform string // Allows to build with another default platform than the host, similarly to docker build --platform
|
Platform string // Allows to build with another default platform than the host, similarly to docker build --platform
|
||||||
|
SkipUnusedStages bool // Build only used stages
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artifact defines content of artifact file
|
// Artifact defines content of artifact file
|
||||||
@@ -207,6 +208,10 @@ func (p Plugin) Exec() error {
|
|||||||
cmdArgs = append(cmdArgs, fmt.Sprintf("--customPlatform=%s", p.Build.Platform))
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--customPlatform=%s", p.Build.Platform))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Build.SkipUnusedStages {
|
||||||
|
cmdArgs = append(cmdArgs, "--skip-unused-stages")
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user