- stage('Archive') {
- sh(returnStdout:true, script: 'devops-stages/stage-archive.sh').trim()
- ci_helper.archive(mdg,branch,'untested')
- }
+ if (fileExists('snap/snapcraft.yaml')) {
+ stage('Snap build') {
+ sh "docker pull snapcore/snapcraft:stable"
+ sh "sudo rm -rf ${WORKSPACE}/stage/ ${WORKSPACE}/parts/ ${WORKSPACE}/prime/ ${WORKSPACE}/*.snap"
+ sh "sudo snapcraft clean --use-lxd"
+ sh "snapcraft --use-lxd"
+ sh "mv ${WORKSPACE}/${mdg}_*.snap ${WORKSPACE}/${mdg}.snap"
+ sh "sudo rm -rf ${WORKSPACE}/stage/ ${WORKSPACE}/parts/ ${WORKSPACE}/prime/"
+
+ REV=""
+ if ( !JOB_NAME.contains('merge') ) {
+ REV="/"+"${GERRIT_REFSPEC}".replaceAll('/','-')
+ }
+ channel="latest"
+ if (BRANCH_NAME.startsWith("v")) {
+ channel=BRANCH_NAME.substring(1)
+ } else if (BRANCH_NAME!="master") {
+ REV="/"+BRANCH_NAME+REV.replaceAll('/','-')
+ }