aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-01 15:41:33 -0500
committerGitHub <noreply@github.com>2021-02-01 15:41:33 -0500
commit0ba47f71c0dd829114666d13776792f748682be3 (patch)
tree9795329ac9fbdd32b54e22babaa3484ebd934fee /contrib
parent745fa4ac94c3ec99becd85f59d1b59c2c9765527 (diff)
parent545eeca8ea3d8736ec8646a6cd27d94b9a61e2c7 (diff)
downloadpodman-0ba47f71c0dd829114666d13776792f748682be3.tar.gz
podman-0ba47f71c0dd829114666d13776792f748682be3.tar.bz2
podman-0ba47f71c0dd829114666d13776792f748682be3.zip
Merge pull request #9179 from cevich/v3.0_fix_validate
[v3.0] Cirrus: Fix running Validate task on branches
Diffstat (limited to 'contrib')
-rw-r--r--contrib/cirrus/lib.sh17
-rwxr-xr-xcontrib/cirrus/runner.sh23
-rwxr-xr-xcontrib/cirrus/setup_environment.sh1
3 files changed, 20 insertions, 21 deletions
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index bc9a95310..451a267b3 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -80,10 +80,19 @@ CIRRUS_CI="${CIRRUS_CI:-false}"
DEST_BRANCH="${DEST_BRANCH:-master}"
CONTINUOUS_INTEGRATION="${CONTINUOUS_INTEGRATION:-false}"
CIRRUS_REPO_NAME=${CIRRUS_REPO_NAME:-podman}
-# N/B: CIRRUS_BASE_SHA is empty on branch and tag push.
-CIRRUS_BASE_SHA=${CIRRUS_BASE_SHA:-${CIRRUS_LAST_GREEN_CHANGE:-YOU_FOUND_A_BUG}}
-CIRRUS_BUILD_ID=${CIRRUS_BUILD_ID:-$RANDOM$(date +%s)} # must be short and unique
-
+# Cirrus only sets $CIRRUS_BASE_SHA properly for PRs, but $EPOCH_TEST_COMMIT
+# needs to be set from this value in order for `make validate` to run properly.
+# When running get_ci_vm.sh, most $CIRRUS_xyz variables are empty. Attempt
+# to accomidate both branch and get_ci_vm.sh testing by discovering the base
+# branch SHA value.
+# shellcheck disable=SC2154
+if [[ -z "$CIRRUS_BASE_SHA" ]] && [[ -z "$CIRRUS_TAG" ]]
+then # Operating on a branch, or under `get_ci_vm.sh`
+ CIRRUS_BASE_SHA=$(git rev-parse ${UPSTREAM_REMOTE:-origin}/$DEST_BRANCH)
+elif [[ -z "$CIRRUS_BASE_SHA" ]]
+then # Operating on a tag
+ CIRRUS_BASE_SHA=$(git rev-parse HEAD)
+fi
# The starting place for linting and code validation
EPOCH_TEST_COMMIT="$CIRRUS_BASE_SHA"
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index 6e6747f28..48df57ad8 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -23,18 +23,6 @@ function _run_ext_svc() {
$SCRIPT_BASE/ext_svc_check.sh
}
-function _run_smoke() {
- make gofmt
-
- # There is little value to validating commits after tag-push
- # and it's very difficult to automatically determine a starting commit.
- # $CIRRUS_TAG is only non-empty when executing due to a tag-push
- # shellcheck disable=SC2154
- if [[ -z "$CIRRUS_TAG" ]]; then
- make .gitvalidation
- fi
-}
-
function _run_automation() {
$SCRIPT_BASE/cirrus_yaml_test.py
@@ -47,11 +35,14 @@ function _run_automation() {
}
function _run_validate() {
- # Confirm compile via prior task + cache
- bin/podman --version
- bin/podman-remote --version
+ # git-validation tool fails if $EPOCH_TEST_COMMIT is empty
+ # shellcheck disable=SC2154
+ if [[ -n "$EPOCH_TEST_COMMIT" ]]; then
+ make validate
+ else
+ warn "Skipping git-validation since \$EPOCH_TEST_COMMIT is empty"
+ fi
- make validate # Some items require a build
}
function _run_unit() {
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index 7b49caba0..85235790a 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -181,7 +181,6 @@ esac
# shellcheck disable=SC2154
case "$TEST_FLAVOR" in
ext_svc) ;;
- smoke) ;&
validate)
# For some reason, this is also needed for validation
make .install.pre-commit