mirror of
https://github.com/drone/drone-kaniko.git
synced 2026-06-14 05:12:27 +08:00
Compare commits
2 Commits
v1.11.3-debug
...
v1.11.4
| Author | SHA1 | Date | |
|---|---|---|---|
| ae33ce93b8 | |||
| a8c364c9e7 |
+12
-7
@@ -711,15 +711,20 @@ func setDockerAuth(username, password, registry, dockerUsername, dockerPassword,
|
|||||||
Password: password,
|
Password: password,
|
||||||
}
|
}
|
||||||
|
|
||||||
pullFromRegistryCreds := docker.RegistryCredentials{
|
credentials := []docker.RegistryCredentials{pushToRegistryCreds}
|
||||||
Registry: dockerRegistry,
|
|
||||||
Username: dockerUsername,
|
if dockerRegistry != "" {
|
||||||
Password: dockerPassword,
|
pullFromRegistryCreds := docker.RegistryCredentials{
|
||||||
|
Registry: dockerRegistry,
|
||||||
|
Username: dockerUsername,
|
||||||
|
Password: dockerPassword,
|
||||||
|
}
|
||||||
|
credentials = append(credentials, pullFromRegistryCreds)
|
||||||
|
} else {
|
||||||
|
fmt.Println("\033[33mTo ensure consistent and reliable pipeline execution, we recommend setting up a Base Image Connector.\033[0m\n" +
|
||||||
|
"\033[33mWhile optional at this time, configuring it helps prevent failures caused by Docker Hub's rate limits.\033[0m")
|
||||||
}
|
}
|
||||||
|
|
||||||
credentials := []docker.RegistryCredentials{pushToRegistryCreds, pullFromRegistryCreds}
|
|
||||||
return dockerConfig.CreateDockerConfig(credentials, dockerConfigPath)
|
return dockerConfig.CreateDockerConfig(credentials, dockerConfigPath)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeParam(s string) string {
|
func encodeParam(s string) string {
|
||||||
|
|||||||
@@ -153,4 +153,4 @@ func TestCreateDockerConfigWithoutBaseRegistry(t *testing.T) {
|
|||||||
// Check if the public Docker Hub auth is not set
|
// Check if the public Docker Hub auth is not set
|
||||||
_, exists := config.Auths[""]
|
_, exists := config.Auths[""]
|
||||||
assert.False(t, exists)
|
assert.False(t, exists)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -508,6 +509,9 @@ func setDockerAuth(username, password, registry, baseImageUsername, baseImagePas
|
|||||||
Password: baseImagePassword,
|
Password: baseImagePassword,
|
||||||
}
|
}
|
||||||
credentials = append(credentials, pullFromRegistryCreds)
|
credentials = append(credentials, pullFromRegistryCreds)
|
||||||
|
} else {
|
||||||
|
fmt.Println("\033[33mTo ensure consistent and reliable pipeline execution, we recommend setting up a Base Image Connector.\033[0m\n" +
|
||||||
|
"\033[33mWhile optional at this time, configuring it helps prevent failures caused by Docker Hub's rate limits.\033[0m")
|
||||||
}
|
}
|
||||||
// Creates docker config for both the regustries used for authentication
|
// Creates docker config for both the regustries used for authentication
|
||||||
return dockerConfig.CreateDockerConfig(credentials, dockerPath)
|
return dockerConfig.CreateDockerConfig(credentials, dockerPath)
|
||||||
|
|||||||
@@ -585,6 +585,9 @@ func setDockerAuth(dockerRegistry, dockerUsername, dockerPassword, accessKey, se
|
|||||||
Password: dockerPassword,
|
Password: dockerPassword,
|
||||||
}
|
}
|
||||||
credentials = append(credentials, pullFromRegistryCreds)
|
credentials = append(credentials, pullFromRegistryCreds)
|
||||||
|
} else {
|
||||||
|
fmt.Println("\033[33mTo ensure consistent and reliable pipeline execution, we recommend setting up a Base Image Connector.\033[0m\n" +
|
||||||
|
"\033[33mWhile optional at this time, configuring it helps prevent failures caused by Docker Hub's rate limits.\033[0m")
|
||||||
}
|
}
|
||||||
|
|
||||||
if assumeRole != "" && oidcToken != "" {
|
if assumeRole != "" && oidcToken != "" {
|
||||||
|
|||||||
@@ -42,4 +42,4 @@ func TestCreateDockerConfigForECRWithBaseRegistry(t *testing.T) {
|
|||||||
|
|
||||||
expectedDockerAuth := docker.Auth{Auth: base64.StdEncoding.EncodeToString([]byte(dockerUsername + ":" + dockerPassword))}
|
expectedDockerAuth := docker.Auth{Auth: base64.StdEncoding.EncodeToString([]byte(dockerUsername + ":" + dockerPassword))}
|
||||||
assert.Equal(t, expectedDockerAuth, config.Auths[dockerRegistry])
|
assert.Equal(t, expectedDockerAuth, config.Auths[dockerRegistry])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -384,6 +384,9 @@ func run(c *cli.Context) error {
|
|||||||
); err != nil {
|
); err != nil {
|
||||||
return errors.Wrap(err, "failed to create docker config")
|
return errors.Wrap(err, "failed to create docker config")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Println("\033[33mTo ensure consistent and reliable pipeline execution, we recommend setting up a Base Image Connector.\033[0m\n" +
|
||||||
|
"\033[33mWhile optional at this time, configuring it helps prevent failures caused by Docker Hub's rate limits.\033[0m")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
dockerConfigPath string = "/kaniko/.docker"
|
dockerConfigPath string = "/kaniko/.docker"
|
||||||
// GCR JSON key file path
|
// GCR JSON key file path
|
||||||
gcrKeyPath string = "/kaniko/config.json"
|
gcrKeyPath string = "/kaniko/config.json"
|
||||||
gcrEnvVariable string = "GOOGLE_APPLICATION_CREDENTIALS"
|
gcrEnvVariable string = "GOOGLE_APPLICATION_CREDENTIALS"
|
||||||
|
|
||||||
defaultDigestFile string = "/kaniko/digest-file"
|
defaultDigestFile string = "/kaniko/digest-file"
|
||||||
)
|
)
|
||||||
@@ -353,7 +353,7 @@ func run(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setup docker config only when base image registry is specified
|
// setup docker config only when base image registry is specified
|
||||||
if c.String("base-image-registry") != ""{
|
if c.String("base-image-registry") != "" {
|
||||||
if err := setDockerAuth(
|
if err := setDockerAuth(
|
||||||
c.String("base-image-username"),
|
c.String("base-image-username"),
|
||||||
c.String("base-image-password"),
|
c.String("base-image-password"),
|
||||||
@@ -361,6 +361,9 @@ func run(c *cli.Context) error {
|
|||||||
); err != nil {
|
); err != nil {
|
||||||
return errors.Wrap(err, "failed to create docker config")
|
return errors.Wrap(err, "failed to create docker config")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Println("\033[33mTo ensure consistent and reliable pipeline execution, we recommend setting up a Base Image Connector.\033[0m\n" +
|
||||||
|
"\033[33mWhile optional at this time, configuring it helps prevent failures caused by Docker Hub's rate limits.\033[0m")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +442,7 @@ func run(c *cli.Context) error {
|
|||||||
return plugin.Exec()
|
return plugin.Exec()
|
||||||
}
|
}
|
||||||
|
|
||||||
func setDockerAuth(dockerUsername, dockerPassword, dockerRegistry string) (error) {
|
func setDockerAuth(dockerUsername, dockerPassword, dockerRegistry string) error {
|
||||||
dockerConfig := docker.NewConfig()
|
dockerConfig := docker.NewConfig()
|
||||||
dockerRegistryCreds := docker.RegistryCredentials{
|
dockerRegistryCreds := docker.RegistryCredentials{
|
||||||
Registry: dockerRegistry,
|
Registry: dockerRegistry,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.2
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-amd64
|
||||||
|
|
||||||
ENV KANIKO_VERSION=1.23.2
|
ENV KANIKO_VERSION=1.25.0
|
||||||
ADD release/linux/amd64/kaniko-acr /kaniko/
|
ADD release/linux/amd64/kaniko-acr /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-acr"]
|
ENTRYPOINT ["/kaniko/kaniko-acr"]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.0
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-arm64
|
||||||
|
|
||||||
ENV HOME /root
|
ENV HOME /root
|
||||||
ENV USER root
|
ENV USER root
|
||||||
|
|
||||||
ENV KANIKO_VERSION=1.23.0
|
ENV KANIKO_VERSION=1.25.0
|
||||||
ADD release/linux/arm64/kaniko-acr /kaniko/
|
ADD release/linux/arm64/kaniko-acr /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-acr"]
|
ENTRYPOINT ["/kaniko/kaniko-acr"]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.2
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-amd64
|
||||||
|
|
||||||
ENV KANIKO_VERSION=1.23.2
|
ENV KANIKO_VERSION=1.25.0
|
||||||
ADD release/linux/amd64/kaniko-docker /kaniko/
|
ADD release/linux/amd64/kaniko-docker /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-docker"]
|
ENTRYPOINT ["/kaniko/kaniko-docker"]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.2
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-arm64
|
||||||
|
|
||||||
ENV HOME /root
|
ENV HOME /root
|
||||||
ENV USER root
|
ENV USER root
|
||||||
|
|
||||||
ENV KANIKO_VERSION=1.23.2
|
ENV KANIKO_VERSION=1.25.0
|
||||||
ADD release/linux/arm64/kaniko-docker /kaniko/
|
ADD release/linux/arm64/kaniko-docker /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-docker"]
|
ENTRYPOINT ["/kaniko/kaniko-docker"]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.2
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-amd64
|
||||||
|
|
||||||
ENV KANIKO_VERSION=1.23.2
|
ENV KANIKO_VERSION=1.25.0
|
||||||
ADD release/linux/amd64/kaniko-ecr /kaniko/
|
ADD release/linux/amd64/kaniko-ecr /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-ecr"]
|
ENTRYPOINT ["/kaniko/kaniko-ecr"]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.2
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-arm64
|
||||||
|
|
||||||
ENV HOME /root
|
ENV HOME /root
|
||||||
ENV USER root
|
ENV USER root
|
||||||
ENV KANIKO_VERSION=1.23.2
|
ENV KANIKO_VERSION=1.25.0
|
||||||
|
|
||||||
ADD release/linux/arm64/kaniko-ecr /kaniko/
|
ADD release/linux/arm64/kaniko-ecr /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-ecr"]
|
ENTRYPOINT ["/kaniko/kaniko-ecr"]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.2
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-amd64
|
||||||
|
|
||||||
ENV KANIKO_VERSION=1.23.2
|
ENV KANIKO_VERSION=1.25.0
|
||||||
ADD release/linux/amd64/kaniko-gar /kaniko/
|
ADD release/linux/amd64/kaniko-gar /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-gar"]
|
ENTRYPOINT ["/kaniko/kaniko-gar"]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM gcr.io/kaniko-project/executor:v1.23.2
|
FROM harnesscommunity/kaniko-executor:1.25.0-linux-arm64
|
||||||
|
|
||||||
ENV HOME /root
|
ENV HOME /root
|
||||||
ENV USER root
|
ENV USER root
|
||||||
ENV KANIKO_VERSION=1.23.2
|
ENV KANIKO_VERSION=1.25.0
|
||||||
|
|
||||||
ADD release/linux/arm64/kaniko-gar /kaniko/
|
ADD release/linux/arm64/kaniko-gar /kaniko/
|
||||||
ENTRYPOINT ["/kaniko/kaniko-gar"]
|
ENTRYPOINT ["/kaniko/kaniko-gar"]
|
||||||
|
|||||||
Reference in New Issue
Block a user