在 Bitbucket Agentic Pipelines 中使用 Codex
流水线中设置 provider: codex,并通过 config.path 指定配置。生成的 .codex/config.toml 由 Pipelines 管理。
Bitbucket Agentic Pipelines 必须写 provider: codex,默认镜像用 atlassian/default-image:5。这是 Bitbucket Cloud 的开放 beta:Workspace settings → AI → AI features,打开 Agentic Pipelines。Codex 是 bring-your-own account,走 Third-Party Product:源码、提示和日志会去 OpenAI。密钥只放仓库安全变量,不要写进 YAML 或 prompt。不要把本机 codex login 抄进流水线。
最小骨架:
image: atlassian/default-image:5
definitions:
agents:
my-agent:
prompt: "Explain this repository"
provider: codex
permissions:
on-ask: allow
pipelines:
default:
- step:
name: Codex agent
auth:
system:
scopes:
- read:pullrequest:bitbucket
script:
- agent: my-agent
不写 provider: codex 就默认 Rovo Dev。适配器要 OpenSSL 3,官方默认镜像是 atlassian/default-image:5。容器里可跑 codex doctor。
自定义配置用 config.path 指向仓库里的 TOML,例如 .codex/atlassian-mcp.toml 或 codex-config-overrides.toml。也可以在 YAML 写 config.overrides。合并顺序:系统底稿 → config.path → config.overrides → 系统强制项,后者赢。Pipelines 合并后写到生成的 .codex/config.toml 并加入 git exclude——不要提交这份生成文件。
Agentic Pipelines 默认 sandbox_mode = danger-full-access,approval_policy = on-request。非交互流水线用 permissions.on-ask: allow 或 deny 代答批准。要收紧就在 overrides 里改 workspace-write / read-only。
额外 MCP 写 TOML [mcp_servers.NAME],不要 .mcp.json。Bitbucket Cloud MCP 自动注入,不要自己 mcp add。写 PR / 评论先在 step 的 auth.system.scopes 开最小权限。Apps / connectors 默认关;真要才 [features] apps = true。
流水线里接 Jira / Confluence,官方示例是 https://mcp.atlassian.com/v1/native/mcp,再用 env_http_headers 把 Authorization 映射到仓库密钥 ATLASSIAN_MCP_AUTH(值为 Basic + email:token 的 base64)。不要在流水线 mcp login。这和本机 TIP 的 v2/mcp + OAuth DCR 不是一条路,不要叠成一台,也不要把 v2/mcp 抄进 pipelines。
[mcp_servers.atlassian-mcp]
url = "https://mcp.atlassian.com/v1/native/mcp"
[mcp_servers.atlassian-mcp.env_http_headers]
Authorization = "ATLASSIAN_MCP_AUTH"
这里 Authorization 走整段 Basic,所以用 env_http_headers,不要改成 bearer_token_env_var。不要当发布门禁:官方写明结果非确定性,要人审。