Skip to content

Commit

Permalink
publish-image.yml: Retry updating release description with random del…
Browse files Browse the repository at this point in the history
…ays to avoid race conditions

- build-lxd.yml: Remove EXPERIMENTAL-suffix from LXC image artifacts

Signed-off-by: Tobias Knöppler <[email protected]>
  • Loading branch information
theCalcaholic committed Apr 15, 2023
1 parent 663b65e commit be6e109
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-lxd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
41 changes: 31 additions & 10 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
6 changes: 4 additions & 2 deletions .github/workflows/vm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit be6e109

Please sign in to comment.