Merge "update-default-k8s-version-kind-node-version"
authorFurkat Gofurov <furkat.gofurov@est.tech>
Thu, 20 Jan 2022 10:26:43 +0000 (10:26 +0000)
committerNordix Gerrit <gerrit@nordix.org>
Thu, 20 Jan 2022 10:26:43 +0000 (10:26 +0000)
jjb/airship/job_feature_tests_upgrade_ubuntu.yml
jjb/airship/job_ipa_image_building_test.yml
jjb/airship/job_master_feature_tests_upgrade_ubuntu.yml
jjb/infra/packer_build_jobs.yaml [new file with mode: 0644]
jjb/infra/update-jenkins-slave.sh [new file with mode: 0644]

index 88c201ee2284c68814c2d27555bdd8de3290e80e..b1fe648e62960770fcb124cbb0fb8adcd60bad3a 100644 (file)
         description: 'Distribution to use for the tests.'
     - string:
         name: CAPI_VERSION
-        default: 'v1beta1'
+        default: 'v1alpha4'
         description: 'Cluster API version.'
+    - string:
+        name: CAPIRELEASE
+        description: 'Cluster API release tag to upgrade from, e.g. v1.0.0'
     - string:
         name: CAPM3_VERSION
-        default: 'v1beta1'
+        default: 'v1alpha5'
         description: 'Cluster API provider Metal3 version.'
+    - string:
+        name: CAPM3RELEASE
+        description: 'CAPM3 release tag to upgrade from, e.g. v1.0.0'
     - string:
         name: TARGET_NODE_OS
         default: 'Ubuntu'
index c06fed1aba9fc18052232eb34a1780d87d3f72a3..2c0efd928b13f5609e80ee7e59c2a119a9a22bd9 100644 (file)
@@ -43,7 +43,7 @@
         description: 'Ironic Image repository commit hash to build'
     - string:
         name: IRONIC_IMAGE_BRANCH
-        default: 'master'
+        default: 'main'
         description: 'Ironic image repository branch to build'
     - string:
         name: IRONIC_INSPECTOR_REFSPEC
index 81917136e62be2420c38d7272ae72e99d4559a68..a829627bf7d7b259007c86215ee182d99c8ce5bd 100644 (file)
         description: 'Distribution to use for the tests.'
     - string:
         name: CAPI_VERSION
-        default: 'v1beta1'
+        default: 'v1alpha4'
         description: 'Cluster API version.'
+    - string:
+        name: CAPIRELEASE
+        description: 'Cluster API release tag to upgrade from, e.g. v1.0.0'
     - string:
         name: CAPM3_VERSION
-        default: 'v1beta1'
+        default: 'v1alpha5'
         description: 'Cluster API provider Metal3 version.'
+    - string:
+        name: CAPM3RELEASE
+        description: 'CAPM3 release tag to upgrade from, e.g. v1.0.0'
     - string:
         name: TARGET_NODE_OS
         default: 'Ubuntu'
diff --git a/jjb/infra/packer_build_jobs.yaml b/jjb/infra/packer_build_jobs.yaml
new file mode 100644 (file)
index 0000000..7c812fb
--- /dev/null
@@ -0,0 +1,119 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2021 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=========================================================
+- project:
+
+    name: jenkins-slave-update-job
+
+    project: infra/tools
+
+    stream:
+      - master:
+          branch: '{stream}'
+
+    target:
+      - 'cloud-infra':
+           image: 'cloud-infra-base-ubuntu1804'
+           openstack-project: 'CICD'
+           region: 'fra'
+      - 'nordix-nsm-build-server':
+           image: 'nordix-nsm-build-ubuntu1804'
+           openstack-project: 'CICD'
+           region: 'fra'
+      - 'uds-build-server':
+           image: 'onap-uds-build-ubuntu1804'
+           openstack-project: 'CICD'
+           region: 'fra'
+      - 'nordix-onap-jenkins-build-server':
+           image: 'onap-build-ubuntu1804'
+           openstack-project: 'DefaultProject34201'
+           region: 'kna'
+      - 'oransc-build-server':
+           image: 'oransc-build-ubuntu2004'
+           openstack-project: 'DefaultProject34201'
+           region: 'kna'
+
+    jobs:
+      - jenkins-slave-update-{target}-{stream}
+
+- job-template:
+    name: jenkins-slave-update-{target}-{stream}
+
+    node: packer-ubuntu1804
+
+    disabled: false
+
+    concurrent: false
+
+    parameters:
+      - project-parameters:
+          project: '{project}'
+          branch: '{branch}'
+      - nordix-gerrit-parameters
+      - string:
+          name: PACKER_VERSION
+          default: '1.6.0'
+          description: 'Packer version.'
+      - string:
+          name: TARGET
+          default: '{target}'
+          description: 'Target project name.'
+      - string:
+          name: IMAGE
+          default: '{image}'
+          description: 'Image name to build.'
+
+    properties:
+      - logrotate
+
+    scm:
+      - git-scm:
+          ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+          branch: '{branch}'
+          refspec: ''
+          wipe_workspace: true
+          clean_before: false
+
+    triggers:
+      - nordix-gerrit-trigger-change-merged:
+          project: '{project}'
+          branch: '{branch}'
+          files: 'infra/jenkins/slave-setup/{target}/**'
+
+    wrappers:
+      - build-timeout:
+          timeout: 150
+      - fix-workspace-permissions
+      - mask-passwords
+      - openstack:
+          single-use: true
+      - credentials-binding:
+          - file:
+              credential-id: '{openstack-project}-openrc-{region}'
+              variable: OPENRC_FILE
+
+    builders:
+      - shell: |
+          #!/bin/bash
+          /bin/rm -f /tmp/openrc
+          /bin/cp -f $OPENRC_FILE /tmp/openrc
+      - shell:
+          !include-raw-escape: ./update-jenkins-slave.sh
+      - shell: |
+          #!/bin/bash
+          /bin/rm -f /tmp/openrc
diff --git a/jjb/infra/update-jenkins-slave.sh b/jjb/infra/update-jenkins-slave.sh
new file mode 100644 (file)
index 0000000..9473aae
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash
+set -o errexit
+set -o nounset
+set -o pipefail
+
+sudo apt install -y -q=3 python3-minimal python3-pip virtualenv
+
+# workaround for https://github.com/pypa/virtualenv/issues/1029
+export PS1=${PS1:-}
+
+cd "$WORKSPACE"
+echo "----------------------------------------------------"
+echo "Info: Create virtualenv to update Jenkins slaves"
+virtualenv -p python3 --quiet --no-site-packages .venv
+source .venv/bin/activate
+pip install python-openstackclient
+echo "----------------------------------------------------"
+echo "Info  : Installing packer version ${PACKER_VERSION}"
+wget -q "https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip" -O /tmp/packer.zip
+unzip /tmp/packer.zip > /dev/null 2>&1
+sudo mv -f ./packer /usr/local/bin/packer
+sudo chmod +x /usr/local/bin/packer
+echo "----------------------------------------------------"
+packer -version
+/bin/rm -f /tmp/packer.zip
+# shellcheck disable=SC1091
+source "/tmp/openrc"
+echo "----------------------------------------------------"
+echo "Info: Create backup of existing image"
+cd "$WORKSPACE"
+BACKUP_ZONE_ID=$(openstack image list --property name=${IMAGE} -f value -c ID)
+openstack image set --name "${IMAGE}-backup-$GIT_COMMIT" "$BACKUP_ZONE_ID"
+echo "----------------------------------------------------"
+echo "Info: Updating the CI slave image"
+cd "infra/jenkins/slave-setup/${TARGET}/"
+packer validate *-ubuntu*.json
+packer build *-ubuntu*.json
+echo "----------------------------------------------------"
\ No newline at end of file