Compare commits

..

1 Commits

Author SHA1 Message Date
Ompragash Viswanathan 3674493911 update kaniko-executor base image to 1.25.0 from chaingaurds maintained fork 2025-07-02 09:30:10 +05:30
8 changed files with 16 additions and 95 deletions
+7 -26
View File
@@ -22,7 +22,6 @@ import (
kaniko "github.com/drone/drone-kaniko"
"github.com/drone/drone-kaniko/pkg/artifact"
"github.com/drone/drone-kaniko/pkg/docker"
"github.com/drone/drone-kaniko/pkg/utils"
)
const (
@@ -99,17 +98,6 @@ func main() {
Usage: "build args",
EnvVar: "PLUGIN_BUILD_ARGS",
},
cli.GenericFlag{
Name: "args-new",
Usage: "build args new",
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
Value: new(utils.CustomStringSliceFlag),
},
cli.BoolFlag{
Name: "plugin-multiple-build-agrs",
Usage: "plugin multiple build agrs",
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
},
cli.StringFlag{
Name: "target",
Usage: "build target",
@@ -444,8 +432,6 @@ func run(c *cli.Context) error {
AutoTagSuffix: c.String("auto-tag-suffix"),
ExpandTag: c.Bool("expand-tag"),
Args: c.StringSlice("args"),
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
Target: c.String("target"),
Repo: c.String("repo"),
Mirrors: c.StringSlice("registry-mirrors"),
@@ -725,20 +711,15 @@ 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 = 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")
pullFromRegistryCreds := docker.RegistryCredentials{
Registry: dockerRegistry,
Username: dockerUsername,
Password: dockerPassword,
}
credentials := []docker.RegistryCredentials{pushToRegistryCreds, pullFromRegistryCreds}
return dockerConfig.CreateDockerConfig(credentials, dockerConfigPath)
}
func encodeParam(s string) string {
+1 -1
View File
@@ -153,4 +153,4 @@ func TestCreateDockerConfigWithoutBaseRegistry(t *testing.T) {
// Check if the public Docker Hub auth is not set
_, exists := config.Auths[""]
assert.False(t, exists)
}
}
-19
View File
@@ -1,7 +1,6 @@
package main
import (
"fmt"
"os"
"strings"
@@ -13,7 +12,6 @@ import (
kaniko "github.com/drone/drone-kaniko"
"github.com/drone/drone-kaniko/pkg/artifact"
"github.com/drone/drone-kaniko/pkg/docker"
"github.com/drone/drone-kaniko/pkg/utils"
)
const (
@@ -103,17 +101,6 @@ func main() {
Usage: "build args",
EnvVar: "PLUGIN_BUILD_ARGS",
},
cli.GenericFlag{
Name: "args-new",
Usage: "build args new",
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
Value: new(utils.CustomStringSliceFlag),
},
cli.BoolFlag{
Name: "plugin-multiple-build-agrs",
Usage: "plugin multiple build agrs",
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
},
cli.StringFlag{
Name: "target",
Usage: "build target",
@@ -251,7 +238,6 @@ func main() {
Usage: "Enable or disable compressed caching.",
EnvVar: "PLUGIN_COMPRESSED_CACHING",
},
cli.StringFlag{
Name: "context-sub-path",
Usage: "Sub-path within the context to build.",
@@ -434,8 +420,6 @@ func run(c *cli.Context) error {
AutoTagSuffix: c.String("auto-tag-suffix"),
ExpandTag: c.Bool("expand-tag"),
Args: c.StringSlice("args"),
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
Target: c.String("target"),
Repo: buildRepo(c.String("registry"), c.String("repo"), c.Bool("expand-repo")),
Mirrors: c.StringSlice("registry-mirrors"),
@@ -524,9 +508,6 @@ 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)
@@ -1,4 +1,4 @@
package utils
package main
import (
"strings"
@@ -10,7 +10,6 @@ type CustomStringSliceFlag struct {
Value []string
}
// GetValue returns the slice of strings stored in the flag
func (f *CustomStringSliceFlag) GetValue() []string {
if f.Value == nil {
return make([]string, 0)
@@ -18,7 +17,6 @@ func (f *CustomStringSliceFlag) GetValue() []string {
return f.Value
}
// String returns a string representation of the flag
func (f *CustomStringSliceFlag) String() string {
if f.Value == nil {
return ""
@@ -26,7 +24,6 @@ func (f *CustomStringSliceFlag) String() string {
return strings.Join(f.Value, ";")
}
// Set sets the value of the flag from a string
func (f *CustomStringSliceFlag) Set(v string) error {
for _, s := range strings.Split(v, ";") {
s = strings.TrimSpace(s)
+2 -6
View File
@@ -30,7 +30,6 @@ import (
kaniko "github.com/drone/drone-kaniko"
"github.com/drone/drone-kaniko/pkg/artifact"
"github.com/drone/drone-kaniko/pkg/docker"
"github.com/drone/drone-kaniko/pkg/utils"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/crane"
)
@@ -133,7 +132,7 @@ func main() {
Name: "args-new",
Usage: "build args new",
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
Value: new(utils.CustomStringSliceFlag),
Value: new(CustomStringSliceFlag),
},
cli.BoolFlag{
Name: "plugin-multiple-build-agrs",
@@ -505,7 +504,7 @@ func run(c *cli.Context) error {
AutoTagSuffix: c.String("auto-tag-suffix"),
ExpandTag: c.Bool("expand-tag"),
Args: c.StringSlice("args"),
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
ArgsNew: c.Generic("args-new").(*CustomStringSliceFlag).GetValue(),
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
Target: c.String("target"),
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
@@ -586,9 +585,6 @@ 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 != "" {
+1 -1
View File
@@ -42,4 +42,4 @@ func TestCreateDockerConfigForECRWithBaseRegistry(t *testing.T) {
expectedDockerAuth := docker.Auth{Auth: base64.StdEncoding.EncodeToString([]byte(dockerUsername + ":" + dockerPassword))}
assert.Equal(t, expectedDockerAuth, config.Auths[dockerRegistry])
}
}
-18
View File
@@ -18,8 +18,6 @@ import (
"github.com/drone/drone-kaniko/pkg/docker"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/crane"
"github.com/drone/drone-kaniko/pkg/utils"
)
const (
@@ -98,17 +96,6 @@ func main() {
Usage: "build args",
EnvVar: "PLUGIN_BUILD_ARGS",
},
cli.GenericFlag{
Name: "args-new",
Usage: "build args new",
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
Value: new(utils.CustomStringSliceFlag),
},
cli.BoolFlag{
Name: "plugin-multiple-build-agrs",
Usage: "plugin multiple build agrs",
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
},
cli.StringFlag{
Name: "target",
Usage: "build target",
@@ -397,9 +384,6 @@ 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")
}
}
@@ -414,8 +398,6 @@ func run(c *cli.Context) error {
AutoTagSuffix: c.String("auto-tag-suffix"),
ExpandTag: c.Bool("expand-tag"),
Args: c.StringSlice("args"),
ArgsNew: c.Generic("args-new").(*utils.CustomStringSliceFlag).GetValue(),
IsMultipleBuildArgs: c.Bool("plugin-multiple-build-agrs"),
Target: c.String("target"),
Repo: fmt.Sprintf("%s/%s", c.String("registry"), c.String("repo")),
Mirrors: c.StringSlice("registry-mirrors"),
+4 -20
View File
@@ -13,14 +13,13 @@ import (
kaniko "github.com/drone/drone-kaniko"
"github.com/drone/drone-kaniko/pkg/artifact"
"github.com/drone/drone-kaniko/pkg/docker"
"github.com/drone/drone-kaniko/pkg/utils"
)
const (
dockerConfigPath string = "/kaniko/.docker"
// GCR JSON key file path
gcrKeyPath string = "/kaniko/config.json"
gcrEnvVariable string = "GOOGLE_APPLICATION_CREDENTIALS"
gcrKeyPath string = "/kaniko/config.json"
gcrEnvVariable string = "GOOGLE_APPLICATION_CREDENTIALS"
defaultDigestFile string = "/kaniko/digest-file"
)
@@ -334,18 +333,6 @@ func main() {
Usage: "Number of retries for downloading base images.",
EnvVar: "PLUGIN_IMAGE_DOWNLOAD_RETRY",
},
cli.GenericFlag{
Name: "args-new",
Usage: "build args new",
EnvVar: "PLUGIN_BUILD_ARGS_NEW",
Value: new(utils.CustomStringSliceFlag),
},
cli.BoolFlag{
Name: "plugin-multiple-build-agrs",
Usage: "plugin multiple build agrs",
EnvVar: "PLUGIN_MULTIPLE_BUILD_ARGS",
},
}
if err := app.Run(os.Args); err != nil {
@@ -366,7 +353,7 @@ func run(c *cli.Context) error {
}
// 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(
c.String("base-image-username"),
c.String("base-image-password"),
@@ -374,9 +361,6 @@ 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")
}
}
@@ -455,7 +439,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,