X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fxci%2Fxci-set-scenario.sh;h=2c35f2780141fcede14eec36b8dc4644540e7bdf;hb=4fc988b325df2d028463bef72820850b8d3111d7;hp=7bc45f1c2e997ab639aa47f1bd84ef68a6db6266;hpb=a5ada7e9390cb87b858a29370a7dc09507c07c2e;p=releng.git diff --git a/jjb/xci/xci-set-scenario.sh b/jjb/xci/xci-set-scenario.sh index 7bc45f1c2..2c35f2780 100755 --- a/jjb/xci/xci-set-scenario.sh +++ b/jjb/xci/xci-set-scenario.sh @@ -8,6 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## set -o pipefail +set -x #---------------------------------------------------------------------- # This script is used by CI and executed by Jenkins jobs. @@ -152,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: +# 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 @@ -166,9 +206,11 @@ WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO if [[ $GERRIT_PROJECT == "releng-xci" ]]; then determine_default_scenario +else + determine_scenario + override_xci_flavor fi override_scenario -determine_scenario # ensure single scenario is impacted if [[ $(IFS=$'\n' echo ${DEPLOY_SCENARIO[@]} | wc -w) != 1 ]]; then