Skip to content

Commit e430c39

Browse files
committed
little fixes
Signed-off-by: Grant Linville <[email protected]>
1 parent ea76469 commit e430c39

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/credentials/credential.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (c Credential) toDockerAuthConfig() (types.AuthConfig, error) {
4949

5050
func credentialFromDockerAuthConfig(authCfg types.AuthConfig) (Credential, error) {
5151
var cred Credential
52-
if err := json.Unmarshal([]byte(authCfg.Password), &cred); err != nil {
52+
if err := json.Unmarshal([]byte(authCfg.Password), &cred); err != nil || len(cred.Env) == 0 {
5353
// Legacy: try unmarshalling into just an env map
5454
var env map[string]string
5555
if err := json.Unmarshal([]byte(authCfg.Password), &env); err != nil {

pkg/runner/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,11 +879,11 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
879879

880880
// If the existing credential is expired, we need to provide it to the cred tool through the environment.
881881
if exists && c.IsExpired() {
882-
credJson, err := json.Marshal(c)
882+
credJSON, err := json.Marshal(c)
883883
if err != nil {
884884
return nil, fmt.Errorf("failed to marshal credential: %w", err)
885885
}
886-
env = append(env, fmt.Sprintf("%s=%s", credentials.ExistingCredential, string(credJson)))
886+
env = append(env, fmt.Sprintf("%s=%s", credentials.ExistingCredential, string(credJSON)))
887887
}
888888

889889
// Get the input for the credential tool, if there is any.

0 commit comments

Comments
 (0)