Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass Azure Artifacts credentials after credential metadata is added #291

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions cmd/dependabot/internal/cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,22 @@ func processInput(input *model.Input, flags *UpdateFlags) {
"host": "dev.azure.com",
})
}
}

// Calculate the credentials-metadata as it cannot be provided by the user anymore.
input.Job.CredentialsMetadata = []model.Credential{}
for _, credential := range input.Credentials {
entry := make(map[string]any)
for k, v := range credential {
// Updater does not get credentials.
if k != "username" && k != "token" && k != "password" && k != "key" && k != "auth-key" {
entry[k] = v
}
}
input.Job.CredentialsMetadata = append(input.Job.CredentialsMetadata, entry)
}

if hasLocalAzureToken && azureRepo != nil {
// Add the Azure Artifacts credentials for each host if the package manager is supported.
if _, ok := azureArtifactsPackageManagerCredentialType[input.Job.PackageManager]; ok {
// All Azure Artifacts hosts
Expand All @@ -363,19 +378,6 @@ func processInput(input *model.Input, flags *UpdateFlags) {
log.Printf("Skipping Azure Artifacts credentials for %s package manager.", input.Job.PackageManager)
}
}

// Calculate the credentials-metadata as it cannot be provided by the user anymore.
input.Job.CredentialsMetadata = []model.Credential{}
for _, credential := range input.Credentials {
entry := make(map[string]any)
for k, v := range credential {
// Updater does not get credentials.
if k != "username" && k != "token" && k != "password" && k != "key" && k != "auth-key" {
entry[k] = v
}
}
input.Job.CredentialsMetadata = append(input.Job.CredentialsMetadata, entry)
}
}

func doesStdinHaveData() bool {
Expand Down