diff options
author | Panagiotis Karalis <pkaralis@intracom-telecom.com> | 2019-05-29 16:27:11 +0300 |
---|---|---|
committer | Panagiotis Karalis <pkaralis@intracom-telecom.com> | 2019-06-07 16:29:45 +0300 |
commit | 4fc988b325df2d028463bef72820850b8d3111d7 (patch) | |
tree | 429a304c659f9ae3c90dd1451410bed982198b6b | |
parent | 7163c9bfac715d9b92fe46ac3272c02f470d13fd (diff) |
Get XCI_FLAVOR as parameter from the commit msg
When a new patch is pushed on releng-xci repo and the impact
is not related to XCI_FLAVOR=mini, the environment preparation of CI
should be done, choosing as XCI_FLAVOR noha or ha.
This patch allows to get the XCI_FLAVOR parameter from commit message
and specifically from xci-flavor parameter.
Change-Id: Id5215e3fab1fc308435781204a6ed721a9c5a0c7
Signed-off-by: Panagiotis Karalis <pkaralis@intracom-telecom.com>
-rwxr-xr-x | jjb/xci/xci-set-scenario.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/jjb/xci/xci-set-scenario.sh b/jjb/xci/xci-set-scenario.sh index 59c1ebf6e..2c35f2780 100755 --- a/jjb/xci/xci-set-scenario.sh +++ b/jjb/xci/xci-set-scenario.sh @@ -153,6 +153,45 @@ function determine_scenario() { SCENARIO_SHA=$(cd $WORK_DIRECTORY/$GERRIT_PROJECT && git rev-parse HEAD) } +# This function allows developers to specify the specific XCI flavor for the +# impacted scenario by adding the XCI Flavor info about the specific scenario. +# This results in either skipping the real verification +# totally or skipping the determining the installer and scenario programmatically. +# It is important to note that this feature is only available to generic scenarios +# and only single installer/scenario pair is allowed. +# The input in commit message should be placed at the end of the commit message body, +# before the signed-off and change-id lines. +# +# Pattern to be searched in Commit Message +# xci-flavor:<xci-flavor> +# Examples: +# xci-flavor:noha +function override_xci_flavor() { + echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC" + + # process commit message for XCI Flavor + if [[ "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "xci-flavor:" ]]; then + XCI_FLAVOR=$(echo $GERRIT_CHANGE_COMMIT_MESSAGE | awk '/xci-flavor:/' RS=" " | cut -d":" -f2) + + if [[ -z "$XCI_FLAVOR" ]]; then + XCI_FLAVOR='mini' + echo "XCI flavor is not specified. The default is specified instead (i.e. mini). Falling back to programmatically determining them." + echo "XCI_FLAVOR=mini" >> $WORK_DIRECTORY/scenario.properties + exit 0 + else + echo "Recording the XCI flavor '$XCI_FLAVOR' for downstream jobs" + echo "XCI_FLAVOR=$XCI_FLAVOR" >> $WORK_DIRECTORY/scenario.properties + exit 0 + fi + else + XCI_FLAVOR='mini' + echo "XCI flavor is not specified. The default is specified instead (i.e. mini). Falling back to programmatically determining them." + echo "XCI_FLAVOR=mini" >> $WORK_DIRECTORY/scenario.properties + exit 0 + fi + +} + echo "Determining the impacted scenario" declare -a DEPLOY_SCENARIO @@ -169,6 +208,7 @@ if [[ $GERRIT_PROJECT == "releng-xci" ]]; then determine_default_scenario else determine_scenario + override_xci_flavor fi override_scenario |