From be6e1092303bd0853ea34f62ca6e8c1c5257614d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Sun, 16 Apr 2023 01:19:21 +0200 Subject: [PATCH] publish-image.yml: Retry updating release description with random delays to avoid race conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build-lxd.yml: Remove EXPERIMENTAL-suffix from LXC image artifacts Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- .github/workflows/build-lxd.yml | 2 +- .github/workflows/publish-image.yml | 41 ++++++++++++++++++++++------- .github/workflows/vm-tests.yml | 6 +++-- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-lxd.yml b/.github/workflows/build-lxd.yml index bf3e79fa5..c60e82d51 100644 --- a/.github/workflows/build-lxd.yml +++ b/.github/workflows/build-lxd.yml @@ -407,7 +407,7 @@ jobs: cd repackage sudo tar xpf "../${LXD_ARTIFACT_FILE?}" sudo rm -rf ./rootfs/dev - LXC_ARTIFACT_FILE="${LXD_ARTIFACT_FILE//LXD/LXC_EXPERIMENTAL}" + LXC_ARTIFACT_FILE="${LXD_ARTIFACT_FILE//LXD/LXC}" sudo tar cpzf "../output/${LXC_ARTIFACT_FILE?}" -C rootfs/ . cd .. sudo chown "$(id -un):" "./output/${LXC_ARTIFACT_FILE}" diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 8afc46c08..dc99cb5bb 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -61,19 +61,40 @@ jobs: exit 0 } - body="$(hub release show -f "%b" "${VERSION}")" - if ! [[ "$body" =~ .*'**Checksums:**'.* ]] - then - - body="${body} + success=false + for i in {1..5} + do + body="$(hub release show -f "%b" "${VERSION}")" + if ! [[ "$body" =~ .*'**Checksums:**'.* ]] + then + + body="${body} **Checksums:** \`\`\` \`\`\`" - fi - - body="${body%$'\n\`\`\`'*} + fi + + body="${body%$'\n\`\`\`'*} $checksum \`\`\`" - gh release upload "${VERSION?}" "${asset}" - gh release edit "${VERSION?}" -n "$body" + + gh release edit "${VERSION?}" -n "$body" + if hub release show -f "%b" "${VERSION}" | grep "$checksum" + then + success=true + break + else + WAIT_TIME="$((1 + $RANDOM % 20))" + echo "Checksum missing from release description. Retrying in $WAIT_TIME seconds..." + sleep "$WAIT_TIME" + fi + done + + [[ "$success" == "true" ]] || { + gh release upload "${VERSION?}" "${asset}" + echo "Updating release description failed." + exit 1 + } + + echo "Image published successfully." diff --git a/.github/workflows/vm-tests.yml b/.github/workflows/vm-tests.yml index 743ae5b4d..289d878b9 100644 --- a/.github/workflows/vm-tests.yml +++ b/.github/workflows/vm-tests.yml @@ -61,7 +61,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - shell: bash + - name: find reference version + shell: bash id: find-version run: | set -e @@ -82,7 +83,8 @@ jobs: fi echo "Previous version is '$version'" echo "previous_version=${version}" >> $GITHUB_OUTPUT - - run: | + - name: Generate ssh key + run: | set -x mkdir -p ./.ssh ssh-keygen -t ed25519 -f ".ssh/automation_ssh_key"