From 38b0fe946b74fad2b0519dc02330fc8b3c3d2356 Mon Sep 17 00:00:00 2001 From: Kai Lueke Date: Mon, 27 Mar 2023 12:25:58 +0900 Subject: [PATCH] Make mantle ref bump action more robust The curl call to download the current version.txt file failed, causing branch to be "flatcar-" which later lets the git checkout fail. This was hidden somewhere in the logs of successful steps. To directly stop execution, use saner settings for curl and bash. --- .github/workflows/mantle-releases-main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mantle-releases-main.yml b/.github/workflows/mantle-releases-main.yml index 185998c6e5..556f138f81 100644 --- a/.github/workflows/mantle-releases-main.yml +++ b/.github/workflows/mantle-releases-main.yml @@ -18,6 +18,7 @@ jobs: - name: Figure out branch id: figure-out-branch run: | + set -euo pipefail # The line with major=$(curl | awk) requires pipefail for error handling skip=0 branch='' if [ ${{ matrix.branch }} = "main" ]; then @@ -39,7 +40,7 @@ jobs: fi rm -f lts-info else - major=$(curl -sSL https://${{ matrix.branch }}.release.flatcar-linux.net/amd64-usr/current/version.txt | awk -F= '/FLATCAR_BUILD=/{ print $2 }') + major=$(curl -fsSL --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 https://${{ matrix.branch }}.release.flatcar-linux.net/amd64-usr/current/version.txt | awk -F= '/FLATCAR_BUILD=/{ print $2 }') branch="flatcar-${major}" fi echo "BRANCH=${branch}" >>"${GITHUB_OUTPUT}" @@ -53,11 +54,13 @@ jobs: if: ${{ steps.figure-out-branch.outputs.SKIP == 0 }} id: fetch-latest-mantle run: | + set -euo pipefail commit=$(git ls-remote https://github.com/flatcar/mantle refs/heads/flatcar-master | cut -f1) echo "COMMIT=${commit}" >>"${GITHUB_OUTPUT}" - name: Try to apply patch if: ${{ steps.figure-out-branch.outputs.SKIP == 0 }} run: | + set -euo pipefail set -x commit=${{ steps.fetch-latest-mantle.outputs.COMMIT }} if ! grep -q "ghcr.io/flatcar/mantle:git-${commit}" sdk_container/.repo/manifests/mantle-container; then