首页 > 解决方案 > Bitbucket API 更新管道变量

问题描述

我无法成功更新存储库变量,也不确定它为什么不起作用。

我已经能够通过 API 获取所有必要的 ID,并发出以下 curl 请求:

curl -X PUT "https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pipelines_config/variables/{variable_uuid}" -H 'Content-Type: application/json' -d '{"value":"{value}","key":"{name}"}'

从这里我得到:

{"type": "error", "error": {"message": "Resource not found"}}

有没有人知道我已经尝试改变我能想到的一切但没有运气

标签: bitbucketbitbucket-pipelinesbitbucket-api

解决方案


- curl -v -X PUT "https://api.bitbucket.org/2.0/repositories/$ORG_OR_WORKSPACE/$REPO/pipelines_config/variables/\{$HASH_VARIABLE\}" -H "Content-Type:application/json" -d "{\"key\":\"$VARIABLE_NAME\", \"value\":\"$VARIABLE_VALUE\" }" --user $PIPELINE_APP_PASS

实际的哈希需要用括号括{}起来\

尝试从终端运行命令以确保您可以更新变量。您可能想要创建一个具有访问权限的用户应用程序密码,应该是username:password


推荐阅读