Skip to content

Commit

Permalink
github/workflows: Fix version logic when missing derived image
Browse files Browse the repository at this point in the history
  • Loading branch information
travier committed Jul 4, 2024
1 parent e7a10a3 commit a5c2e1b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/fedora-kinoite-calamares.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,20 @@ jobs:
- name: Figure out version
id: version
run: |
set -ex
set -exo pipefail
if [[ -n ${VERSION} ]]; then
version="${VERSION}"
else
version_base="$(skopeo inspect docker://${BASEIMAGE} | jq -r '.Labels."org.opencontainers.image.version"')"
version_derived="$(skopeo inspect docker://${REGISTRY}/${NAME} | jq -r '.Labels."org.opencontainers.image.version"')"
version_derived="$(skopeo inspect docker://${REGISTRY}/${NAME} | jq -r '.Labels."org.opencontainers.image.version"' || true)"
if [[ -z "${version_derived}" ]]; then
version="${version_base}"
elif [[ "${version_base}" == "${version_derived}" ]]; then
patch="${version_base##*\.}"
((patch++)) || true
version="${version_base%\.*}.${patch}"
else
if [[ "${version_base}" == "${version_derived}" ]]; then
patch="${version_base##*\.}"
((patch++)) || true
version="${version_base%\.*}.${patch}"
else
version="${version_base}"
fi
version="${version_base}"
fi
fi
echo "Using version: ${version}"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/fedora-kinoite-live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ jobs:
version="${VERSION}"
else
version_base="$(skopeo inspect docker://${BASEIMAGE} | jq -r '.Labels."org.opencontainers.image.version"')"
version_derived="$(skopeo inspect docker://${REGISTRY}/${NAME} | jq -r '.Labels."org.opencontainers.image.version"')"
if [[ "${version_base}" == "${version_derived}" ]]; then
version_derived="$(skopeo inspect docker://${REGISTRY}/${NAME} | jq -r '.Labels."org.opencontainers.image.version"' || true)"
if [[ -z "${version_derived}" ]]; then
version="${version_base}"
elif [[ "${version_base}" == "${version_derived}" ]]; then
patch="${version_base##*\.}"
((patch++)) || true
version="${version_base%\.*}.${patch}"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/fedora-kinoite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ jobs:
version="${VERSION}"
else
version_base="$(skopeo inspect docker://${BASEIMAGE} | jq -r '.Labels."org.opencontainers.image.version"')"
version_derived="$(skopeo inspect docker://${REGISTRY}/${NAME} | jq -r '.Labels."org.opencontainers.image.version"')"
if [[ "${version_base}" == "${version_derived}" ]]; then
version_derived="$(skopeo inspect docker://${REGISTRY}/${NAME} | jq -r '.Labels."org.opencontainers.image.version"' || true)"
if [[ -z "${version_derived}" ]]; then
version="${version_base}"
elif [[ "${version_base}" == "${version_derived}" ]]; then
patch="${version_base##*\.}"
((patch++)) || true
version="${version_base%\.*}.${patch}"
Expand Down

0 comments on commit a5c2e1b

Please sign in to comment.