【问题标题】:How do I detect that gerrit change needs rebasing on Jenkins?我如何检测到 gerrit 更改需要基于 Jenkins 重新调整?
【发布时间】:2017-11-16 22:35:03
【问题描述】:
【问题讨论】:
标签:
git
jenkins
gerrit
git-review
【解决方案1】:
这个失败的尝试:
#!/bin/bash
set -exo pipefail
# fast-fail if gerrit change is not rebased
if [ -z ${GERRIT_PROJECT+x} ]; then
pushd $GERRIT_PROJECT
MERGE_BASE=$(git merge-base HEAD origin/$GERRIT_BRANCH)
git rebase
[ "$MERGE_BASE" == "$(git merge-base HEAD origin/$GERRIT_BRANCH)" ] || {
echo "FATAL: Please rebase $GERRIT_CHANGE_URL change request before testing it."
exit 101
}
popd
fi
不知何故,这在使用管道的某些工作上有效,但在其他工作上却失败了,我怀疑是由于不同的结帐方法。因此,仍在寻找可靠的方法。