X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=jenkins%2Fci-pipelines%2Fci_stage_2.groovy;h=616f569f1b39af6d8725e14a85c7fc6811527df3;hb=7498c1dfab5ba2a01a532ab8069abbceae5ccd08;hp=ddbd80aae6e36a93feb84891defa65470a574a70;hpb=ff53f35303d2a99e5c2aa31619e1b12aff9b2fad;p=osm%2Fdevops.git diff --git a/jenkins/ci-pipelines/ci_stage_2.groovy b/jenkins/ci-pipelines/ci_stage_2.groovy index ddbd80aa..616f569f 100644 --- a/jenkins/ci-pipelines/ci_stage_2.groovy +++ b/jenkins/ci-pipelines/ci_stage_2.groovy @@ -20,6 +20,7 @@ def project_checkout(url_prefix,project,refspec,revision) { // this is done automaticaly by the multibranch pipeline plugin // git url: "${url_prefix}/${project}" + sh "git fetch --tags" sh "git fetch origin ${refspec}" if (GERRIT_PATCHSET_REVISION.size() > 0 ) { sh "git checkout -f ${revision}" @@ -39,7 +40,12 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifa } stage('License Scan') { + if (!JOB_NAME.contains('merge')) { sh "devops/tools/license_scan.sh" + } + else { + println("skip the scan for merge") + } } container_name = "${project}-${branch}".toLowerCase() @@ -73,6 +79,32 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifa } } + if (fileExists('snap/snapcraft.yaml')) { + stage('Snap build') { + sh "sudo rm -rf ${WORKSPACE}/stage/ ${WORKSPACE}/parts/ ${WORKSPACE}/prime/ ${WORKSPACE}/*.snap" + sh "docker run -v ${WORKSPACE}:/build --env BRANCH=${BRANCH_NAME} -w /build snapcore/snapcraft:stable /bin/bash -c 'apt update && snapcraft'" + sh "sudo mv ${WORKSPACE}/${mdg}_*.snap ${WORKSPACE}/${mdg}.snap" + sh "sudo rm -rf ${WORKSPACE}/stage/ ${WORKSPACE}/parts/ ${WORKSPACE}/prime/" + + REV="" + if ( !JOB_NAME.contains('merge') ) { + short_ref=sh(returnStdout: true, + script: "git rev-parse --short HEAD").trim() + REV="/"+short_ref + } + channel="latest" + if (BRANCH_NAME.startsWith("v")) { + channel=BRANCH_NAME.substring(1) + } else if (BRANCH_NAME!="master") { + REV="/"+BRANCH_NAME+REV.replaceAll('/','-') + } + + sh "sudo docker run -v ~/.snapcraft:/snapcraft -v ${WORKSPACE}:/build " + + "-w /build snapcore/snapcraft:stable /bin/bash -c " + + "\"snapcraft login --with /snapcraft/config ; snapcraft push --release=${channel}/edge${REV} ${mdg}.snap\"" + } + } + if ( do_stage_3 ) { stage('Build System') {