Skip to content

Commit f7564ae

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

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
@@ -904,11 +904,11 @@ func (r *Runner) handleCredentials(callCtx engine.Context, monitor Monitor, env
904904

905905
// If the existing credential is expired, we need to provide it to the cred tool through the environment.
906906
if exists && c.IsExpired() {
907-
credJson, err := json.Marshal(c)
907+
credJSON, err := json.Marshal(c)
908908
if err != nil {
909909
return nil, fmt.Errorf("failed to marshal credential: %w", err)
910910
}
911-
env = append(env, fmt.Sprintf("%s=%s", credentials.ExistingCredential, string(credJson)))
911+
env = append(env, fmt.Sprintf("%s=%s", credentials.ExistingCredential, string(credJSON)))
912912
}
913913

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

0 commit comments

Comments
 (0)