Skip to content

Commit 8999878

Browse files
fix the vernum and the channel logic a bit
Signed-off-by: Sayan Chowdhury <[email protected]>
1 parent e25f0f5 commit 8999878

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

ci-automation/az_sig_publish.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,35 @@ function _az_sig_publish_impl() {
1616
local push_non_nightly_builds="${PUSH_NON_NIGHTLY_BUILDS:-}"
1717

1818
source sdk_container/.repo/manifests/version.txt
19-
local vernum="${FLATCAR_VERSION}"
19+
source sdk_lib/sdk_container_common.sh
20+
local vernum="$(get_git_version)"
21+
local channel="$(get_git_channel)"
2022

2123
source ci-automation/ci_automation_common.sh
2224
source ci-automation/gpg_setup.sh
2325

24-
if [[ "$vernum" != *nightly* && "${push_non_nightly_builds}" != "true" ]]; then
25-
echo "INFO: Version '$vernum' is not a nightly build, and PUSH_NON_NIGHTLY_BUILDS is not enabled. Skipping publish step."
26+
if { [[ "$vernum" != *"nightly"* ]] || [[ "$channel" != "developer" ]] } && [[ "$push_non_nightly_builds" != "true" ]]; then
27+
echo "INFO: Version '$vernum' is not a nightly build, or channel is not developer and PUSH_NON_NIGHTLY_BUILDS is not enabled. Skipping publish step."
2628
exit 0
2729
fi
2830

29-
local channel=""
31+
FLATCAR_GALLERY_IMAGE_NAME="flatcar-${channel}-${arch}"
32+
version=$(echo "${vernum}" | cut -d '-' -f2)
33+
3034
local date=""
3135
if [[ "$vernum" == *nightly* ]]; then
32-
local version nightly date time
33-
IFS='-' read -r channel version nightly date time <<< "$vernum"
34-
FLATCAR_GALLERY_IMAGE_NAME="flatcar-${channel}-${nightly}-${arch}"
35-
FLATCAR_GALLERY_VERSION="${version%.*}.${date}"
36+
date=$(echo "${vernum}" | cut -d '-' -f4)
37+
FLATCAR_GALLERY_VERSION="${version%.*}.${date:2}"
3638
else
37-
source sdk_lib/sdk_container_common.sh
38-
channel="$(get_git_channel)"
39-
FLATCAR_GALLERY_IMAGE_NAME="flatcar-${channel}-${arch}"
4039
date=$(date +'%y%m%d')
41-
version="${vernum%%+*}"
4240
FLATCAR_GALLERY_VERSION="${version%.*}.${date}"
4341
fi
4442

4543
TMP_DIR=$(mktemp -d /var/tmp/flatcar.XXXXXX)
4644
# Cleanup on exit (success or failure)
4745
trap 'echo "Cleaning up..."; rm -rf "${TMP_DIR}"' EXIT
4846

49-
FLATCAR_LOCAL_FILE_URL="https://bincache.flatcar-linux.net/images/amd64/${vernum}/flatcar_production_azure_image.vhd.bz2"
47+
FLATCAR_LOCAL_FILE_URL="https://bincache.flatcar-linux.net/images/amd64/${FLATCAR_VERSION}/flatcar_production_azure_image.vhd.bz2"
5048

5149
# -- Clean up --
5250
echo "FLATCAR_GALLERY_IMAGE_NAME ${FLATCAR_GALLERY_IMAGE_NAME}"

0 commit comments

Comments
 (0)