X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fbash%2Ffunction%2Fbranch.sh;h=558a2b617ebc057bf95bfa330ec87ce3b6b898c1;hp=e340a0c658515941337a811d81821a6cded5d41f;hb=36d56bdb7f9f394047e2df3f29bf47db877b649c;hpb=e45404bf7b8cbdb10adf85815c2e005134e463ad diff --git a/resources/libraries/bash/function/branch.sh b/resources/libraries/bash/function/branch.sh index e340a0c658..558a2b617e 100644 --- a/resources/libraries/bash/function/branch.sh +++ b/resources/libraries/bash/function/branch.sh @@ -21,8 +21,6 @@ set -exuo pipefail function checkout_csit_for_vpp () { - set -exuo pipefail - # This should be useful mainly for vpp-csit jobs (and timed csit-vpp jobs), # which want to use csit oper branches (especially for vpp stable branches). # This allows the Jenkins job to checkout CSIT master branch, @@ -51,6 +49,8 @@ function checkout_csit_for_vpp () { # Functions called: # - die - Print to stderr and exit, defined in "common" library. + set -exuo pipefail + case "${1}" in "stable/"*) branch_id="origin/${1/stable\//oper-rls}" @@ -74,10 +74,10 @@ function checkout_csit_for_vpp () { csit_branch="${csit_branch#origin/}" || die override_ref="${CSIT_REF-}" if [[ -n "${override_ref}" ]]; then - git fetch --depth=1 https://gerrit.fd.io/r/csit "${override_ref}" - git checkout FETCH_HEAD + git fetch --depth=1 https://gerrit.fd.io/r/csit "${override_ref}" || die + git checkout FETCH_HEAD || die else - git checkout "${csit_branch}" + git checkout "${csit_branch}" || die fi - popd + popd || die }