mirror of
https://github.com/drone/drone-kaniko.git
synced 2026-06-16 14:49:02 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eee08bbac3 | |||
| 4c65ff4509 | |||
| ef62817264 |
@@ -37,7 +37,7 @@ pipeline:
|
||||
identifier: Build
|
||||
spec:
|
||||
connectorRef: Plugins_Docker_Hub_Connector
|
||||
image: golang:1.23.0
|
||||
image: golang:1.22.4
|
||||
shell: Sh
|
||||
command: |-
|
||||
go test ./...
|
||||
@@ -322,7 +322,7 @@ pipeline:
|
||||
identifier: Build_and_Test
|
||||
spec:
|
||||
connectorRef: Plugins_Docker_Hub_Connector
|
||||
image: golang:1.23.0
|
||||
image: golang:1.22.4
|
||||
shell: Sh
|
||||
command: |-
|
||||
go test ./...
|
||||
|
||||
@@ -513,11 +513,13 @@ func handlePushOnly(c *cli.Context) error {
|
||||
// Setup GAR authentication
|
||||
jsonKey := c.String("json-key")
|
||||
if jsonKey != "" {
|
||||
// Setup standard env variable auth which didn't work
|
||||
if err := setupGARAuth(jsonKey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Info("Setting up authentication for GAR")
|
||||
|
||||
// Try an alternative approach: create a Docker config.json with GAR credentials
|
||||
logrus.Info("Setting up Docker config authentication for GAR")
|
||||
|
||||
// Create Docker config directory if it doesn't exist
|
||||
dockerConfigDir := "/kaniko/.docker"
|
||||
@@ -566,6 +568,7 @@ func handlePushOnly(c *cli.Context) error {
|
||||
if err := os.Setenv("DOCKER_CONFIG", dockerConfigDir); err != nil {
|
||||
return fmt.Errorf("failed to set DOCKER_CONFIG environment variable: %v", err)
|
||||
}
|
||||
logrus.Infof("Set DOCKER_CONFIG to %s", dockerConfigDir)
|
||||
|
||||
// Set up crane to use basic auth with docker config
|
||||
opts = append(opts, crane.WithAuthFromKeychain(authn.DefaultKeychain))
|
||||
@@ -589,11 +592,11 @@ func handlePushOnly(c *cli.Context) error {
|
||||
for _, tag := range tags {
|
||||
dest := fmt.Sprintf("%s/%s:%s", registry, repo, tag)
|
||||
logrus.Infof("Pushing image to: %s", dest)
|
||||
|
||||
|
||||
if err := crane.Push(img, dest, opts...); err != nil {
|
||||
return fmt.Errorf("failed to push image to %s: %v", dest, err)
|
||||
}
|
||||
|
||||
|
||||
logrus.Infof("Successfully pushed image to %s", dest)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user