Create periodic jobs for scenarios 51/1151/7
authorFatih Degirmenci <fdegir@gmail.com>
Wed, 8 May 2019 09:38:56 +0000 (11:38 +0200)
committerFatih Degirmenci <fdegir@gmail.com>
Wed, 8 May 2019 11:52:42 +0000 (13:52 +0200)
These jobs will be used for promoting scenarios based on deployment
and testing on baremetal.

The jobs are currently triggered daily without checking if anything
changed. This will be updated and they will only be triggered if
infra/engine or infra/swconfig/<scenario> change so we build only
when something happens.

Promotion logic is not implemented yet and will be done in a separate
change.

In addition to periodic jobs for scenarios, trigger for baremetal
engine periodic job is switched to daily in order to free up time
for scenario periodic jobs.

And as usual, lots of duplications here and there and these will be
fixed by refactoring jobs and scripts once the basic pipeline is
in place.

Change-Id: Iaf0da0191fbde1abad60b5ca14dd191095fac761

jjb/cloud-infra/cloud-infra-macros.yaml
jjb/cloud-infra/cloud-infra-periodic-engine.yaml
jjb/cloud-infra/cloud-infra-periodic-scenario.yaml [new file with mode: 0644]
jjb/cloud-infra/scenario-deploy.sh [new file with mode: 0644]
jjb/cloud-infra/scenario-functest.sh [new file with mode: 0644]
jjb/cloud-infra/scenario-promote.sh [new file with mode: 0644]
jjb/cloud-infra/scenario-yardstick.sh [new file with mode: 0644]

index fbf433481b6f13ae4522fb65d4b8c3b59bd37be8..100ca8fc3bb4feb56c7e6a3a6b2a30fc5df66f71 100644 (file)
       - shell:
           !include-raw: ./cloud-infra-scenario-test.sh
 
+- builder:
+    name: 'scenario-deploy-macro'
+    builders:
+      - shell:
+          !include-raw: ./wait-for-pkg-manager.sh
+      - shell:
+          !include-raw: ./scenario-deploy.sh
+
+- builder:
+    name: 'scenario-functest-macro'
+    builders:
+      - shell:
+          !include-raw: ./prepare-for-testfw-verify.sh
+      - shell:
+          !include-raw: ./scenario-functest.sh
+
+- builder:
+    name: 'scenario-yardstick-macro'
+    builders:
+      - shell:
+          !include-raw: ./prepare-for-testfw-verify.sh
+      - shell:
+          !include-raw: ./scenario-yardstick.sh
+
+- builder:
+    name: 'scenario-promote-macro'
+    builders:
+      - shell:
+          !include-raw: ./scenario-promote.sh
+
 # vim: set ts=2 sw=2 expandtab:
index 0957baaa817cdd222096d8982dc3d3a7ccbb57eb..6fbdd92c361e5afbc7b68805521ea6cb083d0463 100644 (file)
       - virtual:
           slave-label: 'vpod-deploy-city'
           yardstick-dispatcher: 'file'
+          build-trigger: 'H H/3 * * *'
       - baremetal:
           slave-label: 'baremetal-deploy'
           yardstick-dispatcher: 'influxdb'
+          build-trigger: '@daily'
 
     phase:
       - deploy:
           refspec: ''
 
     triggers:
-      - timed: 'H H/3 * * *'
+      - timed: '{build-trigger}'
 
     builders:
       - multijob:
diff --git a/jjb/cloud-infra/cloud-infra-periodic-scenario.yaml b/jjb/cloud-infra/cloud-infra-periodic-scenario.yaml
new file mode 100644 (file)
index 0000000..5bb871d
--- /dev/null
@@ -0,0 +1,344 @@
+---
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 Nordix Foundation.
+# ================================================================================
+# 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+#--------------------------------------------------------------------------------------
+# The jobs declared in this JJB configuration file are used for verifying cloud-infra
+# engine from the tip of the master branch periodically to check the stability of it.
+#
+# These jobs are set to run on slaves with label vpod-deploy-ubuntu1604.
+# The slaves have
+#   - Ubuntu1604 as the base distro
+#   - nested virtualization
+#   - internet access
+#   - passwordless sudo
+#   - 16 CPUs/32GB RAM/200 GB Disk
+#   - docker, git vim curl wget zip unzip chrony apt-transport-https ca-certificates curl
+#     gnupg-agent software-properties-common docker-ce docker-ce-cli containerd.io openjdk-8-jre
+#
+# The slaves should not have a cloud infra scenario deployed on them.
+#--------------------------------------------------------------------------------------
+
+- project:
+    name: 'cloud-infra-periodic-scenario'
+
+    project: 'infra/engine'
+
+    stream:
+      - 'master':
+          branch: '{stream}'
+          disabled: 'false'
+
+    os:
+      - ubuntu1804:
+          disabled: 'false'
+          distribution: 'ubuntu18'
+          ipa_dib_os_element: 'coreos'
+          dib_os_release: 'bionic'
+          dib_os_element: 'ubuntu-minimal'
+      - centos7:
+          disabled: 'true'
+          distribution: 'centos7'
+          ipa_dib_os_element: 'coreos'
+          dib_os_release: '7'
+          dib_os_element: 'centos-minimal'
+
+    deploy-scenario:
+      - k8-calico-nofeature:
+          installer-type: kubespray
+      - k8-flannel-nofeature:
+          installer-type: kubespray
+      - k8-canal-nofeature:
+          installer-type: kubespray
+      - k8-cilium-nofeature:
+          installer-type: kubespray
+      - k8-weave-nofeature:
+          installer-type: kubespray
+
+    type:
+      - baremetal:
+          slave-label: 'baremetal-deploy'
+          yardstick-dispatcher: 'influxdb'
+
+    phase:
+      - deploy:
+          build-timeout: 60
+      - functest:
+          build-timeout: 120
+      - yardstick:
+          build-timeout: 30
+      - promote:
+          build-timeout: 5
+
+    jobs:
+      - '{deploy-scenario}-periodic-{os}-{type}-{stream}'
+      - '{deploy-scenario}-periodic-{os}-{phase}-{type}-{stream}'
+
+- job-template:
+    name: '{deploy-scenario}-periodic-{os}-{type}-{stream}'
+
+    project-type: multijob
+
+    disabled: '{obj:disabled}'
+
+    concurrent: true
+
+    parameters:
+      - project-parameters:
+          project: '{project}'
+          branch: '{branch}'
+      - nordix-gerrit-parameters
+      - label:
+          name: SLAVE_LABEL
+          default: '{slave-label}'
+          description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use'
+      - string:
+          name: DISTRIBUTION
+          default: '{distribution}'
+          description: 'Distribution to use for configuring target nodes (networking etc.)'
+      - string:
+          name: DEPLOY_TYPE
+          default: '{type}'
+          description: 'Type of the deployment'
+      - string:
+          name: USE_PREBUILT_DEPLOYMENT_IMAGE
+          default: 'true'
+          description: 'Use prebuilt deployment image while running as part of CI/CD'
+      - string:
+          name: IPA_DIB_OS_ELEMENT
+          default: '{ipa_dib_os_element}'
+          description: 'DIB OS Element to use for building the ramdisk image'
+      - string:
+          name: DIB_OS_RELEASE
+          default: '{dib_os_release}'
+          description: 'DIB OS Release to use for building the deployment image to provision target nodes with'
+      - string:
+          name: DIB_OS_ELEMENT
+          default: '{dib_os_element}'
+          description: 'DIB OS Element to use for building the deployment image to provision target nodes with'
+      - string:
+          name: INSTALLER_TYPE
+          default: '{installer-type}'
+          description: 'Installer to use for deploying the scenario'
+      - string:
+          name: DEPLOY_SCENARIO
+          default: '{deploy-scenario}'
+          description: 'Scenario to deploy and test'
+      - string:
+          name: TEST_SUITE
+          default: 'smoke'
+          description: 'Test suite to run'
+      - string:
+          name: YARDSTICK_DISPATCHER
+          default: '{yardstick-dispatcher}'
+          description: 'Dispatcher to use for Yardstick reporting'
+      - string:
+          name: CLEANUP
+          default: 'true'
+          description: 'Cleanup leftovers of the previous run'
+
+    properties:
+      - logrotate
+      - build-blocker:
+          use-build-blocker: true
+          blocking-jobs:
+            - 'cloud-infra-periodic-engine-{os}-.*'
+            - 'k8-.*?-periodic-.*'
+          block-level: 'NODE'
+      - throttle:
+          max-per-node: 1
+          max-total: 3
+          option: project
+
+    wrappers:
+      - build-timeout:
+          timeout: 210
+      - fix-workspace-permissions
+
+    scm:
+      - git-scm:
+          ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+          branch: '{branch}'
+          refspec: ''
+
+    triggers:
+      - timed: '@daily'
+
+    builders:
+      - description-setter:
+          description: $INSTALLER_TYPE
+      - multijob:
+          name: deploy
+          condition: SUCCESSFUL
+          projects:
+            - name: 'scenario-periodic-{os}-deploy-{type}-{stream}'
+              current-parameters: true
+              predefined-parameters: |
+                DISTRIBUTION=$DISTRIBUTION
+                DEPLOY_TYPE=$DEPLOY_TYPE
+                USE_PREBUILT_DEPLOYMENT_IMAGE=$USE_PREBUILT_DEPLOYMENT_IMAGE
+                IPA_DIB_OS_ELEMENT=$IPA_DIB_OS_ELEMENT
+                DIB_OS_RELEASE=$DIB_OS_RELEASE
+                DIB_OS_ELEMENT=$DIB_OS_ELEMENT
+                INSTALLER_TYPE=$INSTALLER_TYPE
+                DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                CLEANUP=$CLEANUP
+              git-revision: true
+              node-parameters: true
+              kill-phase-on: FAILURE
+              abort-all-job: true
+      - multijob:
+          name: functest
+          condition: ALWAYS
+          projects:
+            - name: 'scenario-periodic-{os}-functest-{type}-{stream}'
+              current-parameters: true
+              predefined-parameters: |
+                DISTRIBUTION=$DISTRIBUTION
+                DEPLOY_TYPE=$DEPLOY_TYPE
+                INSTALLER_TYPE=$INSTALLER_TYPE
+                DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                TEST_SUITE=$TEST_SUITE
+                YARDSTICK_DISPATCHER=$YARDSTICK_DISPATCHER
+                CLEANUP=$CLEANUP
+              node-parameters: true
+              kill-phase-on: FAILURE
+              abort-all-job: true
+      - multijob:
+          name: yardstick
+          condition: ALWAYS
+          projects:
+            - name: 'scenario-periodic-{os}-yardstick-{type}-{stream}'
+              current-parameters: true
+              predefined-parameters: |
+                DISTRIBUTION=$DISTRIBUTION
+                DEPLOY_TYPE=$DEPLOY_TYPE
+                INSTALLER_TYPE=$INSTALLER_TYPE
+                DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                TEST_SUITE=$TEST_SUITE
+                YARDSTICK_DISPATCHER=$YARDSTICK_DISPATCHER
+                CLEANUP=$CLEANUP
+              node-parameters: true
+              kill-phase-on: FAILURE
+              abort-all-job: true
+      - multijob:
+          name: promote
+          condition: ALWAYS
+          projects:
+            - name: 'scenario-periodic-{os}-promote-{type}-{stream}'
+              current-parameters: true
+              predefined-parameters: |
+                DISTRIBUTION=$DISTRIBUTION
+                DEPLOY_TYPE=$DEPLOY_TYPE
+                INSTALLER_TYPE=$INSTALLER_TYPE
+                DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                TEST_SUITE=$TEST_SUITE
+                YARDSTICK_DISPATCHER=$YARDSTICK_DISPATCHER
+                CLEANUP=$CLEANUP
+              node-parameters: true
+              kill-phase-on: FAILURE
+              abort-all-job: true
+
+- job-template:
+    name: '{deploy-scenario}-periodic-{os}-{phase}-{type}-{stream}'
+
+    disabled: false
+
+    concurrent: true
+
+    properties:
+      - logrotate
+
+    parameters:
+      - string:
+          name: PROJECT
+          default: $GERRIT_PROJECT
+      - string:
+          name: DISTRIBUTION
+          default: 'ubuntu18'
+          description: 'Distribution to use for configuring target nodes (networking etc.). Overriden by upstream job.'
+      - string:
+          name: DEPLOY_TYPE
+          default: 'virtual'
+          description: 'Type of the deployment. Overriden by upstream job.'
+      - string:
+          name: USE_PREBUILT_DEPLOYMENT_IMAGE
+          default: 'false'
+          description: 'Use prebuilt deployment image while running as part of CI/CD'
+      - string:
+          name: IPA_DIB_OS_ELEMENT
+          default: 'fedora'
+          description: 'DIB OS Element to use for building the ramdisk image. Overriden by upstream job.'
+      - string:
+          name: DIB_OS_RELEASE
+          default: 'bionic'
+          description: 'DIB OS Release to use for building the deployment image to provision target nodes with. Overriden by upstream job.'
+      - string:
+          name: DIB_OS_ELEMENT
+          default: 'ubuntu-minimal'
+          description: 'DIB OS Element to use for building the deployment image to provision target nodes with. Overriden by upstream job.'
+      - string:
+          name: ENGINE_ANSIBLE_PARAMS
+          default: ' -v '
+          description: 'Extra paramters that can be added when run the play books.'
+      - string:
+          name: DEPLOY_SCENARIO
+          default: 'k8-calico-nofeature'
+          description: 'Scenario to deploy and test'
+      - string:
+          name: INSTALLER_TYPE
+          default: 'kubespray'
+          description: 'Installer to use for deploying the scenario'
+      - string:
+          name: TEST_FW
+          default: '{phase}'
+          description: 'Test framework to use'
+      - string:
+          name: TEST_SUITE
+          default: 'smoke'
+          description: 'Test suite to run'
+      - string:
+          name: TEST_REPO_URL
+          default: 'https://gerrit.nordix.org/infra/test.git'
+          description: 'URL to Nordix Cloud Infra test repository'
+      - string:
+          name: YARDSTICK_DISPATCHER
+          default: 'file'
+          description: 'Dispatcher to use for Yardstick reporting'
+      - string:
+          name: CLEANUP
+          default: 'false'
+
+    wrappers:
+      - build-timeout:
+          timeout: '{build-timeout}'
+      - fix-workspace-permissions
+
+    scm:
+      - git-scm:
+          ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+          branch: '{branch}'
+          refspec: ''
+
+    builders:
+      - description-setter:
+          description: $INSTALLER_TYPE - $DEPLOY_SCENARIO
+      - 'scenario-{phase}-macro'
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/cloud-infra/scenario-deploy.sh b/jjb/cloud-infra/scenario-deploy.sh
new file mode 100644 (file)
index 0000000..1a3ebdd
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# This script is a wrapper around actual cloud infra engine deploy.sh script which gets
+# executed when the job that uses this script gets triggered due to Gerrit change.
+#
+# Logic in this script should be kept at minimum and the changes should be pushed into
+# the cloud infra engine deploy.sh script.
+
+# The verify job will verify changes coming to other repositories as well such as
+# infra/swconfig so it needs to be handled here in order to ensure $WORKSPACE contains
+# the actual engine repo clone. This will be added later on.
+
+# PDF and IDF are determined based on the deployment type
+#   If DEPLOY_TYPE is virtual, we always use nordix-vpod1 PDF and IDF.
+#   If DEPLOY_TYPE is baremetal, we use variable NODE_NAME injected by Jenkins to the job
+#     in order to set PDF and IDF for the POD the job is running against.
+
+if [[ $DEPLOY_TYPE == "baremetal" ]]; then
+  PDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/${NODE_NAME}-pdf.yml"
+  IDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/${NODE_NAME}-idf.yml"
+else
+  PDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-pdf.yml"
+  IDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-idf.yml"
+fi
+
+# execute cloud engine deploy.sh script
+cd $WORKSPACE
+./engine/deploy.sh -d $INSTALLER_TYPE -s $DEPLOY_SCENARIO -p $PDF -i $IDF -c
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/cloud-infra/scenario-functest.sh b/jjb/cloud-infra/scenario-functest.sh
new file mode 100644 (file)
index 0000000..d74f47a
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# This script is a wrapper around actual cloud infra engine test.sh script which gets
+# executed when the job that uses this script gets triggered due to Gerrit change.
+#
+# Logic in this script should be kept at minimum and the changes should be pushed into
+# the cloud infra test test.sh script.
+
+# execute cloud engine test.sh script with arguments
+cd $WORKSPACE
+./test/test.sh -c -f $TEST_FW -t $TEST_SUITE -s $DEPLOY_SCENARIO -d $YARDSTICK_DISPATCHER
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/cloud-infra/scenario-promote.sh b/jjb/cloud-infra/scenario-promote.sh
new file mode 100644 (file)
index 0000000..f48ac77
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+cd $WORKSPACE
+echo "Info: Not implemented!"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/cloud-infra/scenario-yardstick.sh b/jjb/cloud-infra/scenario-yardstick.sh
new file mode 100644 (file)
index 0000000..d74f47a
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# This script is a wrapper around actual cloud infra engine test.sh script which gets
+# executed when the job that uses this script gets triggered due to Gerrit change.
+#
+# Logic in this script should be kept at minimum and the changes should be pushed into
+# the cloud infra test test.sh script.
+
+# execute cloud engine test.sh script with arguments
+cd $WORKSPACE
+./test/test.sh -c -f $TEST_FW -t $TEST_SUITE -s $DEPLOY_SCENARIO -d $YARDSTICK_DISPATCHER
+
+# vim: set ts=2 sw=2 expandtab: