aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2022-09-14 14:39:19 -0400
committerChris Evich <cevich@redhat.com>2022-09-29 13:06:01 -0400
commit0660f5b7a44ed12be8365bbca1f0e0018d742bb9 (patch)
tree5991542ea049916677a298ec7e9ea62a70aff5c4 /contrib
parent6c8a11b7460217d765611339e7df831582b2c250 (diff)
downloadpodman-0660f5b7a44ed12be8365bbca1f0e0018d742bb9.tar.gz
podman-0660f5b7a44ed12be8365bbca1f0e0018d742bb9.tar.bz2
podman-0660f5b7a44ed12be8365bbca1f0e0018d742bb9.zip
Cirrus: Combine build and code consistency tasks
It's conceivable for CI to spend a lot of time testing code which otherwise should be rejected due to quality problems. Previously this was validated in a dedicated task, however a failure would still fail the CI run. Simplify the number of CI tasks by combining the consistency check at the tail-end of the build task. Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/cirrus/CIModes.md5
-rwxr-xr-xcontrib/cirrus/check_go_changes.sh2
-rwxr-xr-xcontrib/cirrus/postbuild.sh30
-rwxr-xr-xcontrib/cirrus/prebuild.sh35
-rwxr-xr-xcontrib/cirrus/runner.sh10
-rwxr-xr-xcontrib/cirrus/setup_environment.sh4
6 files changed, 52 insertions, 34 deletions
diff --git a/contrib/cirrus/CIModes.md b/contrib/cirrus/CIModes.md
index e7fcccf3c..7d6a36cf3 100644
--- a/contrib/cirrus/CIModes.md
+++ b/contrib/cirrus/CIModes.md
@@ -47,7 +47,6 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ validate
+ bindings
+ swagger
-+ consistency
+ *alt_build*
+ osx_alt_build
+ docker-py_test
@@ -77,7 +76,6 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ *build*
+ validate
+ swagger
-+ consistency
+ meta
+ success
@@ -85,14 +83,12 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ *build*
+ validate
+ swagger
-+ consistency
+ meta
+ success
### Intend `[CI:BUILD]` PR Tasks:
+ *build*
+ validate
-+ consistency
+ *alt_build*
+ osx_alt_build
+ test_image_build
@@ -101,6 +97,7 @@ of this document, it's not possible to override the behavior of `$CIRRUS_PR`.
+ artifacts
### Intended Branch tasks (and Cirrus-cron jobs, except "multiarch"):
++ *build*
+ swagger
+ *alt_build*
+ osx_alt_build
diff --git a/contrib/cirrus/check_go_changes.sh b/contrib/cirrus/check_go_changes.sh
index 3c35ce51a..a92ab03af 100755
--- a/contrib/cirrus/check_go_changes.sh
+++ b/contrib/cirrus/check_go_changes.sh
@@ -36,6 +36,8 @@ then
exit 0
fi
+# Defined by/in Cirrus-CI config.
+# shellcheck disable=SC2154
base=$(git merge-base $DEST_BRANCH $CIRRUS_CHANGE_IN_REPO)
diffs=$(git diff $base $CIRRUS_CHANGE_IN_REPO -- '*.go' ':^vendor/')
diff --git a/contrib/cirrus/postbuild.sh b/contrib/cirrus/postbuild.sh
new file mode 100755
index 000000000..47cb558e3
--- /dev/null
+++ b/contrib/cirrus/postbuild.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -eo pipefail
+
+# This script attempts to confirm all included go modules from
+# other sources match what is expected in `vendor/modules.txt`
+# vs `go.mod`. Also make sure that the generated bindings in
+# `pkg/bindings/...` are in sync with the code. It's intended
+# for use after successfully building podman, to prevent wasting
+# time on tests that might otherwise succeed with bad/ugly/invalid
+# code.
+
+source /etc/automation_environment
+source $AUTOMATION_LIB_PATH/common_lib.sh
+
+# Defined by the CI system
+# shellcheck disable=SC2154
+cd $CIRRUS_WORKING_DIR
+
+showrun make .install.goimports
+showrun make vendor
+SUGGESTION="run 'make vendor' and commit all changes" ./hack/tree_status.sh
+showrun make generate-bindings
+SUGGESTION="run 'make generate-bindings' and commit all changes" ./hack/tree_status.sh
+showrun make completions
+SUGGESTION="run 'make completions' and commit all changes" ./hack/tree_status.sh
+
+# Defined in Cirrus-CI config.
+# shellcheck disable=SC2154
+$SCRIPT_BASE/check_go_changes.sh
diff --git a/contrib/cirrus/prebuild.sh b/contrib/cirrus/prebuild.sh
index 7695128de..ea05d90dc 100755
--- a/contrib/cirrus/prebuild.sh
+++ b/contrib/cirrus/prebuild.sh
@@ -17,26 +17,27 @@ req_env_vars CI DEST_BRANCH IMAGE_SUFFIX TEST_FLAVOR TEST_ENVIRON \
SCRIPT_BASE CIRRUS_WORKING_DIR FEDORA_NAME UBUNTU_NAME \
VM_IMAGE_NAME
-# There's no need to perform further checks on more than one
-# CI platform. These variables are defined in .cirrus.yml
+# Defined by the CI system
# shellcheck disable=SC2154
-if [[ ! "${DISTRO_NV}" =~ ${FEDORA_NAME} ]]; then
- echo "Skipping additional checks on $DISTRO_NV"
- exit 0
-fi
+cd $CIRRUS_WORKING_DIR
+# Defined by CI config.
# shellcheck disable=SC2154
-$SCRIPT_BASE/cirrus_yaml_test.py
-
-ooe.sh dnf install -y ShellCheck # small/quick addition
+showrun $SCRIPT_BASE/cirrus_yaml_test.py
-shellcheck --color=always --format=tty \
- --shell=bash --external-sources \
- --enable add-default-case,avoid-nullary-conditions,check-unassigned-uppercase \
- --exclude SC2046,SC2034,SC2090,SC2064 \
- --wiki-link-count=0 --severity=warning \
- $SCRIPT_BASE/*.sh hack/get_ci_vm.sh
+# Defined by CI config.
+# shellcheck disable=SC2154
+if [[ "${DISTRO_NV}" =~ fedora ]]; then
+ showrun ooe.sh dnf install -y ShellCheck # small/quick addition
+ showrun shellcheck --color=always --format=tty \
+ --shell=bash --external-sources \
+ --enable add-default-case,avoid-nullary-conditions,check-unassigned-uppercase \
+ --exclude SC2046,SC2034,SC2090,SC2064 \
+ --wiki-link-count=0 --severity=warning \
+ $SCRIPT_BASE/*.sh hack/get_ci_vm.sh
+fi
+msg "Checking 3rd party network service connectivity"
# shellcheck disable=SC2154
cat ${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/required_host_ports.txt | \
while read host port
@@ -66,9 +67,11 @@ TEST_IMGS=(\
cirros:latest
)
-echo "Checking quay.io test image accessibility"
+msg "Checking quay.io test image accessibility"
for testimg in "${TEST_IMGS[@]}"; do
fqin="quay.io/libpod/$testimg"
echo " $fqin"
+ # Belt-and-suspenders: Catch skopeo (somehow) returning False or null
+ # in addition to "bad" (invalid) JSON.
skopeo inspect --retry-times 5 "docker://$fqin" | jq -e . > /dev/null
done
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index d0657ab5f..d360f6a04 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -211,16 +211,6 @@ eof
rm -f $envvarsfile
}
-function _run_consistency() {
- make vendor
- SUGGESTION="run 'make vendor' and commit all changes" ./hack/tree_status.sh
- make generate-bindings
- SUGGESTION="run 'make generate-bindings' and commit all changes" ./hack/tree_status.sh
- make completions
- SUGGESTION="run 'make completions' and commit all changes" ./hack/tree_status.sh
- $SCRIPT_BASE/check_go_changes.sh
-}
-
function _run_build() {
# Ensure always start from clean-slate with all vendor modules downloaded
make clean
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index e43231640..ca1e16544 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -364,10 +364,6 @@ case "$TEST_FLAVOR" in
docker.io/gitlab/gitlab-runner-helper:x86_64-latest-pwsh
;;
swagger) ;& # use next item
- consistency)
- make clean
- make .install.goimports
- ;;
release) ;;
*) die_unknown TEST_FLAVOR
esac