mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-19 10:29:12 +02:00
Bump ecr-login dep to avoid some log spam (#1946)
Previously the ecr-login cred helper we compile into the executor/warmer binaries would log a warning when they were asked for credentials for a non-ECR image. This takes advantage of recent work in ecr-login to let consumers like kaniko disable that logging.
This commit is contained in:
+7
@@ -1,3 +1,10 @@
|
||||
# v1.13.1 (2022-01-28)
|
||||
|
||||
* **Bug Fix**: Fixes LoadDefaultConfig handling of errors returned by passed in functional options. Previously errors returned from the LoadOptions passed into LoadDefaultConfig were incorrectly ignored. [#1562](https://github.com/aws/aws-sdk-go-v2/pull/1562). Thanks to [Pinglei Guo](https://github.com/pingleig) for submitting this PR.
|
||||
* **Bug Fix**: Fixes the SDK's handling of `duration_sections` in the shared credentials file or specified in multiple shared config and shared credentials files under the same profile. [#1568](https://github.com/aws/aws-sdk-go-v2/pull/1568). Thanks to [Amir Szekely](https://github.com/kichik) for help reproduce this bug.
|
||||
* **Bug Fix**: Updates `config` module to use os.UserHomeDir instead of hard coded environment variable for OS. [#1563](https://github.com/aws/aws-sdk-go-v2/pull/1563)
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.13.0 (2022-01-14)
|
||||
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
|
||||
+3
-1
@@ -181,7 +181,9 @@ func (cs configs) ResolveConfig(f func(configs []interface{}) error) error {
|
||||
func LoadDefaultConfig(ctx context.Context, optFns ...func(*LoadOptions) error) (cfg aws.Config, err error) {
|
||||
var options LoadOptions
|
||||
for _, optFn := range optFns {
|
||||
optFn(&options)
|
||||
if err := optFn(&options); err != nil {
|
||||
return aws.Config{}, err
|
||||
}
|
||||
}
|
||||
|
||||
// assign Load Options to configs
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package config
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.13.0"
|
||||
const goModuleVersion = "1.13.1"
|
||||
|
||||
+3
-7
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -1051,12 +1050,9 @@ func (e CredentialRequiresARNError) Error() string {
|
||||
}
|
||||
|
||||
func userHomeDir() string {
|
||||
if runtime.GOOS == "windows" { // Windows
|
||||
return os.Getenv("USERPROFILE")
|
||||
}
|
||||
|
||||
// *nix
|
||||
return os.Getenv("HOME")
|
||||
// Ignore errors since we only care about Windows and *nix.
|
||||
homedir, _ := os.UserHomeDir()
|
||||
return homedir
|
||||
}
|
||||
|
||||
func oneOrNone(bs ...bool) bool {
|
||||
|
||||
+4
@@ -1,3 +1,7 @@
|
||||
# v1.3.5 (2022-01-28)
|
||||
|
||||
* **Bug Fix**: Fixes the SDK's handling of `duration_sections` in the shared credentials file or specified in multiple shared config and shared credentials files under the same profile. [#1568](https://github.com/aws/aws-sdk-go-v2/pull/1568). Thanks to [Amir Szekely](https://github.com/kichik) for help reproduce this bug.
|
||||
|
||||
# v1.3.4 (2022-01-14)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package ini
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.3.4"
|
||||
const goModuleVersion = "1.3.5"
|
||||
|
||||
+2
-16
@@ -216,22 +216,8 @@ func NewStringValue(str string) (Value, error) {
|
||||
|
||||
// NewIntValue returns a Value type generated using an int64 input.
|
||||
func NewIntValue(i int64) (Value, error) {
|
||||
return newValue(IntegerType, 10, []rune{rune(i)})
|
||||
}
|
||||
|
||||
// Append will append values and change the type to a string
|
||||
// type.
|
||||
func (v *Value) Append(tok Token) {
|
||||
r := tok.Raw()
|
||||
if v.Type != QuotedStringType {
|
||||
v.Type = StringType
|
||||
r = tok.raw[1 : len(tok.raw)-1]
|
||||
}
|
||||
if tok.Type() != TokenLit {
|
||||
v.raw = append(v.raw, tok.Raw()...)
|
||||
} else {
|
||||
v.raw = append(v.raw, r...)
|
||||
}
|
||||
v := strconv.FormatInt(i, 10)
|
||||
return newValue(IntegerType, 10, []rune(v))
|
||||
}
|
||||
|
||||
func (v Value) String() string {
|
||||
|
||||
+37
-9
@@ -16,6 +16,7 @@ package ecr
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
@@ -26,7 +27,34 @@ import (
|
||||
var notImplemented = errors.New("not implemented")
|
||||
|
||||
type ECRHelper struct {
|
||||
ClientFactory api.ClientFactory
|
||||
clientFactory api.ClientFactory
|
||||
logger *logrus.Logger
|
||||
}
|
||||
|
||||
type Option func(*ECRHelper)
|
||||
|
||||
func WithClientFactory(clientFactory api.ClientFactory) Option {
|
||||
return func(e *ECRHelper) {
|
||||
e.clientFactory = clientFactory
|
||||
}
|
||||
}
|
||||
|
||||
func WithLogOutput(w io.Writer) Option {
|
||||
return func(e *ECRHelper) {
|
||||
e.logger.Out = w
|
||||
}
|
||||
}
|
||||
|
||||
func NewECRHelper(opts ...Option) *ECRHelper {
|
||||
e := &ECRHelper{
|
||||
clientFactory: api.DefaultClientFactory{},
|
||||
logger: logrus.StandardLogger(),
|
||||
}
|
||||
for _, o := range opts {
|
||||
o(e)
|
||||
}
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
// ensure ECRHelper adheres to the credentials.Helper interface
|
||||
@@ -45,7 +73,7 @@ func (ECRHelper) Delete(serverURL string) error {
|
||||
func (self ECRHelper) Get(serverURL string) (string, string, error) {
|
||||
registry, err := api.ExtractRegistry(serverURL)
|
||||
if err != nil {
|
||||
logrus.
|
||||
self.logger.
|
||||
WithError(err).
|
||||
WithField("serverURL", serverURL).
|
||||
Error("Error parsing the serverURL")
|
||||
@@ -54,30 +82,30 @@ func (self ECRHelper) Get(serverURL string) (string, string, error) {
|
||||
|
||||
var client api.Client
|
||||
if registry.FIPS {
|
||||
client, err = self.ClientFactory.NewClientWithFipsEndpoint(registry.Region)
|
||||
client, err = self.clientFactory.NewClientWithFipsEndpoint(registry.Region)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("Error resolving FIPS endpoint")
|
||||
self.logger.WithError(err).Error("Error resolving FIPS endpoint")
|
||||
return "", "", credentials.NewErrCredentialsNotFound()
|
||||
}
|
||||
} else {
|
||||
client = self.ClientFactory.NewClientFromRegion(registry.Region)
|
||||
client = self.clientFactory.NewClientFromRegion(registry.Region)
|
||||
}
|
||||
|
||||
auth, err := client.GetCredentials(serverURL)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("Error retrieving credentials")
|
||||
self.logger.WithError(err).Error("Error retrieving credentials")
|
||||
return "", "", credentials.NewErrCredentialsNotFound()
|
||||
}
|
||||
return auth.Username, auth.Password, nil
|
||||
}
|
||||
|
||||
func (self ECRHelper) List() (map[string]string, error) {
|
||||
logrus.Debug("Listing credentials")
|
||||
client := self.ClientFactory.NewClientWithDefaults()
|
||||
self.logger.Debug("Listing credentials")
|
||||
client := self.clientFactory.NewClientWithDefaults()
|
||||
|
||||
auths, err := client.ListCredentials()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("Error listing credentials")
|
||||
self.logger.WithError(err).Error("Error listing credentials")
|
||||
return nil, fmt.Errorf("ecr: could not list credentials: %v", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user