Git curl中的Bitbucket管道变量
我正在使用bitbucket管道,在一个步骤中,我想调用API的curl请求,将部署数据保存在DB中 但是,当我尝试使用BITBUCKET\u分支和BITBUCKET\u REPO\u SLUG变量调用curl时,它们总是空的,或者根本没有填充Git curl中的Bitbucket管道变量,git,shell,bitbucket,bitbucket-pipelines,Git,Shell,Bitbucket,Bitbucket Pipelines,我正在使用bitbucket管道,在一个步骤中,我想调用API的curl请求,将部署数据保存在DB中 但是,当我尝试使用BITBUCKET\u分支和BITBUCKET\u REPO\u SLUG变量调用curl时,它们总是空的,或者根本没有填充 image: php:7.1.1 pipelines: branches: master: - step: name: Preparing pipeline script: - e
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:
name: Deploy to dev1
trigger: manual
deployment: staging
script:
- cat ./deploy_dev1.sh | ssh root@37.41.82.255
这是我从管道中得到的回应
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
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
<!DOCTYPE html><!--
Illuminate\Database\QueryException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'branch' cannot be null (SQL: insert into `branch` (`branch`, `repository_slug`, `updated_at`, `created_at`) values (, , 2019-04-02 08:38:02, 2019-04-02 08:38:02)) in file /home/api/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 664
Stack trace:
curl-X POST”http://api.url.com/api/savePipelineBranch“-H”内容类型:应用程序/x-www-form-urlencoded“-H”缓存控制:无缓存“-H”内容类型:多部分/表单数据;“-F branch=${branch}-F repository\u slug=$BITBUCKET\u REPO\u slug”
%总接收百分比%x平均速度时间电流
数据加载上载总左速度
尝试使用
curl -d "{\"branch\":\"$BITBUCKET_BRANCH\",\"repository_slug\":\"$BITBUCKET_REPO_SLUG\"}" -H "Content-Type:application/json" -X POST http://api.url.com/api/savePipelineBranch
发布您从管道中得到的确切错误可能有助于您是正确的:)我编辑了一个问题您可以共享来自本地计算机的工作curl请求吗?这真的会有帮助:)