Skip to content

Commit ca8718c

Browse files
committed
fix: Docker login condition for devtron job
1 parent 200fd83 commit ca8718c

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

ci-runner/helper/DockerHelper.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,20 @@ func (impl *DockerHelperImpl) StartDockerDaemonAndDockerLogin(commonWorkflowRequ
167167
util.PrintFileContent(DOCKERD_OUTPUT_FILE_PATH)
168168
return err
169169
}
170-
ciContext := cicxt.BuildCiContext(context.Background(), commonWorkflowRequest.EnableSecretMasking)
171-
err = impl.DockerLogin(ciContext, &DockerCredentials{
172-
DockerUsername: commonWorkflowRequest.DockerUsername,
173-
DockerPassword: commonWorkflowRequest.DockerPassword,
174-
AwsRegion: commonWorkflowRequest.AwsRegion,
175-
AccessKey: commonWorkflowRequest.AccessKey,
176-
SecretKey: commonWorkflowRequest.SecretKey,
177-
DockerRegistryURL: commonWorkflowRequest.IntermediateDockerRegistryUrl,
178-
DockerRegistryType: commonWorkflowRequest.DockerRegistryType,
179-
CredentialsType: commonWorkflowRequest.CredentialsType,
180-
})
170+
shouldDockerLogin := len(commonWorkflowRequest.IntermediateDockerRegistryUrl) != 0
171+
if shouldDockerLogin {
172+
ciContext := cicxt.BuildCiContext(context.Background(), commonWorkflowRequest.EnableSecretMasking)
173+
err = impl.DockerLogin(ciContext, &DockerCredentials{
174+
DockerUsername: commonWorkflowRequest.DockerUsername,
175+
DockerPassword: commonWorkflowRequest.DockerPassword,
176+
AwsRegion: commonWorkflowRequest.AwsRegion,
177+
AccessKey: commonWorkflowRequest.AccessKey,
178+
SecretKey: commonWorkflowRequest.SecretKey,
179+
DockerRegistryURL: commonWorkflowRequest.IntermediateDockerRegistryUrl,
180+
DockerRegistryType: commonWorkflowRequest.DockerRegistryType,
181+
CredentialsType: commonWorkflowRequest.CredentialsType,
182+
})
183+
}
181184
if err != nil {
182185
return err
183186
}

0 commit comments

Comments
 (0)