]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
gitlab-ci: allow specifying base and tip in build test
authorWei Liu <wei.liu2@citrix.com>
Wed, 15 May 2019 10:00:38 +0000 (11:00 +0100)
committerWei Liu <wei.liu2@citrix.com>
Wed, 15 May 2019 10:01:06 +0000 (11:01 +0100)
We will soon provide this new capability to humans and automated
systems.

The default behaviour is retained: tip and base are passed by Gitlab
CI.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
automation/gitlab-ci/build-each-commit.sh
automation/gitlab-ci/test.yaml

index 879028b5a71d13230c34bb4835bc063661c1055d..19e337b46818b2ad1e3b4cb9e30163616d613494 100755 (executable)
@@ -1,18 +1,18 @@
 #!/bin/bash
 
 # For a newly pushed branch the BEFORE_SHA will be all 0s
-if [[ ${CI_COMMIT_BEFORE_SHA} == 0000000000000000000000000000000000000000 ]]; then
+if [[ ${BASE} == 0000000000000000000000000000000000000000 ]]; then
     echo "Newly pushed branch, skipped"
     exit 0
 fi
 
-git merge-base --is-ancestor ${CI_COMMIT_BEFORE_SHA} ${CI_COMMIT_SHA}
+git merge-base --is-ancestor ${BASE} ${TIP}
 if [[ $? -ne 0 ]]; then
-    echo "${CI_COMMIT_SHA} is not a descendent of ${CI_COMMIT_BEFORE_SHA}, skipped"
+    echo "${TIP} is not a descendent of ${BASE}, skipped"
     exit 0
 fi
 
-echo "Building ${CI_COMMIT_BEFORE_SHA}..${CI_COMMIT_SHA}"
+echo "Building ${BASE}..${TIP}"
 
-NON_SYMBOLIC_REF=1 ./automation/scripts/build-test.sh ${CI_COMMIT_BEFORE_SHA} ${CI_COMMIT_SHA} \
+NON_SYMBOLIC_REF=1 ./automation/scripts/build-test.sh ${BASE} ${TIP} \
     bash -c "git clean -ffdx && ./automation/scripts/build"
index 7ba20a51da800917cda4668e60d4f251560a69b1..793feafe8bf75cbb61e062ab5a322a7dfe134e4a 100644 (file)
@@ -7,7 +7,7 @@ build-each-commit-gcc:
     XEN_TARGET_ARCH: x86_64
     CC: gcc
   script:
-    - ./automation/gitlab-ci/build-each-commit.sh 2>&1 | tee ../build-each-commit-gcc.log
+    - BASE=${BASE_SHA:-${CI_COMMIT_BEFORE_SHA}} TIP=${TIP_SHA:-${CI_COMMIT_SHA}} ./automation/gitlab-ci/build-each-commit.sh 2>&1 | tee ../build-each-commit-gcc.log
     - mv ../build-each-commit-gcc.log .
   artifacts:
     paths: