Compare commits

..

1 Commits

Author SHA1 Message Date
Shubham Agrawal ed8ef9156e Add v1.9.1 kaniko image support 2022-12-02 15:38:38 +05:30
10 changed files with 19 additions and 57 deletions
+3 -13
View File
@@ -64,11 +64,6 @@ func main() {
Value: "Dockerfile",
EnvVar: "PLUGIN_DOCKERFILE",
},
cli.StringFlag{
Name: "docker-registry",
Usage: "docker registry",
EnvVar: "PLUGIN_DOCKER_REGISTRY,DOCKER_REGISTRY",
},
cli.StringFlag{
Name: "docker-username",
Usage: "docker username",
@@ -247,7 +242,6 @@ func run(c *cli.Context) error {
noPush := c.Bool("no-push")
dockerConfig, err := createDockerConfig(
c.String("docker-registry"),
c.String("docker-username"),
c.String("docker-password"),
c.String("access-key"),
@@ -334,16 +328,12 @@ func run(c *cli.Context) error {
return plugin.Exec()
}
func createDockerConfig(dockerRegistry, dockerUsername, dockerPassword, accessKey, secretKey,
func createDockerConfig(dockerUsername, dockerPassword, accessKey, secretKey,
registry, assumeRole, externalId, region string, noPush bool) (*docker.Config, error) {
dockerConfig := docker.NewConfig()
if dockerUsername != "" {
// if no docker registry provided, use dockerhub by default
if len(dockerRegistry) == 0 {
dockerRegistry = docker.RegistryV1
}
dockerConfig.SetAuth(dockerRegistry, dockerUsername, dockerPassword)
dockerConfig.SetAuth(docker.RegistryV1, dockerUsername, dockerPassword)
}
if assumeRole != "" {
@@ -479,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: no basic auth credentials")
return "", "", "", errors.Wrap(err, "failed to get ECR auth")
}
return username, password, registry, nil
}
-28
View File
@@ -10,7 +10,6 @@ import (
func TestCreateDockerConfig(t *testing.T) {
got, err := createDockerConfig(
"",
"docker-username",
"docker-password",
"access-key",
@@ -35,37 +34,10 @@ func TestCreateDockerConfig(t *testing.T) {
}
}
func TestCreateDockerConfigFromGivenRegistry(t *testing.T) {
got, err := createDockerConfig(
"docker-registry",
"docker-username",
"docker-password",
"access-key",
"secret-key",
"ecr-registry",
"",
"",
"",
false,
)
if err != nil {
t.Error("failed to create docker config")
}
want := docker.NewConfig()
want.SetAuth("docker-registry", "docker-username", "docker-password")
want.SetCredHelper(docker.RegistryECRPublic, "ecr-login")
want.SetCredHelper("ecr-registry", "ecr-login")
if !reflect.DeepEqual(want, got) {
t.Errorf("not equal:\n want: %#v\n got: %#v", want, got)
}
}
func TestCreateDockerConfigKanikoOneDotEight(t *testing.T) {
os.Setenv(kanikoVersionEnv, "1.8.1")
defer os.Setenv(kanikoVersionEnv, "")
got, err := createDockerConfig(
"",
"docker-username",
"docker-password",
"access-key",
+2 -2
View File
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.9.1
FROM gcr.io/kaniko-project/executor:v1.8.1
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.8.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.9.1
FROM gcr.io/kaniko-project/executor:v1.8.1
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.8.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.9.1
FROM gcr.io/kaniko-project/executor:v1.6.0
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.6.0
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.9.1
FROM gcr.io/kaniko-project/executor:v1.6.0
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.6.0
ADD release/linux/arm64/kaniko-docker /kaniko/
ENTRYPOINT ["/kaniko/kaniko-docker"]
+2 -2
View File
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.9.1
FROM gcr.io/kaniko-project/executor:v1.6.0
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.6.0
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.9.1
FROM gcr.io/kaniko-project/executor:v1.6.0
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.6.0
ADD release/linux/arm64/kaniko-ecr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-ecr"]
+2 -2
View File
@@ -1,5 +1,5 @@
FROM gcr.io/kaniko-project/executor:v1.9.1
FROM gcr.io/kaniko-project/executor:v1.6.0
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.6.0
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.9.1
FROM gcr.io/kaniko-project/executor:v1.6.0
ENV HOME /root
ENV USER root
ENV KANIKO_VERSION=1.9.1
ENV KANIKO_VERSION=1.6.0
ADD release/linux/arm64/kaniko-gcr /kaniko/
ENTRYPOINT ["/kaniko/kaniko-gcr"]