summaryrefslogtreecommitdiffstats
path: root/jjb/xci
diff options
context:
space:
mode:
Diffstat (limited to 'jjb/xci')
-rw-r--r--jjb/xci/bifrost-verify-jobs.yml7
-rw-r--r--jjb/xci/osa-periodic-jobs.yml1
-rwxr-xr-xjjb/xci/xci-cleanup.sh8
-rw-r--r--jjb/xci/xci-daily-jobs.yml6
-rw-r--r--jjb/xci/xci-merge-jobs.yml351
-rwxr-xr-xjjb/xci/xci-promote.sh28
-rwxr-xr-xjjb/xci/xci-run-functest.sh19
-rwxr-xr-xjjb/xci/xci-set-scenario.sh218
-rwxr-xr-xjjb/xci/xci-start-deployment.sh3
-rwxr-xr-xjjb/xci/xci-start-new-vm.sh5
-rw-r--r--jjb/xci/xci-verify-jobs.yml40
11 files changed, 556 insertions, 130 deletions
diff --git a/jjb/xci/bifrost-verify-jobs.yml b/jjb/xci/bifrost-verify-jobs.yml
index 7e0117565..2fb7c2167 100644
--- a/jjb/xci/bifrost-verify-jobs.yml
+++ b/jjb/xci/bifrost-verify-jobs.yml
@@ -162,6 +162,13 @@
recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
# yamllint enable rule:line-length
- email-jenkins-admins-on-failure
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
+
# -------------------------------
# trigger macros
# -------------------------------
diff --git a/jjb/xci/osa-periodic-jobs.yml b/jjb/xci/osa-periodic-jobs.yml
index e604a0a03..6c2d165a4 100644
--- a/jjb/xci/osa-periodic-jobs.yml
+++ b/jjb/xci/osa-periodic-jobs.yml
@@ -216,6 +216,7 @@
export FUNCTEST_MODE=$FUNCTEST_MODE
export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
export XCI_FLAVOR=$XCI_FLAVOR
+ export CORE_OPENSTACK_INSTALL=true
export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/
export INSTALLER_TYPE=$INSTALLER_TYPE
diff --git a/jjb/xci/xci-cleanup.sh b/jjb/xci/xci-cleanup.sh
index ce84830aa..51a863da2 100755
--- a/jjb/xci/xci-cleanup.sh
+++ b/jjb/xci/xci-cleanup.sh
@@ -14,11 +14,15 @@
# what you are doing.
#----------------------------------------------------------------------
+# Need to cover macros with and without parameters
+VM_NAME=$DISTRO
+VM_NAME+=_xci_vm
+
# skip the deployment if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
echo "Skipping the deployment!"
exit 0
fi
-sudo virsh destroy ${DISTRO}_xci_vm || true
-sudo virsh undefine ${DISTRO}_xci_vm || true
+sudo virsh destroy $VM_NAME || true
+sudo virsh undefine $VM_NAME || true
diff --git a/jjb/xci/xci-daily-jobs.yml b/jjb/xci/xci-daily-jobs.yml
index a92e49085..11db4e168 100644
--- a/jjb/xci/xci-daily-jobs.yml
+++ b/jjb/xci/xci-daily-jobs.yml
@@ -154,6 +154,12 @@
recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
# yamllint enable rule:line-length
- email-jenkins-admins-on-failure
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
- job-template:
name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
diff --git a/jjb/xci/xci-merge-jobs.yml b/jjb/xci/xci-merge-jobs.yml
index 492348d63..d6442a976 100644
--- a/jjb/xci/xci-merge-jobs.yml
+++ b/jjb/xci/xci-merge-jobs.yml
@@ -2,51 +2,49 @@
- project:
name: 'opnfv-xci-merge'
+ project: releng-xci
# -------------------------------
# branches
# -------------------------------
stream:
- master:
branch: '{stream}'
+ disabled: false
# -------------------------------
# distros
# -------------------------------
distro:
- ubuntu:
disabled: false
+ kill-phase-on: FAILURE
+ abort-all-job: true
- centos:
- disabled: false
+ disabled: true
+ kill-phase-on: NEVER
+ abort-all-job: false
- opensuse:
disabled: false
+ kill-phase-on: FAILURE
+ abort-all-job: true
# -------------------------------
- # type
- # -------------------------------
- type:
- - virtual
- # -------------------------------
- # patch verification phases
+ # postmerge promotion phases
# -------------------------------
phase:
- 'deploy'
- 'healthcheck'
- - 'promote'
- # -------------------------------
- # scenarios
- # -------------------------------
- scenario:
- - 'os-odl-sfc':
- project: sfc
# -------------------------------
# jobs
# -------------------------------
jobs:
- - 'xci-{scenario}-{type}-{distro}-merge-{stream}'
- - 'xci-{phase}-{type}-{distro}-merge-{stream}'
+ - 'xci-merge-virtual-{stream}'
+ - 'xci-merge-promote-virtual-{stream}'
+ - 'xci-merge-{distro}-virtual-{stream}'
+ - 'xci-merge-{distro}-{phase}-virtual-{stream}'
# -------------------------------
# job templates
# -------------------------------
- job-template:
- name: 'xci-{scenario}-{type}-{distro}-merge-{stream}'
+ name: 'xci-merge-virtual-{stream}'
project-type: multijob
@@ -56,22 +54,6 @@
properties:
- logrotate-default
- - build-blocker:
- use-build-blocker: true
- blocking-jobs:
- - 'xci-verify-{distro}-.*'
- - 'xci-.*-{distro}-merge-.*'
- - 'openstack-bifrost-verify-{distro}-.*'
- - 'xci-osa-verify-{distro}-.*'
- - 'xci-osa-periodic-{distro}-.*'
- - 'xci-(os|k8s).*?-virtual-{distro}-.*'
- block-level: 'NODE'
- - throttle:
- max-per-node: 2
- max-total: 10
- categories:
- - xci-verify-virtual
- option: category
wrappers:
- ssh-agent-wrapper
@@ -80,12 +62,7 @@
- fix-workspace-permissions
scm:
- - git:
- credentials-id: '$SSH_CREDENTIAL_ID'
- url: 'https://gerrit.opnfv.org/gerrit/releng-xci'
- branches:
- - 'origin/master'
- timeout: 15
+ - git-scm-gerrit
triggers:
- gerrit:
@@ -96,7 +73,22 @@
comment-contains-value: 'remerge'
projects:
- project-compare-type: 'ANT'
- project-pattern: '{obj:project}'
+ project-pattern: 'releng-xci'
+ branches:
+ - branch-compare-type: 'ANT'
+ branch-pattern: '**/{branch}'
+ disable-strict-forbidden-file-verification: 'false'
+ forbidden-file-paths:
+ - compare-type: ANT
+ pattern: 'xci/scripts/vm/**'
+ - compare-type: ANT
+ pattern: 'docs/**'
+ - compare-type: ANT
+ pattern: 'prototypes/**'
+ - compare-type: ANT
+ pattern: 'upstream/**'
+ - project-compare-type: 'REG_EXP'
+ project-pattern: 'sfc|sdnvpn'
branches:
- branch-compare-type: 'ANT'
branch-pattern: '**/{branch}'
@@ -109,14 +101,23 @@
parameters:
- project-parameter:
- project: '{obj:project}'
+ project: $GERRIT_PROJECT
branch: '{branch}'
- label:
name: SLAVE_LABEL
default: 'xci-virtual'
- string:
- name: DEPLOY_SCENARIO
- default: '{scenario}'
+ name: CI_LOOP
+ default: 'merge'
+ - string:
+ name: FUNCTEST_MODE
+ default: 'tier'
+ - string:
+ name: FUNCTEST_SUITE_NAME
+ default: 'healthcheck'
+ - string:
+ name: DISTRO
+ default: 'all'
- string:
name: CLEAN_DIB_IMAGES
default: 'true'
@@ -126,53 +127,205 @@
description: 'Git URL to use on this Jenkins Slave'
builders:
+ - 'xci-merge-set-scenario-macro'
+ - inject:
+ properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
- description-setter:
- description: "Built on $NODE_NAME"
+ description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
+ - multijob:
+ name: deploy and test
+ condition: SUCCESSFUL
+ projects:
+ - name: 'xci-merge-opensuse-virtual-{stream}'
+ current-parameters: false
+ predefined-parameters: |
+ DISTRO=opensuse
+ CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+ GERRIT_PROJECT=$GERRIT_PROJECT
+ GERRIT_BRANCH=$GERRIT_BRANCH
+ GERRIT_REFSPEC=$GERRIT_REFSPEC
+ GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+ GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+ CI_LOOP=$CI_LOOP
+ FUNCTEST_MODE=$FUNCTEST_MODE
+ FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
+ node-parameters: false
+ kill-phase-on: FAILURE
+ abort-all-job: true
+ - name: 'xci-merge-ubuntu-virtual-{stream}'
+ current-parameters: false
+ predefined-parameters: |
+ DISTRO=ubuntu
+ CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+ GERRIT_PROJECT=$GERRIT_PROJECT
+ GERRIT_BRANCH=$GERRIT_BRANCH
+ GERRIT_REFSPEC=$GERRIT_REFSPEC
+ GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+ GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+ CI_LOOP=$CI_LOOP
+ FUNCTEST_MODE=$FUNCTEST_MODE
+ FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
+ node-parameters: false
+ kill-phase-on: FAILURE
+ abort-all-job: true
+ - name: 'xci-merge-centos-virtual-{stream}'
+ current-parameters: false
+ predefined-parameters: |
+ DISTRO=centos
+ CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+ GERRIT_PROJECT=$GERRIT_PROJECT
+ GERRIT_BRANCH=$GERRIT_BRANCH
+ GERRIT_REFSPEC=$GERRIT_REFSPEC
+ GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+ GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+ CI_LOOP=$CI_LOOP
+ FUNCTEST_MODE=$FUNCTEST_MODE
+ FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
+ node-parameters: false
+ kill-phase-on: NEVER
+ abort-all-job: false
+ - inject:
+ properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
+ - multijob:
+ name: promote
+ condition: SUCCESSFUL
+ projects:
+ - name: 'xci-merge-promote-virtual-{stream}'
+ current-parameters: true
+ predefined-parameters: |
+ GERRIT_PROJECT=$GERRIT_PROJECT
+ GERRIT_BRANCH=$GERRIT_BRANCH
+ GERRIT_REFSPEC=$GERRIT_REFSPEC
+ GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+ GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+ CI_LOOP=$CI_LOOP
+ FUNCTEST_MODE=$FUNCTEST_MODE
+ FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
+ node-parameters: true
+ kill-phase-on: NEVER
+ abort-all-job: true
+
+- job-template:
+ name: 'xci-merge-{distro}-virtual-{stream}'
+
+ project-type: multijob
+
+ disabled: '{obj:disabled}'
+
+ concurrent: false
+
+ properties:
+ - logrotate-default
+ - build-blocker:
+ use-build-blocker: true
+ blocking-jobs:
+ - 'xci-verify-{distro}-.*'
+ - 'xci-merge-{distro}-.*'
+ - 'openstack-bifrost-verify-{distro}-.*'
+ - 'xci-osa-verify-{distro}-.*'
+ - 'xci-osa-periodic-{distro}-.*'
+ block-level: 'NODE'
+ - throttle:
+ max-per-node: 1
+ max-total: 3
+ categories:
+ - xci-verify-virtual
+ option: category
+
+ wrappers:
+ - ssh-agent-wrapper
+ - build-timeout:
+ timeout: 240
+ - fix-workspace-permissions
+
+ scm:
+ - git-scm-gerrit
+
+ parameters:
+ - project-parameter:
+ project: $GERRIT_PROJECT
+ branch: '{branch}'
+ - label:
+ name: SLAVE_LABEL
+ default: 'xci-virtual'
+ - string:
+ name: CI_LOOP
+ default: 'merge'
+ - string:
+ name: FUNCTEST_MODE
+ default: 'tier'
+ - string:
+ name: FUNCTEST_SUITE_NAME
+ default: 'healthcheck'
+ - string:
+ name: DISTRO
+ default: '{distro}'
+ - string:
+ name: CLEAN_DIB_IMAGES
+ default: 'true'
+ - string:
+ name: GIT_BASE
+ default: https://gerrit.opnfv.org/gerrit/$PROJECT
+ description: 'Git URL to use on this Jenkins Slave'
+
+ builders:
+ - 'xci-merge-set-scenario-macro'
+ - inject:
+ properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
+ - description-setter:
+ description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
- multijob:
name: deploy
condition: SUCCESSFUL
projects:
- - name: 'xci-deploy-{type}-{distro}-merge-{stream}'
+ - name: 'xci-merge-{distro}-deploy-virtual-{stream}'
current-parameters: true
predefined-parameters: |
- PROJECT=$PROJECT
DISTRO={distro}
- DEPLOY_SCENARIO={scenario}
CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+ GERRIT_PROJECT=$GERRIT_PROJECT
GERRIT_BRANCH=$GERRIT_BRANCH
GERRIT_REFSPEC=$GERRIT_REFSPEC
GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
node-parameters: true
- kill-phase-on: FAILURE
- abort-all-job: true
+ kill-phase-on: '{kill-phase-on}'
+ abort-all-job: '{abort-all-job}'
- multijob:
name: healthcheck
condition: SUCCESSFUL
projects:
- - name: 'xci-healthcheck-{type}-{distro}-merge-{stream}'
+ - name: 'xci-merge-{distro}-healthcheck-virtual-{stream}'
current-parameters: true
predefined-parameters: |
- PROJECT=$PROJECT
DISTRO={distro}
- DEPLOY_SCENARIO={scenario}
CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
- FUNCTEST_MODE=tier
- FUNCTEST_TIER=healthcheck
+ GERRIT_PROJECT=$GERRIT_PROJECT
GERRIT_BRANCH=$GERRIT_BRANCH
GERRIT_REFSPEC=$GERRIT_REFSPEC
GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+ CI_LOOP=$CI_LOOP
+ FUNCTEST_MODE=$FUNCTEST_MODE
+ FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
node-parameters: true
- kill-phase-on: NEVER
- abort-all-job: true
+ kill-phase-on: '{kill-phase-on}'
+ abort-all-job: '{abort-all-job}'
+
+ publishers:
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
- job-template:
- name: 'xci-{phase}-{type}-{distro}-merge-{stream}'
+ name: 'xci-merge-{distro}-{phase}-virtual-{stream}'
disabled: false
- concurrent: true
+ concurrent: false
properties:
- logrotate-default
@@ -188,13 +341,13 @@
parameters:
- string:
name: PROJECT
- default: 'releng-xci'
+ default: $GERRIT_PROJECT
- string:
name: DISTRO
default: 'ubuntu'
- string:
- name: DEPLOY_SCENARIO
- default: 'os-nosdn-nofeature-noha'
+ name: CI_LOOP
+ default: 'merge'
- string:
name: FUNCTEST_MODE
default: 'tier'
@@ -211,40 +364,94 @@
name: OPNFV_RELENG_DEV_PATH
default: $WORKSPACE/
- string:
- name: INSTALLER_TYPE
- default: 'osa'
- - string:
name: GIT_BASE
default: https://gerrit.opnfv.org/gerrit/$PROJECT
description: 'Git URL to use on this Jenkins Slave'
wrappers:
+ - inject:
+ properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
- ssh-agent-wrapper
- build-timeout:
timeout: 240
- fix-workspace-permissions
scm:
- - git:
- credentials-id: '$SSH_CREDENTIAL_ID'
- url: 'https://gerrit.opnfv.org/gerrit/releng-xci'
- branches:
- - 'origin/master'
- timeout: 15
+ - git-scm-gerrit
builders:
- description-setter:
- description: "Built on $NODE_NAME"
+ description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
- 'xci-merge-{phase}-macro'
+- job-template:
+ name: 'xci-merge-promote-virtual-{stream}'
+
+ disabled: false
+
+ concurrent: false
+
+ properties:
+ - logrotate-default
+
+ parameters:
+ - string:
+ name: PROJECT
+ default: $GERRIT_PROJECT
+ - string:
+ name: CI_LOOP
+ default: 'merge'
+ - string:
+ name: FUNCTEST_MODE
+ default: 'tier'
+ - string:
+ name: FUNCTEST_SUITE_NAME
+ default: 'healthcheck'
+ - string:
+ name: DISTRO
+ default: 'all'
+ - string:
+ name: OPNFV_RELENG_DEV_PATH
+ default: $WORKSPACE/
+ - string:
+ name: LOCAL_PROMOTION_METADATA_FILE
+ default: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
+ - string:
+ name: REMOTE_PROMOTION_METADATA_FILE
+ default: "gs://artifacts.opnfv.org/xci/pipeline/merge/$DEPLOY_SCENARIO.properties"
+ - string:
+ name: GIT_BASE
+ default: https://gerrit.opnfv.org/gerrit/$PROJECT
+ description: 'Git URL to use on this Jenkins Slave'
+
+ wrappers:
+ - inject:
+ properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
+ - ssh-agent-wrapper
+ - build-timeout:
+ timeout: 240
+ - fix-workspace-permissions
+
+ builders:
+ - description-setter:
+ description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
+ - 'xci-merge-promote-macro'
+
# -------------------------------
# builder macros
# -------------------------------
- builder:
+ name: 'xci-merge-set-scenario-macro'
+ builders:
+ - shell:
+ !include-raw: ./xci-set-scenario.sh
+
+- builder:
name: 'xci-merge-deploy-macro'
builders:
- shell:
!include-raw: ./xci-start-new-vm.sh
+
- shell:
!include-raw: ./xci-start-deployment.sh
@@ -253,8 +460,6 @@
builders:
- shell:
!include-raw: ./xci-run-functest.sh
- - shell:
- !include-raw: ./xci-cleanup.sh
- builder:
name: 'xci-merge-promote-macro'
diff --git a/jjb/xci/xci-promote.sh b/jjb/xci/xci-promote.sh
index 98ad7ff4a..fb7e0e6fa 100755
--- a/jjb/xci/xci-promote.sh
+++ b/jjb/xci/xci-promote.sh
@@ -14,17 +14,33 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the healthcheck if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
echo "Skipping the healthcheck!"
exit 0
fi
-# skip the deployment if the scenario is not supported on this distro
-OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml
-if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then
- echo "# SKIPPED: Scenario $DEPLOY_SCENARIO is NOT supported on $DISTRO"
- exit 0
+# fail if promotion metadata file doesn't exist
+if [ ! -f $LOCAL_PROMOTION_METADATA_FILE ]; then
+ echo "Unable to find promotion metadata file $LOCAL_PROMOTION_METADATA_FILE"
+ echo "Skipping promotion!"
+ exit 1
fi
-echo "Hello World!"
+# upload promotion metadata file to OPNFV artifact repo
+echo "Storing promotion metadata as $REMOTE_PROMOTION_METADATA_FILE"
+gsutil cp $LOCAL_PROMOTION_METADATA_FILE $REMOTE_PROMOTION_METADATA_FILE > /dev/null 2>&1
+
+# update the file metadata on gs to prevent the use of cached version of the file
+gsutil -m setmeta -r -h "Cache-Control:private, max-age=0, no-transform" \
+ $REMOTE_PROMOTION_METADATA_FILE > /dev/null 2>&1
+
+# log the metadata to console
+echo "Stored the metadata for $DEPLOY_SCENARIO"
+echo "---------------------------------------------------------------------------------"
+gsutil cat $REMOTE_PROMOTION_METADATA_FILE
+echo "---------------------------------------------------------------------------------"
+echo "Scenario $DEPLOY_SCENARIO has successfully been promoted!"
diff --git a/jjb/xci/xci-run-functest.sh b/jjb/xci/xci-run-functest.sh
index 238a833d0..2e343631b 100755
--- a/jjb/xci/xci-run-functest.sh
+++ b/jjb/xci/xci-run-functest.sh
@@ -7,6 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+set -o nounset
#----------------------------------------------------------------------
# This script is used by CI and executed by Jenkins jobs.
@@ -14,12 +15,21 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the healthcheck if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
echo "Skipping the healthcheck!"
exit 0
fi
+# skip the healthcheck if the scenario is Kubernetes scenario
+if [[ "$DEPLOY_SCENARIO" =~ k8 ]]; then
+ echo "Skipping the healthcheck!"
+ exit 0
+fi
+
# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since
# the project where the scenario is coming from is cloned and the patch checked out to the
# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM
@@ -42,3 +52,12 @@ fi
ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm "cd releng-xci/xci && PATH=/home/devuser/.local/bin:$PATH ansible-playbook -i installer/osa/files/$XCI_FLAVOR/inventory playbooks/prepare-functest.yml"
echo "Running functest"
ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm_opnfv "/root/run-functest.sh"
+echo "Functest log"
+echo "---------------------------------------------------------------------------------"
+ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm_opnfv "cat /root/results/functest.log"
+echo "---------------------------------------------------------------------------------"
+# check the log to see if we have any error
+if ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm_opnfv "grep -q 'FAIL' /root/results/functest.log"; then
+ echo "Error: Functest failed!"
+ exit 1
+fi
diff --git a/jjb/xci/xci-set-scenario.sh b/jjb/xci/xci-set-scenario.sh
index 764857ba4..c3012cd88 100755
--- a/jjb/xci/xci-set-scenario.sh
+++ b/jjb/xci/xci-set-scenario.sh
@@ -8,7 +8,6 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -o errexit
-set -o nounset
set -o pipefail
#----------------------------------------------------------------------
@@ -17,64 +16,201 @@ set -o pipefail
# what you are doing.
#----------------------------------------------------------------------
-WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO
-/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
+# This function allows developers to specify the impacted scenario by adding
+# the info about installer and scenario into the commit message or using
+# the topic branch names. 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
+# deploy-scenario:<scenario-name>
+# installer-type:<installer-type>
+# Examples:
+# deploy-scenario:os-odl-nofeature
+# installer-type:osa
+#
+# deploy-scenario:k8-nosdn-nofeature
+# installer-type:kubespray
+#
+# Patterns to be searched in topic branch name
+# skip-verify
+# skip-deployment
+# force-verify
+function override_generic_scenario() {
+ echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
-# ensure GERRIT_TOPIC is set
-GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+ # ensure the metadata we record is consistent for all types of patches including skipped ones
+ # extract releng-xci sha
+ XCI_SHA=$(cd $WORKSPACE && git rev-parse HEAD)
-# skip the healthcheck if the patch doesn't impact the deployment
-if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
- echo "Skipping verify!"
- echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties
- exit 0
-fi
+ # extract scenario sha which is same as releng-xci sha for generic scenarios
+ SCENARIO_SHA=$XCI_SHA
+
+ # process topic branch names
+ if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment|force-verify ]]; then
+ [[ "$GERRIT_TOPIC" =~ force-verify ]] && echo "Forcing CI verification using default scenario and installer!"
+ [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]] && echo "Skipping verification!"
+ echo "INSTALLER_TYPE=osa" > $WORK_DIRECTORY/scenario.properties
+ echo "DEPLOY_SCENARIO=os-nosdn-nofeature" >> $WORK_DIRECTORY/scenario.properties
+ echo "XCI_SHA=$XCI_SHA" >> $WORK_DIRECTORY/scenario.properties
+ echo "SCENARIO_SHA=$SCENARIO_SHA" >> $WORK_DIRECTORY/scenario.properties
+ echo "PROJECT_NAME=$GERRIT_PROJECT" >> $WORK_DIRECTORY/scenario.properties
+ exit 0
+ fi
+
+ # process commit message
+ if [[ "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "installer-type:" && "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "deploy-scenario:" ]]; then
+ INSTALLER_TYPE=$(echo $GERRIT_CHANGE_COMMIT_MESSAGE | awk '/installer-type:/' RS=" " | cut -d":" -f2)
+ DEPLOY_SCENARIO=$(echo $GERRIT_CHANGE_COMMIT_MESSAGE | awk '/deploy-scenario:/' RS=" " | cut -d":" -f2)
+
+ if [[ -z "$INSTALLER_TYPE" || -z "$DEPLOY_SCENARIO" ]]; then
+ echo "Installer type or deploy scenario is not specified. Falling back to programmatically determining them."
+ else
+ echo "Recording the installer '$INSTALLER_TYPE' and scenario '$DEPLOY_SCENARIO' for downstream jobs"
+ echo "INSTALLER_TYPE=$INSTALLER_TYPE" > $WORK_DIRECTORY/scenario.properties
+ echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" >> $WORK_DIRECTORY/scenario.properties
+ echo "XCI_SHA=$XCI_SHA" >> $WORK_DIRECTORY/scenario.properties
+ echo "SCENARIO_SHA=$SCENARIO_SHA" >> $WORK_DIRECTORY/scenario.properties
+ echo "PROJECT_NAME=$GERRIT_PROJECT" >> $WORK_DIRECTORY/scenario.properties
+ exit 0
+ fi
+ else
+ echo "Installer type or deploy scenario is not specified. Falling back to programmatically determining them."
+ fi
+}
-# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since
-# the project where the scenario is coming from is cloned and the patch checked out to the
-# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM
-# apart from that, we need releng-xci stuff in WORKSPACE for things to function correctly on Jenkins.
-# if the change is coming to releng-xci, we don't need to do anything since the patch is checked
-# out to the WORKSPACE anyways
-if [[ $GERRIT_PROJECT != "releng-xci" ]]; then
+# This function determines the impacted generic scenario by processing the
+# change and using diff to see what changed. If changed files belong to a scenario
+# its name gets recorded for deploying and testing the right scenario.
+#
+# Pattern to be searched in Changeset
+# releng-xci/scenarios/<scenario>/<impacted files>: <scenario>
+# releng-xci/xci/installer/osa/<impacted files>: os-nosdn-nofeature
+# releng-xci/xci/installer/kubespray/<impacted files>: k8-nosdn-nofeature
+# the rest: os-nosdn-nofeature
+function determine_generic_scenario() {
+ echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
+
+ # get the changeset
+ cd $WORKSPACE
+ CHANGESET=$(git diff HEAD^..HEAD --name-only)
+ for CHANGED_FILE in $CHANGESET; do
+ case $CHANGED_FILE in
+ *k8-nosdn*|*kubespray*)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "k8-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='k8-nosdn-nofeature'
+ ;;
+ *os-odl*)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "os-odl-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-odl-nofeature'
+ ;;
+ *os-nosdn*|*osa*)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "os-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-nosdn-nofeature'
+ ;;
+ *)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "os-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-nosdn-nofeature'
+ ;;
+ esac
+ done
+
+ # extract releng-xci sha
+ XCI_SHA=$(cd $WORKSPACE && git rev-parse HEAD)
+
+ # extract scenario sha which is same as releng-xci sha for generic scenarios
+ SCENARIO_SHA=$XCI_SHA
+}
+
+# This function determines the impacted external scenario by processing the Gerrit
+# change and using diff to see what changed. If changed files belong to a scenario
+# its name gets recorded for deploying and testing the right scenario.
+#
+# Pattern
+# <project-repo>/scenarios/<scenario>/<impacted files>: <scenario>
+function determine_external_scenario() {
+ echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
+
+ # remove the clone that is done via jenkins and place releng-xci there so the
+ # things continue functioning properly
cd $HOME && /bin/rm -rf $WORKSPACE
- git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+ git clone -q https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+
+ # fix the permissions so ssh doesn't complain due to having world-readable keyfiles
chmod -R go-rwx $WORKSPACE/xci/scripts/vm
-fi
-# if change is coming to releng-xci, continue as usual until that part is fixed as well
-if [[ $GERRIT_PROJECT == "releng-xci" ]]; then
- # save the scenario name into java properties file to be injected to downstream jobs via envInject
- echo "Recording scenario name for downstream jobs"
- echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties
- exit 0
-fi
+ # clone the project repo and fetch the patchset to process for further processing
+ git clone -q https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $WORK_DIRECTORY/$GERRIT_PROJECT
+ cd $WORK_DIRECTORY/$GERRIT_PROJECT
+ git fetch -q https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout -q FETCH_HEAD
+
+ # process the diff to find out what scenario(s) are impacted - there should only be 1
+ DEPLOY_SCENARIO+=$(git diff HEAD^..HEAD --name-only | grep scenarios | awk -F '[/|/]' '{print $2}' | uniq)
+
+ # extract releng-xci sha
+ XCI_SHA=$(cd $WORKSPACE && git rev-parse HEAD)
-# projects develop different scenarios and jobs need to know which scenario got the
-# change under test so the jobs can deploy and test the right scenario.
-# we need to fetch the change and look at the changeset to find out the scenario instead
-# of hardcoding scenario per project.
+ # extract scenario sha
+ SCENARIO_SHA=$(cd $WORK_DIRECTORY/$GERRIT_PROJECT && git rev-parse HEAD)
+}
-git clone https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $WORK_DIRECTORY/$GERRIT_PROJECT
-cd $WORK_DIRECTORY/$GERRIT_PROJECT
-git fetch https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD
-DEPLOY_SCENARIO=$(git diff HEAD^..HEAD --name-only | grep scenarios | awk -F '[/|/]' '{print $2}' | uniq)
+echo "Determining the impacted scenario"
+
+declare -a DEPLOY_SCENARIO
+
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
+# this directory is where the temporary clones and files are created
+# while extracting the impacted scenario
+WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO
+/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
+
+if [[ $GERRIT_PROJECT == "releng-xci" ]]; then
+ override_generic_scenario
+ determine_generic_scenario
+else
+ determine_external_scenario
+fi
# ensure single scenario is impacted
-if [[ $(echo $DEPLOY_SCENARIO | wc -w) != 1 ]]; then
+ if [[ $(IFS=$'\n' echo ${DEPLOY_SCENARIO[@]} | wc -w) != 1 ]]; then
echo "Change impacts multiple scenarios!"
echo "XCI doesn't support testing of changes that impact multiple scenarios currently."
echo "Please split your change into multiple different/dependent changes, each modifying single scenario."
exit 1
fi
-# save the scenario name into java properties file to be injected to downstream jobs via envInject
-echo "Recording scenario name '$DEPLOY_SCENARIO' for downstream jobs"
-echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" > $WORK_DIRECTORY/scenario.properties
+# set the installer
+case ${DEPLOY_SCENARIO[0]} in
+ os-*)
+ INSTALLER_TYPE=osa
+ ;;
+ k8-*)
+ INSTALLER_TYPE=kubespray
+ ;;
+ *)
+ echo "Unable to determine the installer. Exiting!"
+ exit 1
+ ;;
+esac
+
+# save the installer and scenario names into java properties file
+# so they can be injected to downstream jobs via envInject
+echo "Recording the installer '$INSTALLER_TYPE' and scenario '${DEPLOY_SCENARIO[0]}' and SHAs for downstream jobs"
+echo "INSTALLER_TYPE=$INSTALLER_TYPE" > $WORK_DIRECTORY/scenario.properties
+echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" >> $WORK_DIRECTORY/scenario.properties
+echo "XCI_SHA=$XCI_SHA" >> $WORK_DIRECTORY/scenario.properties
+echo "SCENARIO_SHA=$SCENARIO_SHA" >> $WORK_DIRECTORY/scenario.properties
+echo "PROJECT_NAME=$GERRIT_PROJECT" >> $WORK_DIRECTORY/scenario.properties
+
+# skip scenario support check if the job is promotion job
+if [[ "$JOB_NAME" =~ (os|k8) ]]; then
+ exit 0
+fi
# skip the deployment if the scenario is not supported on this distro
OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml
-if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then
- echo "# SKIPPED: Scenario $DEPLOY_SCENARIO is NOT supported on $DISTRO"
+if ! sed -n "/^- scenario: ${DEPLOY_SCENARIO[0]}$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then
+ echo "# SKIPPED: Scenario ${DEPLOY_SCENARIO[0]} is NOT supported on $DISTRO"
exit 0
fi
diff --git a/jjb/xci/xci-start-deployment.sh b/jjb/xci/xci-start-deployment.sh
index 0628829ea..102ca41c3 100755
--- a/jjb/xci/xci-start-deployment.sh
+++ b/jjb/xci/xci-start-deployment.sh
@@ -14,6 +14,9 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the deployment if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
echo "Skipping the deployment!"
diff --git a/jjb/xci/xci-start-new-vm.sh b/jjb/xci/xci-start-new-vm.sh
index d676e2662..7874e6776 100755
--- a/jjb/xci/xci-start-new-vm.sh
+++ b/jjb/xci/xci-start-new-vm.sh
@@ -14,6 +14,9 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the deployment if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
echo "Skipping the deployment!"
@@ -53,6 +56,8 @@ export DEPLOY_SCENARIO=$DEPLOY_SCENARIO
export FUNCTEST_MODE=$FUNCTEST_MODE
export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
export XCI_FLAVOR=$XCI_FLAVOR
+export CORE_OPENSTACK_INSTALL=true
+export BIFROST_USE_PREBUILT_IMAGES=true
export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/
export INSTALLER_TYPE=$INSTALLER_TYPE
diff --git a/jjb/xci/xci-verify-jobs.yml b/jjb/xci/xci-verify-jobs.yml
index c54a1b941..e5c1a9394 100644
--- a/jjb/xci/xci-verify-jobs.yml
+++ b/jjb/xci/xci-verify-jobs.yml
@@ -66,7 +66,7 @@
use-build-blocker: true
blocking-jobs:
- 'xci-verify-{distro}-.*'
- - 'xci-.*-{distro}-merge-.*'
+ - 'xci-merge-{distro}-.*'
- 'openstack-bifrost-verify-{distro}-.*'
- 'xci-osa-verify-{distro}-.*'
- 'xci-osa-periodic-{distro}-.*'
@@ -110,6 +110,12 @@
forbidden-file-paths:
- compare-type: ANT
pattern: 'xci/scripts/vm/**'
+ - compare-type: ANT
+ pattern: 'docs/**'
+ - compare-type: ANT
+ pattern: 'prototypes/**'
+ - compare-type: ANT
+ pattern: 'upstream/**'
- project-compare-type: 'REG_EXP'
project-pattern: 'sfc|sdnvpn'
branches:
@@ -141,6 +147,15 @@
name: CLEAN_DIB_IMAGES
default: 'true'
- string:
+ name: CI_LOOP
+ default: 'verify'
+ - string:
+ name: FUNCTEST_MODE
+ default: 'tier'
+ - string:
+ name: FUNCTEST_SUITE_NAME
+ default: 'healthcheck'
+ - string:
name: GIT_BASE
default: https://gerrit.opnfv.org/gerrit/$PROJECT
description: 'Git URL to use on this Jenkins Slave'
@@ -165,6 +180,7 @@
GERRIT_REFSPEC=$GERRIT_REFSPEC
GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+ CI_LOOP=$CI_LOOP
node-parameters: true
kill-phase-on: FAILURE
abort-all-job: true
@@ -182,12 +198,22 @@
GERRIT_REFSPEC=$GERRIT_REFSPEC
GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
- FUNCTEST_MODE=tier
- FUNCTEST_TIER=healthcheck
+ CI_LOOP=$CI_LOOP
+ FUNCTEST_MODE=$FUNCTEST_MODE
+ FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
node-parameters: true
kill-phase-on: NEVER
abort-all-job: true
+ publishers:
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
+
+
- job-template:
name: 'xci-verify-{distro}-{phase}-{type}-{stream}'
@@ -214,6 +240,9 @@
name: DISTRO
default: 'ubuntu'
- string:
+ name: CI_LOOP
+ default: 'verify'
+ - string:
name: FUNCTEST_MODE
default: 'tier'
- string:
@@ -229,9 +258,6 @@
name: OPNFV_RELENG_DEV_PATH
default: $WORKSPACE/
- string:
- name: INSTALLER_TYPE
- default: 'osa'
- - string:
name: GIT_BASE
default: https://gerrit.opnfv.org/gerrit/$PROJECT
description: 'Git URL to use on this Jenkins Slave'
@@ -275,5 +301,3 @@
builders:
- shell:
!include-raw: ./xci-run-functest.sh
- - shell:
- !include-raw: ./xci-cleanup.sh