Compare commits

...

14 Commits

Author SHA1 Message Date
Soumyajit Das 447ee28867 fix: [CI-6505]: Upgrade kanoko version for all (#71) 2023-01-17 13:00:11 +05:30
Soumyajit Das 9c90e58a2d fix: [CI-6412]: Error message Refinement (#70) 2023-01-04 11:13:01 +05:30
Shubham Agrawal d998c00a4b Add v1.9.1 kaniko image support (#69) 2022-12-02 15:43:35 +05:30
Aman Singh 2f55e25020 Merge pull request #68 from drone/aman/rename-config
fixed config-name for PLUGIN_CONFIG
2022-11-10 12:28:26 +05:30
Aman Singh f3544ce6ee renamed docker config 2022-11-09 18:02:22 +05:30
Aman Singh e4cd992d8d renamed docker config 2022-11-08 16:21:45 +05:30
Aman Singh d457df687d renamed docker config 2022-11-08 15:05:26 +05:30
Aman Singh 4820b6af00 renamed docker config 2022-11-08 15:01:52 +05:30
Aman Singh 3717723366 fixed config-name for PLUGIN_CONFIG 2022-11-08 12:32:12 +05:30
Aman Singh be3bf8ad1e Merge pull request #67 from drone/aman/fix-config
added config for providing docker config
2022-11-07 17:12:56 +05:30
Aman Singh 15255d3520 added comments 2022-11-07 17:07:26 +05:30
Aman Singh 6ba0eb58c3 added config for providing docker config 2022-11-07 14:21:40 +05:30
Aman Singh 17e907c7cf Merge pull request #66 from drone/aman/fix-docker-plugin
Added option to use overriden docker config
2022-11-04 19:57:58 +05:30
Kyle Lemons 2d0315e6bb Add beta testcase for clarity, coverage, and regression prevention (#64) 2022-11-03 19:05:06 +05:30
22 changed files with 94 additions and 73 deletions
+21 -21
View File
@@ -77,14 +77,14 @@ steps:
exclude:
- pull_request
- name: docker-kaniko-v1-8
- name: docker-kaniko-v1-9
image: plugins/docker
settings:
repo: plugins/kaniko
auto_tag: true
auto_tag_suffix: linux-amd64-kaniko1.8.1
auto_tag_suffix: linux-amd64-kaniko1.9.1
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.amd64.kaniko1.8.1
dockerfile: docker/docker/Dockerfile.linux.amd64.kaniko1.9.1
username:
from_secret: docker_username
password:
@@ -94,14 +94,14 @@ steps:
exclude:
- pull_request
- name: gcr-kaniko-v1-8
- name: gcr-kaniko-v1-9
image: plugins/docker
settings:
repo: plugins/kaniko-gcr
auto_tag: true
auto_tag_suffix: linux-amd64-kaniko1.8.1
auto_tag_suffix: linux-amd64-kaniko1.9.1
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.amd64.kaniko1.8.1
dockerfile: docker/gcr/Dockerfile.linux.amd64.kaniko1.9.1
username:
from_secret: docker_username
password:
@@ -112,14 +112,14 @@ steps:
- pull_request
- name: ecr-kaniko-v1-8
- name: ecr-kaniko-v1-9
image: plugins/docker
settings:
repo: plugins/kaniko-ecr
auto_tag: true
auto_tag_suffix: linux-amd64-kaniko1.8.1
auto_tag_suffix: linux-amd64-kaniko1.9.1
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.amd64.kaniko1.8.1
dockerfile: docker/ecr/Dockerfile.linux.amd64.kaniko1.9.1
username:
from_secret: docker_username
password:
@@ -212,14 +212,14 @@ steps:
exclude:
- pull_request
- name: docker-kaniko-v1-8
- name: docker-kaniko-v1-9
image: plugins/docker
settings:
repo: plugins/kaniko
auto_tag: true
auto_tag_suffix: linux-arm64-kaniko1.8.1
auto_tag_suffix: linux-arm64-kaniko1.9.1
daemon_off: false
dockerfile: docker/docker/Dockerfile.linux.arm64.kaniko1.8.1
dockerfile: docker/docker/Dockerfile.linux.arm64.kaniko1.9.1
username:
from_secret: docker_username
password:
@@ -229,14 +229,14 @@ steps:
exclude:
- pull_request
- name: gcr-kaniko-v1-8
- name: gcr-kaniko-v1-9
image: plugins/docker
settings:
repo: plugins/kaniko-gcr
auto_tag: true
auto_tag_suffix: linux-arm64-kaniko1.8.1
auto_tag_suffix: linux-arm64-kaniko1.9.1
daemon_off: false
dockerfile: docker/gcr/Dockerfile.linux.arm64.kaniko1.8.1
dockerfile: docker/gcr/Dockerfile.linux.arm64.kaniko1.9.1
username:
from_secret: docker_username
password:
@@ -247,14 +247,14 @@ steps:
- pull_request
- name: ecr-kaniko-v1-8
- name: ecr-kaniko-v1-9
image: plugins/docker
settings:
repo: plugins/kaniko-ecr
auto_tag: true
auto_tag_suffix: linux-arm64-kaniko1.8.1
auto_tag_suffix: linux-arm64-kaniko1.9.1
daemon_off: false
dockerfile: docker/ecr/Dockerfile.linux.arm64.kaniko1.8.1
dockerfile: docker/ecr/Dockerfile.linux.arm64.kaniko1.9.1
username:
from_secret: docker_username
password:
@@ -348,7 +348,7 @@ steps:
ignore_missing: true
password:
from_secret: docker_password
spec: docker/docker/manifest-kaniko1.8.1.tmpl
spec: docker/docker/manifest-kaniko1.9.1.tmpl
username:
from_secret: docker_username
@@ -360,7 +360,7 @@ steps:
ignore_missing: true
password:
from_secret: docker_password
spec: docker/gcr/manifest-kaniko1.8.1.tmpl
spec: docker/gcr/manifest-kaniko1.9.1.tmpl
username:
from_secret: docker_username
@@ -372,7 +372,7 @@ steps:
ignore_missing: true
password:
from_secret: docker_password
spec: docker/ecr/manifest-kaniko1.8.1.tmpl
spec: docker/ecr/manifest-kaniko1.9.1.tmpl
username:
from_secret: docker_username
+1 -1
View File
@@ -2,7 +2,7 @@
Drone kaniko plugin uses [kaniko](https://github.com/GoogleContainerTools/kaniko) to build and publish Docker images to a container registry.
Plugin images are published with 1.6.0 as well as 1.8.1 kaniko version from 1.5.1 release tag. `plugins/kaniko:<release-tag>` uses 1.6.0 version while `plugins/kaniko:<release-tag>-kaniko1.8.1` uses 1.8.1 version. Similar convention is used for plugins/kaniko-ecr & plugins/kaniko-gcr images as well.
Plugin images are published with 1.6.0 as well as 1.9.1 kaniko version from 1.5.1 release tag. `plugins/kaniko:<release-tag>` uses 1.6.0 version while `plugins/kaniko:<release-tag>-kaniko1.9.1` uses 1.9.1 version. Similar convention is used for plugins/kaniko-ecr & plugins/kaniko-gcr images as well.
## Build
+24 -12
View File
@@ -90,10 +90,10 @@ func main() {
Usage: "enable auto generation of build tags",
EnvVar: "PLUGIN_AUTO_TAG",
},
cli.BoolFlag{
Name: "dockerconfig-override",
Usage: "enable auto generation of build tags",
EnvVar: "PLUGIN_DOCKERCONFIG_OVERRIDE",
cli.StringFlag{
Name: "dockerconfig",
Usage: "docker json dockerconfig",
EnvVar: "PLUGIN_CONFIG",
},
cli.StringFlag{
Name: "auto-tag-suffix",
@@ -201,11 +201,15 @@ func main() {
func run(c *cli.Context) error {
username := c.String("username")
noPush := c.Bool("no-push")
// use the dockerconfig present at the path instead of creating one
configOverride := c.Bool("dockerconfig-override")
configOverride := c.String("dockerconfig")
// only setup auth when pushing or credentials are defined and docker config override is false
if (!noPush || username != "") && !configOverride {
// if configOverride is provided, use this for docker auth
if len(configOverride) > 0 {
if err := writeDockerCfgFile([]byte(configOverride)); err != nil {
return err
}
} else if !noPush || username != "" {
// setup auth when pushing or credentials are defined and docker config override is false
if err := createDockerCfgFile(username, c.String("password"), c.String("registry")); err != nil {
return err
}
@@ -266,14 +270,22 @@ func createDockerCfgFile(username, password, registry string) error {
registry = v1RegistryURL
}
authBytes := []byte(fmt.Sprintf("%s:%s", username, password))
encodedString := base64.StdEncoding.EncodeToString(authBytes)
jsonBytes := []byte(fmt.Sprintf(`{"auths": {"%s": {"auth": "%s"}}}`, registry, encodedString))
if err := writeDockerCfgFile(jsonBytes); err != nil {
return errors.Wrap(err, "failed to write docker config file")
}
return nil
}
// Write json bytes in the docker config file
func writeDockerCfgFile(jsonBytes []byte) error {
err := os.MkdirAll(dockerPath, 0600)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("failed to create %s directory", dockerPath))
}
authBytes := []byte(fmt.Sprintf("%s:%s", username, password))
encodedString := base64.StdEncoding.EncodeToString(authBytes)
jsonBytes := []byte(fmt.Sprintf(`{"auths": {"%s": {"auth": "%s"}}}`, registry, encodedString))
err = ioutil.WriteFile(dockerConfigPath, jsonBytes, 0644)
if err != nil {
return errors.Wrap(err, "failed to create docker config file")
+1 -1
View File
@@ -469,7 +469,7 @@ func getAssumeRoleCreds(region, roleArn, externalId, roleSessionName string) (st
username, password, registry, err := getAuthInfo(svc)
if err != nil {
return "", "", "", errors.Wrap(err, "failed to get ECR auth")
return "", "", "", errors.Wrap(err, "failed to get ECR auth: no basic auth credentials")
}
return username, password, registry, nil
}
+2 -2
View File
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/amd64/kaniko-acr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-acr"]
+2 -2
View File
@@ -1,8 +1,8 @@
FROM gcr.io/kaniko-project/executor:v1.8.1
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/arm64/kaniko-acr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-acr"]
+2 -2
View File
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.6.0
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.6.0
ENV KANIKO_VERSION=1.9.1
ADD release/linux/amd64/kaniko-docker /kaniko/
ENTRYPOINT ["/kaniko/kaniko-docker"]
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.8.1
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/amd64/kaniko-docker /kaniko/
ENTRYPOINT ["/kaniko/kaniko-docker"]
+2 -2
View File
@@ -1,8 +1,8 @@
FROM gcr.io/kaniko-project/executor:v1.6.0
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.6.0
ENV KANIKO_VERSION=1.9.1
ADD release/linux/arm64/kaniko-docker /kaniko/
ENTRYPOINT ["/kaniko/kaniko-docker"]
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.8.1
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/arm64/kaniko-docker /kaniko/
ENTRYPOINT ["/kaniko/kaniko-docker"]
@@ -1,4 +1,4 @@
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.1{{else}}latest-kaniko1.8.1{{/if}}
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.9.1{{else}}latest-kaniko1.9.1{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
@@ -7,12 +7,12 @@ tags:
{{/if}}
manifests:
-
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.1
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.9.1
platform:
architecture: amd64
os: linux
-
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.8.1
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.9.1
platform:
architecture: arm64
os: linux
+2 -2
View File
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.6.0
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.6.0
ENV KANIKO_VERSION=1.9.1
ADD release/linux/amd64/kaniko-ecr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-ecr"]
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.8.1
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/amd64/kaniko-ecr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-ecr"]
+2 -2
View File
@@ -1,8 +1,8 @@
FROM gcr.io/kaniko-project/executor:v1.6.0
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.6.0
ENV KANIKO_VERSION=1.9.1
ADD release/linux/arm64/kaniko-ecr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-ecr"]
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.8.1
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/arm64/kaniko-ecr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-ecr"]
@@ -1,4 +1,4 @@
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.1{{else}}latest-kaniko1.8.1{{/if}}
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.9.1{{else}}latest-kaniko1.9.1{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
@@ -7,12 +7,12 @@ tags:
{{/if}}
manifests:
-
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.1
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.9.1
platform:
architecture: amd64
os: linux
-
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.8.1
image: plugins/kaniko-ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.9.1
platform:
architecture: arm64
os: linux
+2 -2
View File
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.6.0
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.6.0
ENV KANIKO_VERSION=1.9.1
ADD release/linux/amd64/kaniko-gcr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-gcr"]
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.8.1
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/amd64/kaniko-gcr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-gcr"]
+2 -2
View File
@@ -1,8 +1,8 @@
FROM gcr.io/kaniko-project/executor:v1.6.0
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.6.0
ENV KANIKO_VERSION=1.9.1
ADD release/linux/arm64/kaniko-gcr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-gcr"]
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.8.1
FROM gcr.io/kaniko-project/executor:v1.9.1
ENV KANIKO_VERSION=1.8.1
ENV KANIKO_VERSION=1.9.1
ADD release/linux/arm64/kaniko-gcr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-gcr"]
@@ -1,4 +1,4 @@
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.8.1{{else}}latest-kaniko1.8.1{{/if}}
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-kaniko1.9.1{{else}}latest-kaniko1.9.1{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
@@ -7,12 +7,12 @@ tags:
{{/if}}
manifests:
-
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.8.1
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-kaniko1.9.1
platform:
architecture: amd64
os: linux
-
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.8.1
image: plugins/kaniko-gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-kaniko1.9.1
platform:
architecture: arm64
os: linux
+10 -1
View File
@@ -100,7 +100,16 @@ func TestBuild_AutoTags(t *testing.T) {
},
},
{
name: "tag push",
name: "beta tag push",
repoBranch: "master",
commitRef: "refs/tags/v1.0.0-beta.1",
autoTagSuffix: "",
expectedTags: []string{
"1.0.0-beta.1",
},
},
{
name: "tag push with suffix",
repoBranch: "master",
commitRef: "refs/tags/v1.0.0",
autoTagSuffix: "linux-amd64",