mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 14:41:31 +02:00
Merge pull request #799 from flatcar/krnowak/more-2-phase-tag-fixes
ci-automation: Follow-up fix for 2-phase nightly SDK build tags
This commit is contained in:
commit
0c96ff690e
@ -23,7 +23,7 @@ function check_version_string() {
|
|||||||
|
|
||||||
function update_and_push_version() {
|
function update_and_push_version() {
|
||||||
local version="$1"
|
local version="$1"
|
||||||
local push_to_branch="${2:-false}"
|
local target_branch="${2:-}"
|
||||||
|
|
||||||
# set up author and email so git does not complain when tagging
|
# set up author and email so git does not complain when tagging
|
||||||
if ! git config --get user.name >/dev/null 2>&1 ; then
|
if ! git config --get user.name >/dev/null 2>&1 ; then
|
||||||
@ -64,9 +64,8 @@ function update_and_push_version() {
|
|||||||
|
|
||||||
git tag -f "${TAG_ARGS[@]}" "${version}"
|
git tag -f "${TAG_ARGS[@]}" "${version}"
|
||||||
|
|
||||||
if [ "${push_to_branch}" = "true" ]; then
|
if [[ -n "${target_branch}" ]]; then
|
||||||
local branch="$(git rev-parse --abbrev-ref HEAD)"
|
git push origin "HEAD:${target_branch}"
|
||||||
git push origin "${branch}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git push origin "${version}"
|
git push origin "${version}"
|
||||||
|
@ -68,11 +68,19 @@ function _packages_tag_impl() {
|
|||||||
|
|
||||||
# Create new tag in scripts repo w/ updated versionfile
|
# Create new tag in scripts repo w/ updated versionfile
|
||||||
# Also push the changes to the branch ONLY IF we're doing a nightly
|
# Also push the changes to the branch ONLY IF we're doing a nightly
|
||||||
# build of the 'main'/'flatcar-MAJOR' branch AND we're definitely ON the respective branch
|
# build of the 'flatcar-MAJOR' branch AND we're definitely ON the respective branch
|
||||||
local push_branch="false"
|
local target_branch=''
|
||||||
if [[ "${version}" =~ ^(stable|alpha|beta|lts)-[0-9.]+-nightly-[-0-9]+$ ]] \
|
# These variables are here to make it easier to test nightly
|
||||||
&& [[ "$(git rev-parse --abbrev-ref HEAD)" =~ ^flatcar-[0-9]+$ ]] ; then
|
# builds without messing with actual release branches.
|
||||||
push_branch="true"
|
local flatcar_branch_prefix='flatcar'
|
||||||
|
local nightly='nightly'
|
||||||
|
# Patterns used below.
|
||||||
|
local nightly_pattern_1='^(stable|alpha|beta|lts)-[0-9.]+-'"${nightly}"'-[-0-9]+$'
|
||||||
|
local nightly_pattern_2='^(stable|alpha|beta|lts)-[0-9.]+(|-'"${nightly}"'-[-0-9]+)$'
|
||||||
|
local flatcar_pattern='^'"${flatcar_branch_prefix}"'-[0-9]+$'
|
||||||
|
if [[ "${version}" =~ ${nightly_pattern_1} ]] \
|
||||||
|
&& [[ "$(git rev-parse --abbrev-ref HEAD)" =~ ${flatcar_pattern} ]] ; then
|
||||||
|
target_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
local existing_tag=""
|
local existing_tag=""
|
||||||
# Check for the existing tag only when we allow shortcutting
|
# Check for the existing tag only when we allow shortcutting
|
||||||
# the builds. That way we can skip the checks for build
|
# the builds. That way we can skip the checks for build
|
||||||
@ -83,7 +91,7 @@ function _packages_tag_impl() {
|
|||||||
existing_tag=$(git tag --points-at HEAD) # exit code is always 0, output may be empty
|
existing_tag=$(git tag --points-at HEAD) # exit code is always 0, output may be empty
|
||||||
fi
|
fi
|
||||||
# If the found tag is a release or nightly tag, we stop this build if there are no changes
|
# If the found tag is a release or nightly tag, we stop this build if there are no changes
|
||||||
if [[ "${existing_tag}" =~ ^(stable|alpha|beta|lts)-[0-9.]+(|-nightly-[-0-9]+)$ ]]; then
|
if [[ "${existing_tag}" =~ ${nightly_pattern_2} ]]; then
|
||||||
local ret=0
|
local ret=0
|
||||||
git diff --exit-code "${existing_tag}" || ret=$?
|
git diff --exit-code "${existing_tag}" || ret=$?
|
||||||
if [[ ret -eq 0 ]]; then
|
if [[ ret -eq 0 ]]; then
|
||||||
@ -108,7 +116,7 @@ function _packages_tag_impl() {
|
|||||||
source sdk_lib/sdk_container_common.sh
|
source sdk_lib/sdk_container_common.sh
|
||||||
create_versionfile "$sdk_version" "$version"
|
create_versionfile "$sdk_version" "$version"
|
||||||
)
|
)
|
||||||
update_and_push_version "${version}" "${push_branch}"
|
update_and_push_version "${version}" "${target_branch}"
|
||||||
apply_local_patches
|
apply_local_patches
|
||||||
}
|
}
|
||||||
# --
|
# --
|
||||||
|
@ -78,10 +78,17 @@ function _sdk_bootstrap_impl() {
|
|||||||
# Also push the changes to the branch ONLY IF we're doing a nightly
|
# Also push the changes to the branch ONLY IF we're doing a nightly
|
||||||
# build of the 'main' branch AND we're definitely ON the main branch.
|
# build of the 'main' branch AND we're definitely ON the main branch.
|
||||||
# This includes intermediate SDKs when doing 2-phase nightly builds.
|
# This includes intermediate SDKs when doing 2-phase nightly builds.
|
||||||
local push_branch="false"
|
local target_branch=''
|
||||||
if [[ "${version}" =~ ^main-[0-9.]+-nightly-[-0-9]+(-INTERMEDIATE)?$ ]] \
|
# These variables are here to make it easier to test nightly
|
||||||
&& [ "$(git rev-parse --abbrev-ref HEAD)" = "main" ] ; then
|
# builds without messing with actual release branches.
|
||||||
push_branch="true"
|
local main_branch='main'
|
||||||
|
local nightly='nightly'
|
||||||
|
# Patterns used below.
|
||||||
|
local nightly_pattern_1='^main-[0-9.]+-'"${nightly}"'-[-0-9]+(-INTERMEDIATE)?$'
|
||||||
|
local nightly_pattern_2='^main-[0-9.]+-'"${nightly}"'-[-0-9]+$'
|
||||||
|
if [[ "${version}" =~ ${nightly_pattern_1} ]] \
|
||||||
|
&& [ "$(git rev-parse HEAD)" = "$(git rev-parse "origin/${main_branch}")" ] ; then
|
||||||
|
target_branch=${main_branch}
|
||||||
local existing_tag=""
|
local existing_tag=""
|
||||||
# Check for the existing tag only when we allow shortcutting
|
# Check for the existing tag only when we allow shortcutting
|
||||||
# the builds. That way we can skip the checks for build
|
# the builds. That way we can skip the checks for build
|
||||||
@ -92,7 +99,7 @@ function _sdk_bootstrap_impl() {
|
|||||||
existing_tag=$(git tag --points-at HEAD) # exit code is always 0, output may be empty
|
existing_tag=$(git tag --points-at HEAD) # exit code is always 0, output may be empty
|
||||||
fi
|
fi
|
||||||
# If the found tag is a nightly tag, we stop this build if there are no changes
|
# If the found tag is a nightly tag, we stop this build if there are no changes
|
||||||
if [[ "${existing_tag}" =~ ^main-[0-9.]+-nightly-[-0-9]+$ ]]; then
|
if [[ "${existing_tag}" =~ ${nightly_pattern_2} ]]; then
|
||||||
local ret=0
|
local ret=0
|
||||||
git diff --exit-code "${existing_tag}" || ret=$?
|
git diff --exit-code "${existing_tag}" || ret=$?
|
||||||
if [ "$ret" = "0" ]; then
|
if [ "$ret" = "0" ]; then
|
||||||
@ -132,7 +139,7 @@ function _sdk_bootstrap_impl() {
|
|||||||
source sdk_lib/sdk_container_common.sh
|
source sdk_lib/sdk_container_common.sh
|
||||||
create_versionfile "${vernum}"
|
create_versionfile "${vernum}"
|
||||||
)
|
)
|
||||||
update_and_push_version "${version}" "${push_branch}"
|
update_and_push_version "${version}" "${target_branch}"
|
||||||
apply_local_patches
|
apply_local_patches
|
||||||
|
|
||||||
./bootstrap_sdk_container -x ./ci-cleanup.sh "${seed_version}" "${vernum}"
|
./bootstrap_sdk_container -x ./ci-cleanup.sh "${seed_version}" "${vernum}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user