]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-ansible-pr-syntax-check: use target branch to compare 1067/head
authorSébastien Han <seb@redhat.com>
Tue, 3 Jul 2018 08:26:43 +0000 (10:26 +0200)
committerSébastien Han <seb@redhat.com>
Tue, 3 Jul 2018 08:33:29 +0000 (10:33 +0200)
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>
ceph-ansible-pr-syntax-check/build/build

index e5b3301c7c1abb632e912296cce37c67b055e382..2be7439a85640515878dfe45d17dfbb9aba035e7 100644 (file)
@@ -3,6 +3,7 @@
 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[@]"
 
@@ -47,7 +48,9 @@ function group_vars_check {
 }
 
 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
 }