Merge pull request #244 from flatcar-linux/kai/set-group

Fix and improve channel handling
This commit is contained in:
Kai Lüke 2022-03-04 14:22:10 +01:00 committed by GitHub
commit 0cc95e3b3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 15 deletions

View File

@ -37,6 +37,9 @@ set -eu
function image_build() {
local arch="$1"
source sdk_lib/sdk_container_common.sh
local channel=""
channel="$(get_git_channel)"
source ci-automation/ci_automation_common.sh
init_submodules
@ -58,7 +61,7 @@ function image_build() {
mkdir -p "${CONTAINER_IMAGE_ROOT}"
./run_sdk_container -n "${image_container}" -C "${packages_image}" \
-v "${vernum}" \
./build_image --board="${arch}-usr" \
./build_image --board="${arch}-usr" --group="${channel}" \
--output_root="${CONTAINER_IMAGE_ROOT}" \
--torcx_root="${CONTAINER_TORCX_ROOT}" prodtar container

View File

@ -23,6 +23,7 @@ if [ "$@" != "" ] && [ "$@" != "*" ] && [ "$@" != "cl.update.payload" ]; then
fi
source ci-automation/ci_automation_common.sh
source sdk_lib/sdk_container_common.sh
mkdir -p "${work_dir}"
cd "${work_dir}"
@ -35,13 +36,10 @@ else
copy_from_buildcache "images/${arch}/${vernum}/flatcar_test_update.gz" tmp/
fi
# Get last release tag (and filter out the alpha-3046.0.0 tag which was done without updating the submodule and thus refers a commit on main)
PREV_TAG=$(git describe --tags --abbrev=0 | sed 's/alpha-3046.0.0//g')
if [ "${PREV_TAG}" = "" ]; then
# For main we compare to last alpha release
ON_CHANNEL="$(get_git_channel)"
if [ "${ON_CHANNEL}" = "developer" ]; then
# For main/dev builds we compare to last alpha release
ON_CHANNEL="alpha"
else
ON_CHANNEL=$(echo "${PREV_TAG}" | cut -d "-" -f 1)
fi
if [ "${ON_CHANNEL}" = "lts" ]; then
echo "Updating from previous LTS is not supported yet (needs creds), fallback to Stable"

View File

@ -133,20 +133,19 @@ set +x
set +e
echo "==================================================================="
echo
# Get last release tag (and filter out the alpha-3046.0.0 tag which was done without updating the submodule and thus refers a commit on main)
PREV_TAG=$(git -C src/scripts describe --tags --abbrev=0 | sed 's/alpha-3046.0.0//g')
if [ "${PREV_TAG}" = "" ]; then
# For main we compare to last alpha release
export CHANNEL_A="alpha"
export VERSION_A=$(curl -s -S -f -L "https://${CHANNEL_A}.release.flatcar-linux.net/${BOARD}/current/version.txt" | grep -m 1 "FLATCAR_VERSION=" | cut -d "=" -f 2)
if [ "${GROUP}" != "developer" ]; then
export CHANNEL_A="${GROUP}"
else
export CHANNEL_A=$(echo "${PREV_TAG}" | cut -d "-" -f 1)
export VERSION_A=$(echo "${PREV_TAG}" | cut -d "-" -f 2)
export CHANNEL_A="${CHANNEL_BASE}"
fi
if [ "${CHANNEL_A}" = "lts" ]; then
echo "Comparing to LTS is not supported yet (needs creds)"
exit 0
fi
export VERSION_A=$(curl -s -S -f -L "https://${CHANNEL_A}.release.flatcar-linux.net/${BOARD}/current/version.txt" | grep -m 1 "FLATCAR_VERSION=" | cut -d "=" -f 2)
if [ "${GROUP}" = "developer" ]; then
export CHANNEL_B="developer"
export MODE_B="/developer/"

View File

@ -87,6 +87,25 @@ function build_id_from_version() {
}
# --
# Get channel from a version string ("alpha-3244.0.1-nightly2" => "alpha")
#
function channel_from_version() {
local version="$1"
local channel=""
channel=$(echo "${version}" | cut -d - -f 1)
if [ "${channel}" != "alpha" ] && [ "${channel}" != "beta" ] && [ "${channel}" != "stable" ] && [ "${channel}" != "lts" ]; then
channel="developer"
fi
echo "${channel}"
}
# --
function get_git_channel() {
channel_from_version "$(get_git_version)"
}
# --
# extract the version number (w/o build ID) from a version string ("alpha-3244.0.1-nightly2" => "3244.0.1")
#
function vernum_from_version() {