[checkmk-commits] Improve build script for build nodes

Alex Zurhake az at mathias-kettner.de
Tue May 7 06:10:55 CEST 2019


Module: check_mk
Branch: master
Commit: 372e2ebbca5c9b3db2a5dca0e665a3fec2eeb92f
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=372e2ebbca5c9b3db2a5dca0e665a3fec2eeb92f

Author: Alex Zurhake <az at mathias-kettner.de>
Date:   Mon May  6 08:39:08 2019 +0200

Improve build script for build nodes

- Add parameters to node build script
- Fix network
- Improve pull mechanism

Change-Id: I838523e6e357836d181a681ca45ae375aed6d11b

---

 buildscripts/scripts/build-nodes.jenkins | 43 +++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/buildscripts/scripts/build-nodes.jenkins b/buildscripts/scripts/build-nodes.jenkins
index 2138018..b413452 100644
--- a/buildscripts/scripts/build-nodes.jenkins
+++ b/buildscripts/scripts/build-nodes.jenkins
@@ -1,17 +1,26 @@
-def DISTRO_LIST = ["sles-11sp4", "sles-12", "sles-12sp1", "sles-12sp2", "sles-12sp3", "sles-12sp4", "sles-15", "debian-8", "debian-9", "ubuntu-14.04", "ubuntu-16.04", "ubuntu-17.10", "ubuntu-18.04", "ubuntu-18.10", "centos-6", "centos-7"]
+properties([
+  parameters([
+    string(name: 'DISTROS', defaultValue: DISTRO_LIST_MASTER, description: 'List of targeted distros' )
+  ])
+])
+def DISTRO_LIST = DISTROS.split(' ')
 def DOCKER_BUILDS = [:]
 
+currentBuild.description = 'Building for the following Distros:\n' + DISTRO_LIST
 node {
-    docker.image('devrechner:5010/ubuntu-18.04-common').inside('-u 0:0 --cap-add=SYS_ADMIN --network infrastructure_local-infra') {
-        stage('checkout sources') {
-            checkout(scm)
-            dir('buildscripts/infrastructure/build-nodes/gnu-toolchain/') {
-                stash name: 'bw-build-gnu-toolchain', includes: 'bw-build-gnu-toolchain.sh'
-                withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
-                    sh './bw-build-gnu-toolchain.sh -d'
+    docker.withRegistry(DOCKER_REGISTRY, 'nexus') {
+        docker.image('ubuntu-18.04-common').pull()
+        docker.image('ubuntu-18.04-common').inside('-u 0:0 --cap-add=SYS_ADMIN --network ci_local-infra') {
+            stage('checkout sources') {
+                checkout(scm)
+                dir('buildscripts/infrastructure/build-nodes/gnu-toolchain/') {
+                    stash name: 'bw-build-gnu-toolchain', includes: 'bw-build-gnu-toolchain.sh'
+                    withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
+                        sh './bw-build-gnu-toolchain.sh -d'
+                    }
                 }
+               stash name: 'dockerfiles', includes: 'buildscripts/infrastructure/build-nodes/*/Dockerfile'
             }
-           stash name: 'dockerfiles', includes: 'buildscripts/infrastructure/build-nodes/*/Dockerfile'
         }
     }
 }
@@ -19,14 +28,14 @@ node {
 DISTRO_LIST.each { DISTRO ->
     DOCKER_BUILDS[DISTRO] = {
         node {
-            docker.image('devrechner:5010/ubuntu-18.04-common').inside('-u 0:0 -v /var/run/docker.sock:/var/run/docker.sock --cap-add=SYS_ADMIN --network infrastructure_local-infra') {
-                stage('build' + DISTRO + ' image') {
-                    unstash name: 'dockerfiles'
-                    dir('buildscripts/infrastructure/build-nodes/' + DISTRO) {
-                        unstash name: 'bw-build-gnu-toolchain'
-                        docker.withRegistry('http://10.9.1.101:5010', 'nexus') {
-                            sh "echo 'nameserver 10.1.1.10' > /etc/resolv.conf"
-                            def Image = docker.build(DISTRO, "--network infrastructure_local-infra .")
+            docker.withRegistry(DOCKER_REGISTRY, 'nexus') {
+                docker.image('ubuntu-18.04-common').pull()
+                docker.image('ubuntu-18.04-common').inside('-u 0:0 -v /var/run/docker.sock:/var/run/docker.sock --cap-add=SYS_ADMIN --network ci_local-infra') {
+                    stage('build' + DISTRO + ' image') {
+                        unstash name: 'dockerfiles'
+                        dir('buildscripts/infrastructure/build-nodes/' + DISTRO) {
+                            unstash name: 'bw-build-gnu-toolchain'
+                            def Image = docker.build(DISTRO, "--network ci_local-infra .")
                             Image.push()
                         }
                     }



More information about the checkmk-commits mailing list