Add jenkins slave image update jobs
[infra/cicd.git] / jjb / infra / packer_build_jobs.yaml
diff --git a/jjb/infra/packer_build_jobs.yaml b/jjb/infra/packer_build_jobs.yaml
new file mode 100644 (file)
index 0000000..925bf58
--- /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