以下是一个示例脚本,可以将其添加到Bamboo构建任务中:
#!/bin/bash
# Use Git to get the SHA of the desired commit that triggered the build
cd /path/to/repo
commit=$(git ls-remote {bitbucket_repo_url} refs/heads/{branch_name} | grep refs/heads/{branch_name} | cut -f 1)
# Run the build only if the commit matches the desired SHA
if [ "$commit" == "{desired_commit_sha}" ]; then
exit 0
else
echo "Not building - commit SHA does not match desired SHA"
exit 1
fi
上一篇:Bamboo的日历插件未显示项目
下一篇:Bamboo构建卡在了20分钟。