Jenkins:在 shell 中访问 bitbucket 有效负载

标签 jenkins environment-variables bitbucket webhooks payload

根据 Jenkins ( https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin ) 的 bitbucket 插件的文档,应该可以通过环境变量 $BITBUCKET_PAYLOAD 访问有效负载信息。
但是,在我的构建中运行命令 printenv 时,没有名为 $BITBUCKET_PAYLOAD 的环境变量,也没有与之相关的任何内容。
因此,我无法访问配置构建所需的信息。

最佳答案

您可以使用 Generic Webhook Trigger 触发 Jenkins反而。

然后你可以创建一个变量 everything拥有 JSONPath $ .然后everything将解析为整个 JSON 有效负载。所以你可以有一个 shell 脚本构建步骤,如:

echo $everything

关于Jenkins:在 shell 中访问 bitbucket 有效负载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38426826/

相关文章:

php - 如何在不使用路径的情况下设置 GOOGLE_APPLICATION_CREDENTIALS

git - Jenkins 无法连接到存储库

node.js - 如何获取在 Jenkins 参数化作业中传递的代码中的参数

jenkins - Jenkins 的工作可以在不占用插槽的情况下等待结果吗

jenkins - 如何在 Jenkins 失败时运行任务?

cmd - Chocolatey Ngrok.portable 不工作

javascript - Jest + process.env.NODE_ENV 未正确测试

git - 有没有办法将 azure synapse studio 连接到 bitbucket repo?

bitbucket - AWS Code PipeLine 未获取 BitBucket 帐户的所有存储库

docker - 如何指定在 Jenkinsfile 中安装了 docker 的节点类型?