| Mike Marchetti | 6930bc0 | 2017-05-31 16:33:02 -0400 | [diff] [blame^] | 1 | // input parameters: |
| 2 | // boolean: BUILD_FROM_SOURCE |
| 3 | // boolean: COMMIT_ID |
| 4 | // string: NODE |
| 5 | |
| 6 | node("${params.NODE}") { |
| 7 | |
| 8 | stage("Setup") { |
| 9 | tag_or_branch = params.COMMIT_ID.replaceAll(/\./,"") |
| 10 | container_name_prefix = "osm-${tag_or_branch}" |
| 11 | container_name = "${container_name_prefix}-${BUILD_NUMBER}" |
| 12 | } |
| 13 | |
| 14 | stage("Cleanup") { |
| 15 | // check for previous containers and clean them up |
| 16 | sh "jenkins/system/delete_old_containers.sh ${container_name_prefix}" |
| 17 | } |
| 18 | |
| 19 | stage("Build") { |
| 20 | from_source = '' |
| 21 | if ( params.BUILD_FROM_SOURCE ) |
| 22 | { |
| 23 | from_source = '--source' |
| 24 | } |
| 25 | |
| 26 | sh "jenkins/host/start_build system --build-container ${container_name} -b ${params.COMMIT_ID} ${from_source}" |
| 27 | sh "echo ${container_name} > build_version.txt" |
| 28 | archiveArtifacts artifacts: "build_version.txt" |
| 29 | } |
| 30 | } |