fix: allow separate Bitbucket REST username for API-token GitOps auth#6975
Open
atiquefiroz wants to merge 1 commit into
Open
fix: allow separate Bitbucket REST username for API-token GitOps auth#6975atiquefiroz wants to merge 1 commit into
atiquefiroz wants to merge 1 commit into
Conversation
Bitbucket deprecated app passwords (CHANGE-3222); git-over-HTTPS now
returns HTTP 410. Their replacement, API tokens, authenticate the two
surfaces Devtron uses with different usernames:
- git-over-HTTPS (go-git): the Bitbucket username (or
x-bitbucket-api-token-auth)
- Bitbucket Cloud REST API: the Atlassian account email
A single GitOps deploy uses both -- go-git clone/push for the chart, and
the REST API (WriteFileBlob) to commit values -- but gitops_config stores
a single username. With an API token no single username satisfies both:
the Bitbucket username fails REST with 401, and the email fails git with
exit status 128. App passwords worked for both surfaces, which is why
this only surfaces after the deprecation.
Add an optional BITBUCKET_REST_USERNAME env override, applied only to the
Bitbucket REST client. When unset, behaviour is unchanged. When set to
the Atlassian email, REST calls (repo create, WriteFileBlob, GetCommits,
repo-exists) authenticate correctly while go-git keeps using the
configured GitOps username, so both surfaces work with a single API token.
Signed-off-by: Atique Firoz <atiquefiroz@gmail.com>
|
Bito Review Skipped - Source Branch Not Found |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Bitbucket deprecated app passwords (CHANGE-3222); git-over-HTTPS now returns HTTP 410. Their replacement, API tokens, authenticate the two surfaces Devtron uses with different usernames:
A single GitOps deploy uses both -- go-git clone/push for the chart, and the REST API (WriteFileBlob) to commit values -- but gitops_config stores a single username. With an API token no single username satisfies both: the Bitbucket username fails REST with 401, and the email fails git with exit status 128. App passwords worked for both surfaces, which is why this only surfaces after the deprecation.
Add an optional BITBUCKET_REST_USERNAME env override, applied only to the Bitbucket REST client. When unset, behaviour is unchanged. When set to the Atlassian email, REST calls (repo create, WriteFileBlob, GetCommits, repo-exists) authenticate correctly while go-git keeps using the configured GitOps username, so both surfaces work with a single API token.
Description
Fixes #
Checklist:
Does this PR introduce a user-facing change?