We must use the target branch as a reference when we try to find the
number of commits pushed.
We use 'ghprbTargetBranch' env variable, which comes from jenkins's
injectedEnvVars.
Signed-off-by: Sébastien Han <seb@redhat.com>
set -e
# the following two methods exist in scripts/build_utils.sh
+# shellcheck disable=SC2034
pkgs=( "ansible==2.3.1" "ansible-lint" )
install_python_packages "pkgs[@]"
}
function test_sign_off {
- test "$(git log --oneline origin/HEAD..HEAD | wc -l)" -ne "$(git log origin/HEAD..HEAD | grep -c Signed-off-by)" && echo "One or more commits is/are missing a Signed-off-by. Add it with 'git commit -s'."
+ git fetch
+ # shellcheck disable=SC2154
+ test "$(git log --oneline origin/"${ghprbTargetBranch}"..HEAD | wc -l)" -ne "$(git log origin/"${ghprbTargetBranch}"..HEAD | grep -c Signed-off-by)" && echo "One or more commits is/are missing a Signed-off-by. Add it with 'git commit -s'."
return 1
}