Skip to content
Snippets Groups Projects
Commit c9a1f307 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

- disallow concurrent builds

- code cleaning
parent 5c0fe06d
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
***********************************************************************************************************************/ ***********************************************************************************************************************/
// This is the function called from the .jenkinsfile // This is the function called from the .jenkinsfile
def call(ArrayList<String> dependencyList) { def call() {
def builds = [] def builds = []
// Run for all -Debug builds of the main job // Run for all -Debug builds of the main job
...@@ -35,12 +35,21 @@ def call(ArrayList<String> dependencyList) { ...@@ -35,12 +35,21 @@ def call(ArrayList<String> dependencyList) {
pipeline { pipeline {
agent none agent none
// setup build trigger etc.
triggers {
upstream parentJob
}
properties([disableConcurrentBuilds()])
properties([copyArtifactPermission('*')])
options { buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10')) }
stages { stages {
stage('build') { stage('build') {
// Run the build stages for all labels + build types in parallel, each in a separate docker container // Run the build stages for all labels + build types in parallel, each in a separate docker container
steps { steps {
script { script {
parallel builds.collectEntries { ["${it}" : transformIntoStep(dependencyList, it)] } parallel builds.collectEntries { ["${it}" : transformIntoStep(it)] }
} }
} }
} // end stage build } // end stage build
...@@ -59,7 +68,7 @@ def call(ArrayList<String> dependencyList) { ...@@ -59,7 +68,7 @@ def call(ArrayList<String> dependencyList) {
/**********************************************************************************************************************/ /**********************************************************************************************************************/
def transformIntoStep(ArrayList<String> dependencyList, String buildName) { def transformIntoStep(String buildName) {
// split the build name at the '-' // split the build name at the '-'
def (label, buildType) = buildName.tokenize('-') def (label, buildType) = buildName.tokenize('-')
// we need to return a closure here, which is then passed to parallel() for execution // we need to return a closure here, which is then passed to parallel() for execution
...@@ -70,7 +79,7 @@ def transformIntoStep(ArrayList<String> dependencyList, String buildName) { ...@@ -70,7 +79,7 @@ def transformIntoStep(ArrayList<String> dependencyList, String buildName) {
def dockerArgs = "-u 0 --device=/dev/mtcadummys0 --device=/dev/mtcadummys1 --device=/dev/mtcadummys2 --device=/dev/mtcadummys3 --device=/dev/llrfdummys4 --device=/dev/noioctldummys5 --device=/dev/pcieunidummys6 -v /var/run/lock/mtcadummy:/var/run/lock/mtcadummy -v /home/msk_jenkins/JenkinsConfiguration:/home/msk_jenkins/JenkinsConfiguration" def dockerArgs = "-u 0 --device=/dev/mtcadummys0 --device=/dev/mtcadummys1 --device=/dev/mtcadummys2 --device=/dev/mtcadummys3 --device=/dev/llrfdummys4 --device=/dev/noioctldummys5 --device=/dev/pcieunidummys6 -v /var/run/lock/mtcadummy:/var/run/lock/mtcadummy -v /home/msk_jenkins/JenkinsConfiguration:/home/msk_jenkins/JenkinsConfiguration"
docker.image("builder:${label}").inside(dockerArgs) { docker.image("builder:${label}").inside(dockerArgs) {
script { script {
helper.doAnalysis(dependencyList, label, buildType) helper.doAnalysis(label, buildType)
} }
} }
} }
......
...@@ -36,6 +36,9 @@ def call(String libraryName, ArrayList<String> dependencyList) { ...@@ -36,6 +36,9 @@ def call(String libraryName, ArrayList<String> dependencyList) {
pollSCM 'H/5 * * * *' pollSCM 'H/5 * * * *'
upstream dependencies upstream dependencies
} }
properties([disableConcurrentBuilds()])
properties([copyArtifactPermission('*')])
options { buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10')) }
stages { stages {
stage('build') { stage('build') {
......
...@@ -53,6 +53,9 @@ def call(ArrayList<String> dependencyList, String gitUrl='') { ...@@ -53,6 +53,9 @@ def call(ArrayList<String> dependencyList, String gitUrl='') {
pollSCM 'H/5 * * * *' pollSCM 'H/5 * * * *'
upstream dependencies upstream dependencies
} }
properties([disableConcurrentBuilds()])
properties([copyArtifactPermission('*')])
options { buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '10')) }
stages { stages {
stage('build') { stage('build') {
......
...@@ -25,7 +25,7 @@ def doBuildTestDeploy(ArrayList<String> dependencyList, String label, String bui ...@@ -25,7 +25,7 @@ def doBuildTestDeploy(ArrayList<String> dependencyList, String label, String bui
/**********************************************************************************************************************/ /**********************************************************************************************************************/
def doAnalysis(ArrayList<String> dependencyList, String label, String buildType) { def doAnalysis(String label, String buildType) {
if(buildType == "Debug") { if(buildType == "Debug") {
doPrepare(false) doPrepare(false)
doBuilddirArtefact(label, buildType) doBuilddirArtefact(label, buildType)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment