Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
fix(core): Adopt to executor changes
[csit.git]
/
resources
/
libraries
/
bash
/
function
/
branch.sh
diff --git
a/resources/libraries/bash/function/branch.sh
b/resources/libraries/bash/function/branch.sh
index
e340a0c
..
ba9cc39
100644
(file)
--- a/
resources/libraries/bash/function/branch.sh
+++ b/
resources/libraries/bash/function/branch.sh
@@
-1,4
+1,4
@@
-# Copyright (c) 20
18
Cisco and/or its affiliates.
+# Copyright (c) 20
21
Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@
-21,8
+21,6
@@
set -exuo pipefail
function checkout_csit_for_vpp () {
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,
# 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,
@@
-30,6
+28,11
@@
function checkout_csit_for_vpp () {
# When the refspec is overriden, the computation is still performed,
# in order to show (on Sandbox) the computation is correct.
#
# When the refspec is overriden, the computation is still performed,
# in order to show (on Sandbox) the computation is correct.
#
+ # Git status and git log -1 are executed, so the current state
+ # of the checked-out branch is visible.
+ # This is mainly useful for identifying trending anomalies
+ # caused by changes in CSIT code.
+ #
# On failure, working directory could remain changed to ${CSIT_DIR}.
# TODO: It could be possible to use ERR trap to force popd,
# but with "set -x" the noise is not worth it,
# On failure, working directory could remain changed to ${CSIT_DIR}.
# TODO: It could be possible to use ERR trap to force popd,
# but with "set -x" the noise is not worth it,
@@
-51,10
+54,19
@@
function checkout_csit_for_vpp () {
# Functions called:
# - die - Print to stderr and exit, defined in "common" library.
# Functions called:
# - die - Print to stderr and exit, defined in "common" library.
+ set -exuo pipefail
+
case "${1}" in
case "${1}" in
+ "stable/2009")
+ # LTS branch
+ branch_id="origin/${1/stable\//oper-rls}_lts"
+ ;;
"stable/"*)
branch_id="origin/${1/stable\//oper-rls}"
;;
"stable/"*)
branch_id="origin/${1/stable\//oper-rls}"
;;
+ "rls"*)
+ branch_id="origin/oper-${1}"
+ ;;
*) # This includes "master".
branch_id="origin/oper"
esac
*) # This includes "master".
branch_id="origin/oper"
esac
@@
-74,10
+86,12
@@
function checkout_csit_for_vpp () {
csit_branch="${csit_branch#origin/}" || die
override_ref="${CSIT_REF-}"
if [[ -n "${override_ref}" ]]; then
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
else
- git checkout "${csit_branch}"
+ git checkout "${csit_branch}"
|| die
fi
fi
- popd
+ git status || die
+ git log -1 || die
+ popd || die
}
}