Skip to content

Fix handling of force option in databricks_git_credential #4873

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alexott
Copy link
Contributor

@alexott alexott commented Jul 24, 2025

With introduction of support for multiple Git credentials the error message did change a bit, so the force option may not work in all cases.

Resolves #4871

Changes

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • using Go SDK
  • using TF Plugin Framework
  • has entry in NEXT_CHANGELOG.md file

With introduction of support for multiple Git credentials the error message did change a
bit, so the `force` option may not work in all cases.

Resolves #4871
@alexott alexott requested review from a team as code owners July 24, 2025 06:37
@alexott alexott requested review from parthban-db and removed request for a team July 24, 2025 06:37
@alexott alexott temporarily deployed to test-trigger-is July 24, 2025 06:37 — with GitHub Actions Inactive
@alexott alexott temporarily deployed to test-trigger-is July 24, 2025 06:38 — with GitHub Actions Inactive
@alexott alexott requested a review from renaudhartert-db July 24, 2025 06:44
@alexott alexott temporarily deployed to test-trigger-is July 24, 2025 12:14 — with GitHub Actions Inactive
@alexott alexott requested a review from renaudhartert-db July 24, 2025 12:15
@alexott alexott temporarily deployed to test-trigger-is July 24, 2025 12:15 — with GitHub Actions Inactive
func isOnlyOneGitCredentialError(err error) bool {
errStr := err.Error()
return errors.Is(err, apierr.ErrResourceConflict) ||
(strings.Contains(errStr, "Only one Git credential is supported ") && strings.Contains(errStr, " at this time"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the old error message. Are you intending to parse the new one for SPs + multiple git creds? https://sourcegraph.prod.databricks-corp.com/databricks-eng/universe/-/blob/projects/main/scala/credentials/messages/GitCredentialsMessages.scala?L10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main question here is - can we rely only on HTTP 409, or do we still need to rely on error messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case for single credential for SP is handled now via errors.Is(err, apierr.ErrResourceConflict)

Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/terraform

Inputs:

  • PR number: 4873
  • Commit SHA: e6f70d3cbaae03a3a42f840abc12c10581020ae9

Checks will be approved automatically on success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ISSUE] Issue with databricks_git_credential resource
3 participants