X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=jenkins%2Fci-pipelines%2Fci_stage_2.groovy;h=52e2f1d336a79b6bcd89c00786c3151778a1e9f7;hb=9054244cd2a7451f75157d7fa3ec5d2ff88176be;hp=45bf777ee5dcf825d5eee4c4e83f24823ba6694e;hpb=dda707b51e8ce223a59d454dbd3f5a43f212b2ac;p=osm%2Fdevops.git diff --git a/jenkins/ci-pipelines/ci_stage_2.groovy b/jenkins/ci-pipelines/ci_stage_2.groovy index 45bf777e..52e2f1d3 100644 --- a/jenkins/ci-pipelines/ci_stage_2.groovy +++ b/jenkins/ci-pipelines/ci_stage_2.groovy @@ -26,8 +26,8 @@ def project_checkout(url_prefix,project,refspec,revision) { } } -def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,build_system) { - println("build_system = ${build_system}") +def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifactory_server,docker_args="",do_stage_4=false) { + println("do_stage_3= ${do_stage_3}") ci_helper = load "devops/jenkins/ci-pipelines/ci_helper.groovy" stage('Prepare') { @@ -45,12 +45,14 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,build_system) { container_name = "${project}-${branch}".toLowerCase() stage('Docker-Build') { - sh "echo 'RUN groupadd -o -g " + "id -g".execute().text + " -r jenkins \\' >> Dockerfile" - sh "echo ' && useradd -o -u " + "id -u".execute().text + " --create-home -r -g jenkins jenkins' >> Dockerfile" + sh ''' + echo RUN groupadd -o -g $(id -g) -r jenkins >> Dockerfile + echo RUN useradd -o -u $(id -u) --create-home -r -g jenkins jenkins >> Dockerfile + ''' sh "docker build -t ${container_name} ." } - withDockerContainer("${container_name}") { + withDockerContainer(image: "${container_name}", args: docker_args) { stage('Test') { sh 'devops-stages/stage-test.sh' } @@ -60,21 +62,28 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,build_system) { } stage('Archive') { + sh "mkdir -p changelog" + sh "devops/tools/generatechangelog-pipeline.sh > changelog/changelog-${mdg}.html" sh(returnStdout:true, script: 'devops-stages/stage-archive.sh').trim() - ci_helper.archive(mdg,branch,'untested') + ci_helper.archive(artifactory_server,mdg,branch,'untested') } - if ( build_system ) { + if ( do_stage_3 ) { stage('Build System') { def downstream_params_stage_3 = [ string(name: 'GERRIT_BRANCH', value: "${branch}"), string(name: 'UPSTREAM_JOB_NAME', value: "${JOB_NAME}" ), string(name: 'UPSTREAM_JOB_NUMBER', value: "${BUILD_NUMBER}" ), + booleanParam(name: 'DO_STAGE_4', value: do_stage_4 ) ] + stage_3_job = "osm-stage_3" + if ( JOB_NAME.contains('merge') ) { + stage_3_job += '-merge' + } - // callout to stage_3. This is the system build - result = build job: "osm-stage_3/${branch}", parameters: downstream_params_stage_3, propagate: true + // callout to stage_3. This is the system build + result = build job: "${stage_3_job}/${branch}", parameters: downstream_params_stage_3, propagate: true if (result.getResult() != 'SUCCESS') { project = result.getProjectName() build = result.getNumber()