Skip to content

fix(bitbucket): send the archive credential as a header - #130

Merged
HarshMN2345 merged 1 commit into
mainfrom
fix/bitbucket-archive-headers
Aug 7, 2026
Merged

fix(bitbucket): send the archive credential as a header#130
HarshMN2345 merged 1 commit into
mainfrom
fix/bitbucket-archive-headers

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

Follows #129, which added the wrong abstraction. A Bitbucket deployment still never builds.

Cause

getRepositoryPresignedUrl() puts the token in the url as basic userinfo. Bitbucket's archive host takes no credential that way — it answers a redirect to a login page, the fetch lands empty, and the deployment waits on a build that never starts. Nothing errors.

Measured against production with the real stored token:

request result
x-token-auth:<oauth>@bitbucket.org/…/get/main.tar.gz 302, 0 bytes
?access_token=<oauth> 403
Authorization: Bearer <oauth> 200, 161267 bytes
Authorization: Basic <email:token> 200, 161267 bytes

Only a header authenticates that host, and it works for both credential shapes the adapter handles.

Change

The url is handed over plain and getRepositoryPresignedUrlHeaders() says what to send beside it. authorizationHeader() already picks Bearer or Basic per credential, so both are covered.

authenticatedBitbucketUrl() stays for generateCloneCommand() — the git endpoint does accept a credential in the url.

This replaces supportsAuthenticatedArchiveUrl() from #129: what a caller needs is the headers to send, not whether the url stands alone. Routing around the archive fetch doesn't work — the builds worker clones only to push a template commit, then hands off through the same url.

Follow-up

Appwrite passes these headers into the source DownloadArtifact, which already accepts them.

Bitbucket's archive host takes no credential from the url. A token offered
as basic userinfo is answered with a redirect to a login page, so the fetch
lands empty and the deployment waits on a build that never starts.

The same host accepts the credential as a header, so the url is handed over
plain and the header travels beside it. Its git endpoint still takes the
credential in the url, which is where cloning leaves it.

Replaces the capability added a commit ago: what a caller needs is the
headers to send, not whether the url stands alone.
@HarshMN2345
HarshMN2345 merged commit abdb576 into main Aug 7, 2026
8 checks passed
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.

1 participant