Skip to content

Commit 592f582

Browse files
committed
Revert "mz280: log used credential sources explicitly (#369)"
This reverts commit 511f65c, reversing changes made to 5b6cfca.
1 parent 511f65c commit 592f582

File tree

3 files changed

+1
-33
lines changed

3 files changed

+1
-33
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ expect - see [Known Issues](#known-issues).
5656
- [Caching Layers](#caching-layers)
5757
- [Caching Base Images](#caching-base-images)
5858
- [Pushing to Different Registries](#pushing-to-different-registries)
59-
- [Credential Provider Priorities](#credential-provider-priorities)
6059
- [Pushing to Docker Hub](#pushing-to-docker-hub)
6160
- [Pushing to Google GCR](#pushing-to-google-gcr)
6261
- [Pushing to GCR using Workload Identity](#pushing-to-gcr-using-workload-identity)
@@ -622,11 +621,6 @@ kaniko comes with support for GCR, Docker `config.json` and Amazon ECR, but
622621
configuring another credential helper should allow pushing to a different
623622
registry.
624623

625-
#### Credential Provider Priorities
626-
627-
By default kaniko will configure all built-in credential providers for you. These are `[default, env, google, ecr, acr, gitlab]`.
628-
You can (de)-activate credential helpers via the [`--credential-helpers`](#flag---credential-helpers) flag. The `default` credential helper will always be active and itself handles two sources: `DOCKER_AUTH_CONFIG` environment variable and `/kaniko/.docker/config.json` file, where priority is always given to `DOCKER_AUTH_CONFIG` and therefore can shadow credentials configured in the config file. If you want to disable `DOCKER_AUTH_CONFIG` you have to unset the environment variable explicitly `unset DOCKER_AUTH_CONFIG` prior to calling kaniko.
629-
630624
#### Pushing to Docker Hub
631625

632626
Get your docker registry user and password encoded in base64

cmd/executor/cmd/root.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,7 @@ var RootCmd = &cobra.Command{
187187
}
188188
if !opts.NoPush || opts.CacheRepo != "" {
189189
if err := executor.CheckPushPermissions(opts); err != nil {
190-
logrus.Warnf("make sure you entered the correct tag name, that you are authenticated correctly, and try again.")
191-
// mz280: remind users that DOCKER_AUTH_CONFIG gets prioritized by docker-cli
192-
// https://github.com/docker/cli/pull/6171
193-
_, ok := os.LookupEnv("DOCKER_AUTH_CONFIG")
194-
if ok {
195-
logrus.Warnf("note that your DOCKER_AUTH_CONFIG env variable can shadow credentials from configfile")
196-
logrus.Warnf("see https://github.com/osscontainertools/kaniko/issues/280#issuecomment-3498449955")
197-
}
198-
exit(fmt.Errorf("error checking push permissions: %w", err))
190+
exit(fmt.Errorf("error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: %w", err))
199191
}
200192
}
201193
if err := resolveRelativePaths(); err != nil {

pkg/creds/creds.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,26 @@ limitations under the License.
1717
package creds
1818

1919
import (
20-
"fmt"
2120
"io"
22-
"os"
23-
"strings"
2421

2522
ecr "github.com/awslabs/amazon-ecr-credential-helper/ecr-login"
2623
"github.com/chrismellard/docker-credential-acr-env/pkg/credhelper"
2724
gitlab "github.com/ePirat/docker-credential-gitlabci/pkg/credhelper"
2825
"github.com/google/go-containerregistry/pkg/authn"
2926
"github.com/google/go-containerregistry/pkg/v1/google"
3027
"github.com/osscontainertools/kaniko/pkg/config"
31-
"github.com/osscontainertools/kaniko/pkg/util"
3228
"github.com/sirupsen/logrus"
3329
)
3430

3531
// GetKeychain returns a keychain for accessing container registries.
3632
func GetKeychain(opts *config.RegistryOptions) authn.Keychain {
3733
var helpers []string
38-
var prios []string
39-
40-
_, ok := os.LookupEnv("DOCKER_AUTH_CONFIG")
41-
if ok {
42-
prios = append(prios, "env:DOCKER_AUTH_CONFIG")
43-
}
44-
45-
cf := util.DockerConfLocation()
46-
_, err := os.Lstat(cf)
47-
if err == nil {
48-
prios = append(prios, fmt.Sprintf("file:%s", cf))
49-
}
5034

5135
if len(opts.CredentialHelpers) == 0 {
5236
helpers = []string{"env", "google", "ecr", "acr", "gitlab"}
5337
} else {
5438
helpers = opts.CredentialHelpers
5539
}
56-
prios = append(prios, helpers...)
5740

5841
keychains := []authn.Keychain{authn.DefaultKeychain}
5942
for _, source := range helpers {
@@ -89,6 +72,5 @@ func GetKeychain(opts *config.RegistryOptions) authn.Keychain {
8972
}
9073
}
9174

92-
logrus.Infof("credential providers by priority: [%s]", strings.Join(prios, ", "))
9375
return authn.NewMultiKeychain(keychains...)
9476
}

0 commit comments

Comments
 (0)