diff options
Diffstat (limited to 'jjb/xci')
-rwxr-xr-x | jjb/xci/xci-cleanup.sh | 24 | ||||
-rw-r--r-- | jjb/xci/xci-merge-jobs.yml | 257 | ||||
-rwxr-xr-x | jjb/xci/xci-promote.sh | 30 | ||||
-rwxr-xr-x | jjb/xci/xci-run-functest.sh | 30 | ||||
-rwxr-xr-x | jjb/xci/xci-start-deployment.sh | 30 | ||||
-rwxr-xr-x | jjb/xci/xci-start-new-vm.sh | 63 | ||||
-rw-r--r-- | jjb/xci/xci-verify-jobs.yml | 85 |
7 files changed, 442 insertions, 77 deletions
diff --git a/jjb/xci/xci-cleanup.sh b/jjb/xci/xci-cleanup.sh new file mode 100755 index 000000000..45b4ec273 --- /dev/null +++ b/jjb/xci/xci-cleanup.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 SUSE and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +#---------------------------------------------------------------------- +# This script is used by CI and executed by Jenkins jobs. +# You are not supposed to use this script manually if you don't know +# what you are doing. +#---------------------------------------------------------------------- + +# 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 +sudo virsh undefine ${DISTRO}_xci_vm diff --git a/jjb/xci/xci-merge-jobs.yml b/jjb/xci/xci-merge-jobs.yml new file mode 100644 index 000000000..351fe22bb --- /dev/null +++ b/jjb/xci/xci-merge-jobs.yml @@ -0,0 +1,257 @@ +--- +- project: + name: 'opnfv-xci-merge' + + # ------------------------------- + # branches + # ------------------------------- + stream: + - master: + branch: '{stream}' + # ------------------------------- + # distros + # ------------------------------- + distro: + - ubuntu: + disabled: false + - centos: + disabled: false + - opensuse: + disabled: false + # ------------------------------- + # type + # ------------------------------- + type: + - virtual + # ------------------------------- + # patch verification 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}' +# ------------------------------- +# job templates +# ------------------------------- +- job-template: + name: 'xci-{scenario}-{type}-{distro}-merge-{stream}' + + project-type: multijob + + disabled: '{obj:disabled}' + + concurrent: false + + properties: + - logrotate-default + - build-blocker: + use-build-blocker: true + blocking-jobs: + - 'xci-verify-{distro}-.*' + - 'bifrost-verify-{distro}-.*' + - 'bifrost-periodic-{distro}-.*' + - 'xci-osa-verify-{distro}-.*' + - 'xci-osa-periodic-{distro}-.*' + - 'xci-(os|k8s).*?-virtual-{distro}-.*' + block-level: 'NODE' + + wrappers: + - 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 + + triggers: + - gerrit: + server-name: 'gerrit.opnfv.org' + trigger-on: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: 'remerge' + projects: + - project-compare-type: 'ANT' + project-pattern: '{obj:project}' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + disable-strict-forbidden-file-verification: 'true' + file-paths: + - compare-type: ANT + pattern: 'scenarios/**' + readable-message: true + custom-url: '* $JOB_NAME $BUILD_URL' + + parameters: + - project-parameter: + project: '{obj:project}' + branch: '{branch}' + - label: + name: SLAVE_LABEL + default: 'xci-virtual' + - string: + name: DEPLOY_SCENARIO + default: '{scenario}' + - 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: + - description-setter: + description: "Built on $NODE_NAME" + - multijob: + name: deploy + condition: SUCCESSFUL + projects: + - name: 'xci-deploy-{type}-{distro}-merge-{stream}' + current-parameters: true + predefined-parameters: | + PROJECT=$PROJECT + DISTRO={distro} + DEPLOY_SCENARIO={scenario} + CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES + 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 + - multijob: + name: healthcheck + condition: SUCCESSFUL + projects: + - name: 'xci-healthcheck-{type}-{distro}-merge-{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_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: NEVER + abort-all-job: true + +- job-template: + name: 'xci-{phase}-{type}-{distro}-merge-{stream}' + + disabled: false + + concurrent: true + + properties: + - logrotate-default + - build-blocker: + use-build-blocker: true + blocking-jobs: + - '.*-bifrost-verify-.*' + - '.*-bifrost-periodic-.*' + - 'osa-verify-.*' + - 'osa-periodic-.*' + block-level: 'NODE' + + parameters: + - string: + name: PROJECT + default: 'releng-xci' + - string: + name: DISTRO + default: 'ubuntu' + - string: + name: DEPLOY_SCENARIO + default: 'os-nosdn-nofeature-noha' + - string: + name: FUNCTEST_MODE + default: 'tier' + - string: + name: FUNCTEST_SUITE_NAME + default: 'healthcheck' + - string: + name: XCI_FLAVOR + default: 'mini' + - string: + name: CLEAN_DIB_IMAGES + default: 'true' + - string: + 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: + - 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 + + builders: + - description-setter: + description: "Built on $NODE_NAME" + - 'xci-merge-{phase}-macro' + +# ------------------------------- +# builder macros +# ------------------------------- +- builder: + name: 'xci-merge-deploy-macro' + builders: + - shell: + !include-raw: ./xci-start-new-vm.sh + - shell: + !include-raw: ./xci-start-deployment.sh + +- builder: + name: 'xci-merge-healthcheck-macro' + builders: + - shell: + !include-raw: ./xci-run-functest.sh + - shell: + !include-raw: ./xci-cleanup.sh + +- builder: + name: 'xci-merge-promote-macro' + builders: + - shell: + !include-raw: ./xci-promote.sh diff --git a/jjb/xci/xci-promote.sh b/jjb/xci/xci-promote.sh new file mode 100755 index 000000000..98ad7ff4a --- /dev/null +++ b/jjb/xci/xci-promote.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 Ericsson and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +#---------------------------------------------------------------------- +# This script is used by CI and executed by Jenkins jobs. +# You are not supposed to use this script manually if you don't know +# what you are doing. +#---------------------------------------------------------------------- + +# 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 +fi + +echo "Hello World!" diff --git a/jjb/xci/xci-run-functest.sh b/jjb/xci/xci-run-functest.sh new file mode 100755 index 000000000..4fbc6c40d --- /dev/null +++ b/jjb/xci/xci-run-functest.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 SUSE and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +#---------------------------------------------------------------------- +# This script is used by CI and executed by Jenkins jobs. +# You are not supposed to use this script manually if you don't know +# what you are doing. +#---------------------------------------------------------------------- + +# 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 +fi + +echo "Hello World!" diff --git a/jjb/xci/xci-start-deployment.sh b/jjb/xci/xci-start-deployment.sh new file mode 100755 index 000000000..e86f5b3a1 --- /dev/null +++ b/jjb/xci/xci-start-deployment.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 SUSE and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +#---------------------------------------------------------------------- +# This script is used by CI and executed by Jenkins jobs. +# You are not supposed to use this script manually if you don't know +# what you are doing. +#---------------------------------------------------------------------- + +# skip the deployment if the patch doesn't impact the deployment +if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then + echo "Skipping the deployment!" + 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 +fi + +ssh -F $HOME/.ssh/xci-vm-config ${DISTRO}_xci_vm "cd releng-xci && ./xci_test.sh" diff --git a/jjb/xci/xci-start-new-vm.sh b/jjb/xci/xci-start-new-vm.sh new file mode 100755 index 000000000..b72c33920 --- /dev/null +++ b/jjb/xci/xci-start-new-vm.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 SUSE and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +#---------------------------------------------------------------------- +# This script is used by CI and executed by Jenkins jobs. +# You are not supposed to use this script manually if you don't know +# what you are doing. +#---------------------------------------------------------------------- + +# skip the deployment if the patch doesn't impact the deployment +if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then + echo "Skipping the deployment!" + 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 +fi + +cd $WORKSPACE + +# The start-new-vm.sh script will copy the entire releng-xci directory +# so lets prepare the test script now so it can be copied by the script. +# Please do not move it elsewhere or you would have to move it to the VM +# yourself. +cat > xci_test.sh<<EOF +#!/bin/bash +export DISTRO=$DISTRO +export DEPLOY_SCENARIO=$DEPLOY_SCENARIO +export FUNCTEST_MODE=$FUNCTEST_MODE +export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME +export XCI_FLAVOR=$XCI_FLAVOR +export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES +export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/ +export INSTALLER_TYPE=$INSTALLER_TYPE +export GIT_BASE=$GIT_BASE +export JENKINS_HOME=$JENKINS_HOME + +if [[ ! -z ${WORKSPACE+x} && $GERRIT_PROJECT != "releng-xci" ]]; then + git clone https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT xci/scenarios/$DEPLOY_SCENARIO && cd xci/scenarios/$DEPLOY_SCENARIO + git fetch https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD + cd - +fi + +cd xci +./xci-deploy.sh +EOF +chmod a+x xci_test.sh + +export XCI_BUILD_CLEAN_VM_OS=false +export XCI_UPDATE_CLEAN_VM_OS=true + +./xci/scripts/vm/start-new-vm.sh $DISTRO diff --git a/jjb/xci/xci-verify-jobs.yml b/jjb/xci/xci-verify-jobs.yml index fffd5c2b4..af2432dd0 100644 --- a/jjb/xci/xci-verify-jobs.yml +++ b/jjb/xci/xci-verify-jobs.yml @@ -244,85 +244,16 @@ - builder: name: 'xci-verify-deploy-macro' builders: - - shell: | - #!/bin/bash - - # skip the deployment if the patch doesn't impact the deployment - if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then - echo "Skipping the deployment!" - exit 0 - fi - - cd $WORKSPACE - - # The start-new-vm.sh script will copy the entire releng-xci directory - # so lets prepare the test script now so it can be copied by the script. - # Please do not move it elsewhere or you would have to move it to the VM - # yourself. - cat > xci_test.sh<<EOF - #!/bin/bash - export DISTRO=$DISTRO - export DEPLOY_SCENARIO=$DEPLOY_SCENARIO - export FUNCTEST_MODE=$FUNCTEST_MODE - export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME - export XCI_FLAVOR=$XCI_FLAVOR - export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES - export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/ - export INSTALLER_TYPE=$INSTALLER_TYPE - export GIT_BASE=$GIT_BASE - export JENKINS_HOME=$JENKINS_HOME - - cd xci - ./xci-deploy.sh - EOF - chmod a+x xci_test.sh - - export XCI_BUILD_CLEAN_VM_OS=false - export XCI_UPDATE_CLEAN_VM_OS=true - - ./xci/scripts/vm/start-new-vm.sh $DISTRO - - shell: | - #!/bin/bash - - # skip the deployment if the patch doesn't impact the deployment - if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then - echo "Skipping the deployment!" - exit 0 - fi - - ssh -F $HOME/.ssh/xci-vm-config ${DISTRO}_xci_vm "cd releng-xci && ./xci_test.sh" + - shell: + !include-raw: ./xci-start-new-vm.sh + - shell: + !include-raw: ./xci-start-deployment.sh - builder: name: 'xci-verify-healthcheck-macro' builders: - - shell: | - #!/bin/bash - - # 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 - - echo "Hello World!" - - shell: | - #!/bin/bash - - # 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 - sudo virsh undefine ${DISTRO}_xci_vm - -# this will be enabled once the xci is prepared -# - builder: -# name: 'xci-verify-healthcheck-macro' -# builders: -# - shell: -# !include-raw: ../../utils/fetch_os_creds.sh -# - shell: -# !include-raw: ../functest/functest-alpine.sh + - shell: + !include-raw: ./xci-run-functest.sh + - shell: + !include-raw: ./xci-cleanup.sh |