Skip to content

Commit 586cb7e

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 586cb7e

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". Not
776+
# all product repositories are required to have an "os-upgrade" branch, because some packages
777+
# will successfully build on the new Ubuntu version as well as the old without any changes.
778+
# To allow engineering to create the "os-upgrade" branch only in repositories that require
779+
# changes for the new Ubuntu version, this block of code will check if the "os-upgrade" branch
780+
# exists in the repository and if it does not, it will build off of "develop" instead.
781+
#
782+
if [[ "$PACKAGE_GIT_BRANCH" == "os-upgrade" ]]; then
783+
git_fetch_helper "$PACKAGE_GIT_URL" --no-tags "$PACKAGE_GIT_BRANCH" --depth=1 && branchexists=0 || branchexists=1
784+
if [[ branchexists -ne 0 ]]; 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)