static slaves: Perform global-jjb init 50/2250/4
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Fri, 21 Feb 2020 12:31:15 +0000 (13:31 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Sun, 23 Feb 2020 16:21:30 +0000 (17:21 +0100)
global-jjb was recently bumped to 0.51, which assumes
jenkins-init-scripts were already executed on the build slave
(e.g. by sourcing ~jenkins/lf-env.sh), which is always true for
Openstack instances dynamically spawned by Jenkins, but not yet
for static slaves like AArch64 dev/build/baremetal PODs.

Add a new job, triggered on ci-management gerrit merge (only if
global-jjb reference is changed) that executes the jenkins-init-scripts
similar to dynamic slaves initialization.

NOTE: Since jenkins-init-scripts are not fully idempotent, some
actions (e.g. id_rsa keypair generation) are executed even though
they are not mandatory (for the id_rsa keypair this means the
private/public keys will be forcefully regenerated each time this new
job runs).

Change-Id: I62433a45c7966aed1d1184fa60e87ee4211996e4
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
jjb/akraino-templates/akraino-jjb-templates.yaml
jjb/ci-management/static-slaves-ci-jobs.yaml [new file with mode: 0644]

index 55d9c69..82d34dd 100644 (file)
 
     publishers:
       - lf-infra-publish
+
+- job-template:
+    id: akraino-project-build-node-init
+    name: '{project-name}-{build-node}-init'
+    disabled: '{obj:disabled}'
+    concurrent: true
+
+    parameters:
+      - lf-infra-parameters:
+          project: '{project}'
+          stream: '{stream}'
+          branch: '{branch}'
+      - label:
+          name: '{build-node}'
+          default: '{build-node}'
+          node-eligibility: 'all'
+          all-nodes: true
+
+    gerrit_merge_triggers:
+      - change-merged-event
+      - comment-added-contains-event:
+          comment-contains-value: remerge$
+
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: 'global-jjb'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+          git-url: '{git-url}/{project}.git'
+          refspec: ''
+          branch: '{branch}'
+          submodule-recursive: true
+          submodule-timeout: '{submodule-timeout}'
+          submodule-disable: false
+          choosing-strategy: default
+
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_merge_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
+
+    builders:
+      - description-setter:
+          description: "POD: $NODE_NAME"
+      - shell: |
+          #!/bin/bash -ex
+          export SWAP_SIZE=0
+          sudo -E ./global-jjb/jenkins-init-scripts/init.sh
+          sudo chown jenkins:jenkins -R archives
diff --git a/jjb/ci-management/static-slaves-ci-jobs.yaml b/jjb/ci-management/static-slaves-ci-jobs.yaml
new file mode 100644 (file)
index 0000000..c07b550
--- /dev/null
@@ -0,0 +1,16 @@
+---
+- project:
+    name: static-slaves-ci-jobs
+
+    project: ci-management
+    project-name: ci-management
+    branch: master
+    stream: '{branch}'
+
+    build-node:
+      - aarch64_dev
+      - aarch64_build
+      - aarch64_baremetal
+
+    jobs:
+      - akraino-project-build-node-init