mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 21:46:58 +02:00
ci-automation: Let vendor scripts know if this is their first run
I will need it to correctly handle test reruns as we will need to handle passed test names differently on first runs than on reruns.
This commit is contained in:
parent
76abe0d9cb
commit
f0765e22c3
@ -146,6 +146,9 @@ function test_run() {
|
|||||||
local success=false
|
local success=false
|
||||||
# A job on each worker prunes old mantle images (docker image prune)
|
# A job on each worker prunes old mantle images (docker image prune)
|
||||||
echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh
|
echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh
|
||||||
|
|
||||||
|
# Vendor tests may need to know if it is a first run or a rerun
|
||||||
|
touch "${work_dir}/first_run"
|
||||||
for retry in $(seq "${retries}"); do
|
for retry in $(seq "${retries}"); do
|
||||||
local tapfile="results-run-${retry}.tap"
|
local tapfile="results-run-${retry}.tap"
|
||||||
local failfile="failed-run-${retry}.txt"
|
local failfile="failed-run-${retry}.txt"
|
||||||
@ -164,6 +167,7 @@ function test_run() {
|
|||||||
\"${tapfile}\" \
|
\"${tapfile}\" \
|
||||||
$@"
|
$@"
|
||||||
set -e
|
set -e
|
||||||
|
rm -f "${work_dir}/first_run"
|
||||||
|
|
||||||
docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \
|
docker run --pull always --rm --name="${container_name}" --privileged --net host -v /dev:/dev \
|
||||||
-w /work -v "$PWD":/work "${mantle_ref}" \
|
-w /work -v "$PWD":/work "${mantle_ref}" \
|
||||||
|
@ -51,6 +51,9 @@
|
|||||||
# Path to the Torcx manifest. Usually passed to kola through the
|
# Path to the Torcx manifest. Usually passed to kola through the
|
||||||
# --torcx-manifest parameter.
|
# --torcx-manifest parameter.
|
||||||
#
|
#
|
||||||
|
# CIA_FIRST_RUN:
|
||||||
|
# 1 if this is a first run, 0 if it is a rerun of failed tests.
|
||||||
|
#
|
||||||
#
|
#
|
||||||
# After this script is sourced, the parameters in ${@} specify test
|
# After this script is sourced, the parameters in ${@} specify test
|
||||||
# cases / test case patterns to run.
|
# cases / test case patterns to run.
|
||||||
@ -90,6 +93,11 @@ fi
|
|||||||
ciavts_tapfile="${PWD}/${ciavts_work_dir}/${ciavts_tapfile}"
|
ciavts_tapfile="${PWD}/${ciavts_work_dir}/${ciavts_tapfile}"
|
||||||
ciavts_torcx_manifest="${PWD}/${ciavts_main_work_dir}/torcx_manifest.json"
|
ciavts_torcx_manifest="${PWD}/${ciavts_main_work_dir}/torcx_manifest.json"
|
||||||
|
|
||||||
|
ciavts_first_run=0
|
||||||
|
if [[ -f "${ciavts_main_work_dir}/first_run" ]]; then
|
||||||
|
ciavts_first_run=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "++++ Running ${ciavts_testscript} inside ${ciavts_work_dir} ++++"
|
echo "++++ Running ${ciavts_testscript} inside ${ciavts_work_dir} ++++"
|
||||||
|
|
||||||
cd "${ciavts_work_dir}"
|
cd "${ciavts_work_dir}"
|
||||||
@ -102,6 +110,7 @@ CIA_TESTSCRIPT="${ciavts_testscript}"
|
|||||||
CIA_GIT_VERSION="${ciavts_git_version}"
|
CIA_GIT_VERSION="${ciavts_git_version}"
|
||||||
CIA_BUILD_TYPE="${ciavts_type}"
|
CIA_BUILD_TYPE="${ciavts_type}"
|
||||||
CIA_TORCX_MANIFEST="${ciavts_torcx_manifest}"
|
CIA_TORCX_MANIFEST="${ciavts_torcx_manifest}"
|
||||||
|
CIA_FIRST_RUN="${ciavts_first_run}"
|
||||||
|
|
||||||
# Unset all variables with ciavts_ prefix now.
|
# Unset all variables with ciavts_ prefix now.
|
||||||
unset -v "${!ciavts_@}"
|
unset -v "${!ciavts_@}"
|
||||||
|
Loading…
Reference in New Issue
Block a user