[FF] `routable_deploy_token` -- Make deploy tokens routable
## Summary
Roll out [the feature](https://gitlab.com/gitlab-org/gitlab/-/work_items/597463) currently behind the `routable_deploy_token` feature flag.
With the flag on, new deploy tokens are minted in the [routable token](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/routable_tokens/) format, with `c`, `o`, and `p` or `g`. That lets the HTTP Router route a deploy token minted on a cell other than the Legacy Cell back to that cell. The flag actor is the top-level namespace of the token's project or group. Introduced in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/262950.
- DRI: @rajatgupta10
- Team Slack channel: `#<TBD: cells infrastructure team channel>`
> [!note]
> Process and guidance live in the docs — this issue is just the commands and a place to track the rollout.
> "Rolling out" means incrementally enabling the flag on GitLab.com to validate stability — it is not the same as releasing the feature, which happens when the flag is removed.
> [Feature flag controls](https://docs.gitlab.com/development/feature_flags/controls/) · [Feature flag lifecycle](https://handbook.gitlab.com/handbook/product-development/how-we-work/product-development-flow/feature-flag-lifecycle/#feature-flag-lifecycle)
## What could go wrong?
- **Customer tooling that assumes the old length.** A routable deploy token is about 60–70 characters instead of 25. Tooling with a fixed-length check or a fixed-size secret store could reject it. The blast radius is new deploy tokens only, and existing tokens are unchanged.
- **Secret detection outside GitLab.** The client-side pattern is updated in the MR, but external scanners (`secret-detection-rules`, Tokinator) need checking for the longer format before going to 100% on GitLab.com.
- **Authentication.** Rails stores and compares the whole token and never decodes the payload, so authentication is unchanged. Specs cover Basic auth, the API and registry `/jwt/auth` with routable tokens.
- **Rollback is safe.** Turning the flag off only changes new tokens. Tokens minted while it was on keep authenticating.
What to watch: deploy-token authentication failures, i.e. `JWT authentication failed` log lines from `JwtController` with `auth_result.type` set to a deploy token, plus general registry and Git authentication error rates.
## Events
- [Exceptions with routable_deploy_token:1](https://log.gprd.gitlab.net/app/discover#/?_g=(time:(from:now-1d,to:now))&_a=(index:'7092c4e2-4eb5-46f2-8305-a7da2edad090',query:(language:kuery,query:'json.exception.feature_flag_states.keyword:%22routable_deploy_token:1%22'),columns:!(json.exception.class,json.exception.message,json.extra.workflow_id,json.meta.caller_id),sort:!(!(json.time,desc))))
- [Events with routable_deploy_token:1](https://log.gprd.gitlab.net/app/discover#/?_g=(time:(from:now-1d,to:now))&_a=(index:'7092c4e2-4eb5-46f2-8305-a7da2edad090',query:(language:kuery,query:'json.feature_flag_states:%22routable_deploy_token:1%22'),columns:!(json.meta.caller_id,json.feature_flag_states),sort:!(!(json.time,desc))))
- [Error rate and other graphs by modifying the examples in the Visualization Library](https://log.gprd.gitlab.net/app/visualize#/?_g=h@358d019&s=FF%20Observability)
Feature Flag events are only logged by default for feature flags marked for the current or future milestones. To enable while the feature flag is active, see https://docs.gitlab.com/development/feature_flags/#logging
## Rollout
Run all production `/chatops` in [`#production`](https://gitlab.slack.com/archives/C101F3796) and cross-post the results to `#<TBD>`. Background: [incremental rollout process](https://docs.gitlab.com/development/feature_flags/controls/#process), [feature actors](https://docs.gitlab.com/development/feature_flags/#feature-actors).
Flag state is stored per cell (`feature_gates` is `gitlab_main_cell_local`). ChatOps only changes the Legacy Cell, so each non-Legacy cell is enabled separately.
**Non-production**
1. **Staging non-Legacy cell: check routing.**
- [ ] Gate: the HTTP Router routes the `Deploy-Token` header, https://gitlab.com/gitlab-com/gl-infra/tenant-scale/cells-infrastructure/team/-/work_items/1046.
- [ ] Enable `routable_deploy_token` on the staging cell. Method: TBD (Membrane, admin API or console).
- [ ] Create a deploy token on the cell, decode it, and confirm `c` is the cell's ID.
- [ ] `curl -i -u '<username>:<token>' 'https://<staging host>/jwt/auth?service=container_registry&offline_token=true'` returns `200` from the cell. Router logs show `ruleApplied: session_token_header_authorization_basic_routable_token` with the cell as the target. Router logs: TBD.
- [ ] Negative check: with the flag off, a newly minted token falls back to the Legacy Cell and gets a `401`.
- [ ] `git clone` over HTTPS with the token works.
2. **Staging Legacy Cell and other non-production environments: check the format and authentication.**
```
/chatops gitlab run feature set routable_deploy_token true --dev --pre --staging --staging-ref
```
- [ ] New deploy tokens are in the routable format.
- [ ] `git clone`, `docker login`/`pull`/`push` against the staging registry, and a package pull work with the token.
- [ ] The comment secret-detection warning lists the token as `GitLab Deploy Token (routable)`.
- [ ] A pipeline that uses `CI_DEPLOY_PASSWORD` (`gitlab-deploy-token`) masks the token in job logs.
**Production**: target a group first, then a percentage rollout (wait at least 15 minutes between steps and watch the dashboards):
- [ ] Gate before the first customer namespace: server-side secret detection detects routable deploy tokens, https://gitlab.com/gitlab-org/gitlab/-/work_items/636657.
```
/chatops gitlab run feature set --group=<TBD: GitLab-owned test group> routable_deploy_token true
/chatops gitlab run feature set routable_deploy_token 25 --actors
/chatops gitlab run feature set routable_deploy_token 50 --actors
/chatops gitlab run feature set routable_deploy_token true
```
A `--group` step does not cover deploy tokens of projects in personal namespaces, whose actor is a `Namespaces::UserNamespace`. The `--actors` percentages and the global step do.
- [ ] Gate before any non-Legacy cell: the HTTP Router routes the `Deploy-Token` header, https://gitlab.com/gitlab-com/gl-infra/tenant-scale/cells-infrastructure/team/-/work_items/1046.
- [ ] Production non-Legacy cells: enable on each cell. Method: TBD.
## Before global rollout
Confirm the relevant gotchas before going to 100% — see [enabling a feature for GitLab.com](https://docs.gitlab.com/development/feature_flags/controls/#enabling-a-feature-for-gitlabcom):
- [ ] [Docs + version history](https://docs.gitlab.com/development/documentation/feature_flags/) updated. The token docs only list the `gldt-` prefix. Decide whether to document the longer format.
- [ ] [Breaking changes](https://docs.gitlab.com/development/documentation/release_notes/#deprecations-removals-and-breaking-changes) announced, if any. Decide whether the longer token length needs an announcement. The routable PAT rollout (`routable_pat`) is the precedent.
- [ ] [Change management issue](https://handbook.gitlab.com/handbook/engineering/infrastructure-platforms/change-management/#feature-flags-and-the-change-management-process) opened, if required.
- [ ] Server-side secret detection: covered by https://gitlab.com/gitlab-org/gitlab/-/work_items/636657 (gated above).
- [x] [External API consumers](https://docs.gitlab.com/development/feature_flags/#do-not-use-feature-flags-in-external-api-consumers): not applicable. The flag is only checked in Rails when a token is minted.
## Cleanup
Remove the flag once [deemed stable](https://handbook.gitlab.com/handbook/product-development/how-we-work/product-development-flow/feature-flag-lifecycle/#feature-flag-lifecycle) — see [cleaning up](https://docs.gitlab.com/development/feature_flags/controls/#cleaning-up). Track it here, or open a follow-up [Feature Flag Cleanup issue](https://gitlab.com/gitlab-org/gitlab/-/work_items/new?description_template=Feature%20Flag%20Cleanup). Remove the flag and its YAML definition from the codebase, then:
```
/chatops gitlab run release check <merge-request-url> <milestone>
/chatops gitlab run feature delete routable_deploy_token --dev --pre --staging --staging-ref --production
```
Removing the flag makes deploy tokens always routable. That MR gets the `Changelog: changed` entry.
## Rollback
```
/chatops gitlab run feature set routable_deploy_token false # production
/chatops gitlab run feature set routable_deploy_token false --dev --pre --staging --staging-ref # non-production
/chatops gitlab run feature delete routable_deploy_token --dev --pre --staging --staging-ref --production # remove entirely
```
On non-Legacy cells, turn the flag off with the same per-cell method used to enable it. Tokens already minted in the routable format keep working after rollback.
issue
GitLab AI Context
Project: gitlab-org/gitlab
Instance: https://gitlab.com
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://gitlab.com/gitlab-org/gitlab/-/raw/master/CONTRIBUTING.md — contribution guidelines
- https://gitlab.com/gitlab-org/gitlab/-/raw/master/README.md — project overview and setup
- https://gitlab.com/gitlab-org/gitlab/-/raw/master/AGENTS.md — AI agent instructions
- https://gitlab.com/gitlab-org/gitlab/-/raw/master/CLAUDE.md — Claude Code instructions
Repository: https://gitlab.com/gitlab-org/gitlab
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD