From bca6e6e41d304e41f05f126700848e6fdd9162ae Mon Sep 17 00:00:00 2001 From: Kai Lueke Date: Mon, 26 Sep 2022 15:40:49 +0200 Subject: [PATCH] ci-automation: Don't skip nightly build when the previous one failed Currently we skip the nightly build if there are no changes. This didn't work well because a new run doesn't fix any failure because the rerun became a no-op. Check if the main artifacts we expect from a step are found, as simple heuristic on whether a rerun is needed. --- ci-automation/packages-tag.sh | 10 +++++++--- ci-automation/sdk_bootstrap.sh | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ci-automation/packages-tag.sh b/ci-automation/packages-tag.sh index 7ae886866f..dc20d990f7 100644 --- a/ci-automation/packages-tag.sh +++ b/ci-automation/packages-tag.sh @@ -98,9 +98,13 @@ function _packages_tag_impl() { local ret=0 git diff --exit-code "${existing_tag}" || ret=$? if [[ ret -eq 0 ]]; then - touch ./skip-build - echo "Creating ./skip-build flag file, indicating that the build must not to continue because no new tag got created as there are no changes since tag ${existing_tag}" >&2 - return 0 + if curl --head --fail --silent --show-error --location "https://${BUILDCACHE_SERVER}/images/amd64/${FLATCAR_VERSION}/flatcar_production_image.bin.bz2" + && curl --head --fail --silent --show-error --location "https://${BUILDCACHE_SERVER}/images/arm64/${FLATCAR_VERSION}/flatcar_production_image.bin.bz2"; then + touch ./skip-build + echo "Creating ./skip-build flag file, indicating that the build must not to continue because no new tag got created as there are no changes since tag ${existing_tag} and the Flatcar images exist" >&2 + return 0 + fi + echo "No changes but continuing build because Flatcar images do not exist" elif [[ ret -eq 1 ]]; then echo "Found changes since last tag ${existing_tag}" >&2 else diff --git a/ci-automation/sdk_bootstrap.sh b/ci-automation/sdk_bootstrap.sh index 724acefa0d..6c6b145f93 100644 --- a/ci-automation/sdk_bootstrap.sh +++ b/ci-automation/sdk_bootstrap.sh @@ -106,8 +106,15 @@ function _sdk_bootstrap_impl() { local ret=0 git diff --exit-code "${existing_tag}" || ret=$? if [ "$ret" = "0" ]; then - echo "Stopping build because there are no changes since tag ${existing_tag}" >&2 - return 0 + local sdk_docker_vernum="" + sdk_docker_vernum=$(vernum_to_docker_image_version "${FLATCAR_SDK_VERSION}") + if curl --head --fail --silent --show-error --location "https://${BUILDCACHE_SERVER}/containers/${FLATCAR_SDK_VERSION}/flatcar-sdk-all-${sdk_docker_vernum}.tar.gz" + && curl --head --fail --silent --show-error --location "https://${BUILDCACHE_SERVER}/images/amd64/${FLATCAR_VERSION}/flatcar_production_image.bin.bz2" + && curl --head --fail --silent --show-error --location "https://${BUILDCACHE_SERVER}/images/arm64/${FLATCAR_VERSION}/flatcar_production_image.bin.bz2"; then + echo "Stopping build because there are no changes since tag ${existing_tag}, the SDK container tar ball and the Flatcar images exist" >&2 + return 0 + fi + echo "No changes but continuing build because SDK container tar ball and/or the Flatcar images do not exist" >&2 elif [ "$ret" = "1" ]; then echo "Found changes since last tag ${existing_tag}" >&2 else