Skip to content

Commit 44efe37

Browse files
authored
Add Azure Artifacts credentials after credential metadata is added (#291)
1 parent 8e85cac commit 44efe37

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

cmd/dependabot/internal/cmd/update.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,22 @@ func processInput(input *model.Input, flags *UpdateFlags) {
343343
"host": "dev.azure.com",
344344
})
345345
}
346+
}
347+
348+
// Calculate the credentials-metadata as it cannot be provided by the user anymore.
349+
input.Job.CredentialsMetadata = []model.Credential{}
350+
for _, credential := range input.Credentials {
351+
entry := make(map[string]any)
352+
for k, v := range credential {
353+
// Updater does not get credentials.
354+
if k != "username" && k != "token" && k != "password" && k != "key" && k != "auth-key" {
355+
entry[k] = v
356+
}
357+
}
358+
input.Job.CredentialsMetadata = append(input.Job.CredentialsMetadata, entry)
359+
}
346360

361+
if hasLocalAzureToken && azureRepo != nil {
347362
// Add the Azure Artifacts credentials for each host if the package manager is supported.
348363
if _, ok := azureArtifactsPackageManagerCredentialType[input.Job.PackageManager]; ok {
349364
// All Azure Artifacts hosts
@@ -363,19 +378,6 @@ func processInput(input *model.Input, flags *UpdateFlags) {
363378
log.Printf("Skipping Azure Artifacts credentials for %s package manager.", input.Job.PackageManager)
364379
}
365380
}
366-
367-
// Calculate the credentials-metadata as it cannot be provided by the user anymore.
368-
input.Job.CredentialsMetadata = []model.Credential{}
369-
for _, credential := range input.Credentials {
370-
entry := make(map[string]any)
371-
for k, v := range credential {
372-
// Updater does not get credentials.
373-
if k != "username" && k != "token" && k != "password" && k != "key" && k != "auth-key" {
374-
entry[k] = v
375-
}
376-
}
377-
input.Job.CredentialsMetadata = append(input.Job.CredentialsMetadata, entry)
378-
}
379381
}
380382

381383
func doesStdinHaveData() bool {

0 commit comments

Comments
 (0)