0

Is it possible to create the repository and post service in one request. Here's what I currently have. I'm worried that the 2nd call might happen before the 1st is finished and fail.

curl -u$BB_USER:$BB_PASS -X POST https://api.bitbucket.org/1.0/repositories/ -d "name=$PROJECT_NAME" -d "owner=$BB_Owner" -d 'is_private=1' -d 'scm=git'
curl -u$BB_USER:$BB_PASS -X POST https://api.bitbucket.org/1.0/repositories/$BB_Owner/$PROJECT_FOLDER/services -d type=POST -d URL=$POST_HOOK_URL
4

1 回答 1

1

用 '&&' 链接它们,这样第二个命令只有在第一个命令成功完成时才会执行。

curl -u$BB_USER:$BB_PASS -X POST https://api.bitbucket.org/1.0/repositories/ -d "name=$PROJECT_NAME" -d "owner=$BB_Owner" -d 'is_private=1' -d 'scm=git' && curl -u$BB_USER:$BB_PASS -X POST https://api.bitbucket.org/1.0/repositories/$BB_Owner/$PROJECT_FOLDER/services -d type=POST -d URL=$POST_HOOK_URL
于 2013-08-17T01:43:44.467 回答