Skip to content

feat(coder): clone GitLab, Bitbucket and Azure DevOps repos in coder_prepare_repo - #703

Merged
artempartos merged 1 commit into
developfrom
artempartos/coder-prepare-repo-providers
Nov 11, 2026
Merged

artempartos merged 1 commit into
developfrom
artempartos/coder-prepare-repo-providers

Conversation

@artempartos

@artempartos artempartos commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

coder_prepare_repo cloned only GitHub and public repositories. Any GitLab,
Bitbucket or Azure DevOps repository attached to a session was refused with
<provider> repositories are not supported yet — only GitHub and public clones.
The platform already issues credentials for all four providers to session
containers. Only the Coder path minted its own GitHub token.

What changes

  • Coder::RepoBootstrap gets the credential from the same services that answer
    a session container's git: GitCredentials::Vendor for GitHub, GitLab and
    Bitbucket, and AzureDevops::GitCredentialService for Azure DevOps. The
    session must still hold the repository, and Azure's authorization chain
    (project, binding, scope) applies unchanged. prepare now takes session:.
  • GitHub, GitLab and Bitbucket use the existing credential.helper. Username and
    password now come from AIXLE_GIT_USERNAME / AIXLE_GIT_PASSWORD, so
    oauth2 and x-token-auth work as well as x-access-token.
  • Azure DevOps uses git --config-env=http.extraheader=AIXLE_GIT_AUTH_HEADER.
    An Entra token only works as a bearer header, and the helper protocol cannot
    carry one before git 2.46. This needs git 2.31+ on the workspace, which the
    guide now says.
  • In both modes the secret stays in the detached launcher's environment. It is
    not in argv, not in remote.origin.url and not in the job's command file.
  • Building the Azure Authorization header moved onto
    GitCredentialService::Vended#authorization_header, so the session clone and
    the Coder clone build it the same way.
  • Coder guide: Limits says what a GitLab, Bitbucket or Azure PAT exposes on a
    shared workspace (the connection's own token, not narrowed to one repository,
    readable from the clone process's environment while it runs). Troubleshooting
    entries were updated to match.

Verification

  • test/services/coder/repo_bootstrap_test.rb: new cases for GitLab (oauth2),
    Bitbucket (x-token-auth), Azure service principal (Bearer), Azure PAT
    (Basic, including the ref fetch), a repository the session does not hold,
    and Azure refusing to issue a credential.
  • coder_tools_test.rb, azure_devops/session_git_setup_test.rb,
    azure_git_credentials_test.rb, the changelog and docs-drift tests, rubocop
    and brakeman pass locally.
  • The generated script was run with real git 2.54 against a local HTTP server
    that logs Authorization. In helper mode the server saw an anonymous request,
    a 401, then Basic base64(oauth2:<token>). In header mode Bearer <token>
    was on the first request. Neither script contains the secret.
  • CI is the full-suite check.
  • Live check on a staging Coder workspace, without a deploy: the branch's
    RepoBootstrap ran in the staging app against its real integrations and a
    throwaway workspace created from the default template (git 2.50.1), which was
    deleted afterwards. Private repositories cloned with exit 0 for: GitLab with a
    PAT, GitLab with a service account, Bitbucket with an access token, Azure DevOps
    with a service principal (a repository whose names contain spaces, checked out
    with ref), and GitHub (regression). Re-running over an existing clone (the
    repair path) also worked. In every case the token was absent from the clone's
    .git and from the job directory, and origin holds the bare URL. A
    repository the session does not hold was refused.
  • Not checked live: Azure DevOps with a PAT. Staging has no PAT-mode Azure
    connection. That path is covered by a unit test and by the local
    real-git run above.

🤖 Generated with Claude Code

…prepare_repo

coder_prepare_repo minted a GitHub App token itself and refused every other
provider, although the platform already vends credentials for all four to
session containers. It now asks those same vendors (GitCredentials::Vendor,
AzureDevops::GitCredentialService), so the session still has to hold the
repository and Azure's authorization chain applies unchanged.

GitHub, GitLab and Bitbucket authenticate through the existing credential
helper, now fed username and password from the environment. Azure DevOps needs
a bearer header for Entra tokens, which the helper protocol cannot carry before
git 2.46, so it goes through --config-env=http.extraheader. Neither puts the
secret in argv or on the workspace disk.

Unlike the per-repository GitHub token, a GitLab, Bitbucket or Azure PAT is the
connection's own; the Coder guide's Limits now says what that exposes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit 0d037b6 into develop Nov 11, 2026
18 checks passed
@artempartos
artempartos deleted the artempartos/coder-prepare-repo-providers branch November 11, 2026 14:27
NOX73 added a commit that referenced this pull request Nov 11, 2026
…s-0-1-0

* origin/develop:
  feat(coder): clone GitLab, Bitbucket and Azure DevOps repos in coder_prepare_repo (#703)
  fix(agents): show each runtime's own logo everywhere (#704)
  feat(teams): assign cards to a team and run triggers as a team (#701)
  feat(agents): collect the Copilot CLI transcript as a session log (#700)
  fix(agents): keep Grok and Antigravity conversations in the terminal scrollback (#698)
  feat(billing): redesign the Billing tab around active and previous subscriptions (#646)
  feat(web): switch the UI, admin, public pages and emails to Inter (#699)
  chore(deps): weekly dependency batch — aws-sdk-core 3.267 retry fix, prism 2, Mantine 9.7.5, runner Go 1.27.4 (#697)
  fix(board): leave archived tasks out of agent board listings (#690)
  feat(agents): add GitHub Copilot CLI as an agent runtime (#684)
  feat(runners): the callback proxy — the proxy sidecar, the host runner relay and the gateway proxy route (task #216, 8b) (#677)

Signed-off-by: Rozhnov Alexandr <[email protected]>
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