mirror of
https://github.com/drone/drone-kaniko.git
synced 2026-06-04 10:14:54 +08:00
feat: [CI-17953]: Add warning if base image connector is not provided (#152)
* [CI-17953]: Add warning if base image connector is not provided * [CI-17953]: Add warning if base image connector is not provided * [CI-17953]: Add warning if base image connector is not provided
This commit is contained in:
@@ -711,15 +711,20 @@ func setDockerAuth(username, password, registry, dockerUsername, dockerPassword,
|
||||
Password: password,
|
||||
}
|
||||
|
||||
credentials := []docker.RegistryCredentials{pushToRegistryCreds}
|
||||
|
||||
if dockerRegistry != "" {
|
||||
pullFromRegistryCreds := docker.RegistryCredentials{
|
||||
Registry: dockerRegistry,
|
||||
Username: dockerUsername,
|
||||
Password: dockerPassword,
|
||||
}
|
||||
|
||||
credentials := []docker.RegistryCredentials{pushToRegistryCreds, 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")
|
||||
}
|
||||
return dockerConfig.CreateDockerConfig(credentials, dockerConfigPath)
|
||||
|
||||
}
|
||||
|
||||
func encodeParam(s string) string {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -508,6 +509,9 @@ func setDockerAuth(username, password, registry, baseImageUsername, baseImagePas
|
||||
Password: baseImagePassword,
|
||||
}
|
||||
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
|
||||
return dockerConfig.CreateDockerConfig(credentials, dockerPath)
|
||||
|
||||
@@ -585,6 +585,9 @@ func setDockerAuth(dockerRegistry, dockerUsername, dockerPassword, accessKey, se
|
||||
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")
|
||||
}
|
||||
|
||||
if assumeRole != "" && oidcToken != "" {
|
||||
|
||||
@@ -384,6 +384,9 @@ func run(c *cli.Context) error {
|
||||
); err != nil {
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -361,6 +361,9 @@ func run(c *cli.Context) error {
|
||||
); err != nil {
|
||||
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()
|
||||
}
|
||||
|
||||
func setDockerAuth(dockerUsername, dockerPassword, dockerRegistry string) (error) {
|
||||
func setDockerAuth(dockerUsername, dockerPassword, dockerRegistry string) error {
|
||||
dockerConfig := docker.NewConfig()
|
||||
dockerRegistryCreds := docker.RegistryCredentials{
|
||||
Registry: dockerRegistry,
|
||||
|
||||
Reference in New Issue
Block a user