我正在使用 bitbucket 管道,并且在一个步骤中,我想向我们的 API 调用 curl 请求以将部署数据保存在数据库中。
但是当我尝试使用 BITBUCKET_BRANCH 和 BITBUCKET_REPO_SLUG 变量调用 curl 时,它们总是空的或根本没有填充。
image: php:7.1.1
pipelines:
branches:
master:
- step:
name: Preparing pipeline
script:
- echo 'Preparing pipeline'
- step:
name: Deploy to dev10
trigger: manual
deployment: staging
script:
- cat ./deploy.sh | ssh root@37.42.83.244
dev1/*:
- step:
name: Preparing pipeline
script:
- echo 'Preparing pipeline'
- export BRANCH=$BITBUCKET_BRANCH
- echo ${BRANCH}
- curl -X POST "http://api.url.com/api/savePipelineBranch" -H "Content-Type:application/x-www-form-urlencoded" -H "cache-control:no-cache" -H "content-type:multipart/form-data;" -F branch=${BRANCH} -F repository_slug=$BITBUCKET_REPO_SLUG
- step: …Run Code Online (Sandbox Code Playgroud)