/* Change log:
* 1. Bug 745 : Jayant Madavi, Mrityunjay Yadav : JM00553988@techmahindra.com : 23-july-2019 : Improvement to the code, typically we have 2 * or more branches whose build gets triggered, ex master & release branch, the previous code was removing any/all docker.
- * Now removing previous docker of the same branch, so that the other branch failed docker should not be removed. It also
+ * Now removing previous docker of the same branch, so that the other branch failed docker should not be removed. It also
* acts as clean-up for previous docker remove failure.
* 2. Feature 7829 : Mrityunjay Yadav, Jayant Madavi: MY00514913@techmahindra.com : 19-Aug-2019 : Added a parameters & function to invoke Robot test.
*/
{
repo_base_url = "-u ${params.REPOSITORY_BASE}"
}
- if ( params.DO_STAGE_4 ) {
- try {
+ if ( params.DO_STAGE_4 ) {
+ try {
sh "docker stack list |grep \"${container_name_prefix}\"| awk '{ print \$1 }'| xargs docker stack rm"
- }
- catch (caughtError) {
- println("Caught error: docker stack rm failed!")
- }
- }
+ }
+ catch (caughtError) {
+ println("Caught error: docker stack rm failed!")
+ }
+ }
sh """
export PATH=$PATH:/snap/bin
installers/full_install_osm.sh -y -s ${container_name} --test --nolxd --nodocker --nojuju --nohostports --nohostclient \
if ( ! currentBuild.result.equals('UNSTABLE') ) {
stage_archive = keep_artifacts
} else {
- error = new Exception("Smoke test failed")
- currentBuild.result = 'FAILURE'
- }
+ error = new Exception("Smoke test failed")
+ currentBuild.result = 'FAILURE'
+ }
}
}
stage_archive = keep_artifacts
} else {
println ("Systest test failed, throwing error")
- error = new Exception("Systest test failed")
- currentBuild.result = 'FAILURE'
- throw error
- }
+ error = new Exception("Systest test failed")
+ currentBuild.result = 'FAILURE'
+ throw error
+ }
}
}
stage("Docker Push") {
sh "make -C docker push INPUT_TAG=${container_name} TAG=${params.DOCKER_TAG}"
}
+
+ stage("Snap promotion") {
+ def snaps = ["osmclient"]
+ for (snap in snaps) {
+ channel=""
+ if (BRANCH_NAME.startsWith("v")) {
+ channel=BRANCH_NAME.substring(1)+"/"
+ } else if (BRANCH_NAME!="master") {
+ channel+="/"+BRANCH_NAME.replaceAll('/','-')
+ }
+ track=channel+"edge\\*"
+ edge_rev=sh(returnStdout: true,
+ script: "sudo docker run -v ~/.snapcraft:/snapcraft -v ${WORKSPACE}:/build " +
+ "-w /build snapcore/snapcraft:stable /bin/bash -c " +
+ "\"snapcraft login --with /snapcraft/config &>/dev/null && " +
+ "snapcraft revisions $snap\" | " +
+ "grep \" $track\" | tail -1 | awk '{print \$1}'").trim()
+ track=channel+"beta\\*"
+ beta_rev=sh(returnStdout: true,
+ script: "sudo docker run -v ~/.snapcraft:/snapcraft -v ${WORKSPACE}:/build " +
+ "-w /build snapcore/snapcraft:stable /bin/bash -c " +
+ "\"snapcraft login --with /snapcraft/config &>/dev/null && " +
+ "snapcraft revisions $snap\" | " +
+ "grep \" $track\" | tail -1 | awk '{print \$1}'").trim()
+
+ if ( edge_rev != beta_rev ) {
+ print "Promoting $edge_rev to beta in place of $beta_rev"
+ beta_track=channel+"beta"
+ sh("sudo docker run -v ~/.snapcraft:/snapcraft -v ${WORKSPACE}:/build " +
+ "-w /build snapcore/snapcraft:stable /bin/bash -c " +
+ "\"snapcraft login --with /snapcraft/config &>/dev/null && " +
+ "snapcraft release $snap $edge_rev $beta_track\"")
+ }
+ }
+ }
}
}
}