You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Bitbucket API触发带参Pipeline时build_number未生效如何解决

问题原因

Bitbucket Cloud v2 API 要求传递自定义变量时必须显式指定secured字段,标识该变量是否为加密变量。你未传递该字段时,平台默认将变量识别为加密类型,和你YAML配置中声明的普通明文变量无法匹配,因此参数不会被注入到流水线环境。

修复方案

在variables数组的每个变量对象中添加"secured": false字段,和你YAML中定义的普通变量类型对齐即可。

修正后的调用示例
curl -X POST -is -u user:pass \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/user/repo/pipelines/ \
-d '
{
  "target": {
    "ref_type": "branch",
    "type": "pipeline_ref_target",
    "ref_name": "feature/pipeline-tests",
    "selector": {
      "type": "custom",
      "pattern" : "test-deployment"
    }
  },
  "variables": [
    {
      "key" : "build_number",
      "value" : "202",
      "secured": false
    }
  ]
}'

内容的提问来源于stack exchange,提问作者user9671932

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 01:45:02