Skip to content

Commit a2df1c5

Browse files
committed
DLPX-91971 linux-pkg: Add support for os-upgrade branches
PR URL: https://www.github.com/delphix/linux-pkg/pull/320
1 parent 649bfd2 commit a2df1c5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/common.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,24 @@ function fetch_repo_from_git() {
769769
logmust git show-ref repo-HEAD
770770
logmust git show-ref upstream-HEAD
771771
else
772+
773+
#
774+
# The "os-upgrade" branch is used for Ubuntu version upgrade projects. As such, the following
775+
# block of code will only be executed if the PACKAGE_GIT_BRANCH is set to "os-upgrade" i.e. when
776+
# the "os-upgrade" branch is marked active in dlpx-version-mapping. Not all product repositories
777+
# require an "os-upgrade" branch, because some packages will successfully build on the new
778+
# Ubuntu version as well as the old without any changes.
779+
# To allow engineering to create the "os-upgrade" branch only in repositories that require
780+
# changes, this block of code will check if the "os-upgrade" branch exists in the repository
781+
# and if it does not, it will use the "develop" branch instead.
782+
#
783+
if [[ "$PACKAGE_GIT_BRANCH" == "os-upgrade" ]]; then
784+
if [[ -n $(git ls-remote --exit-code --heads origin refs/heads/os-upgrade) ]]; then
785+
echo "NOTE: The branch 'os-upgrade' does not exist for this repo. Using 'develop' instead."
786+
PACKAGE_GIT_BRANCH="develop"
787+
fi
788+
fi
789+
772790
logmust git_fetch_helper "$PACKAGE_GIT_URL" --no-tags \
773791
"+$PACKAGE_GIT_BRANCH:repo-HEAD" --depth=1
774792
logmust git show-ref repo-HEAD

0 commit comments

Comments
 (0)