Snap promotion fix 10/10210/1
authorbeierlm <mark.beierl@canonical.com>
Fri, 22 Jan 2021 18:20:35 +0000 (13:20 -0500)
committerbeierlm <mark.beierl@canonical.com>
Fri, 22 Jan 2021 18:20:35 +0000 (13:20 -0500)
Changes snapcraft to run directly on host instead of in docker
continer.  This adds the requirement to have snapcraft installed
in the Jenkins agent, but is more reliable as the snapcraft docker
image is not the best practice anymore for building snaps.

Change-Id: I78a9d12d1c6e054f0fe886ccfe08472309100d0f
Signed-off-by: beierlm <mark.beierl@canonical.com>
jenkins/ci-pipelines/ci_stage_3.groovy

index f482ee7..4ba5630 100644 (file)
@@ -518,9 +518,9 @@ EOF"""
 
                         stage("Snap promotion") {
                             def snaps = ["osmclient"]
+                            sh "snapcraft login --with ~/.snapcraft/config"
                             for (snap in snaps) {
-                                sh "docker pull snapcore/snapcraft:stable"
-                                channel=""
+                                channel="latest/"
                                 if (BRANCH_NAME.startsWith("v")) {
                                     channel=BRANCH_NAME.substring(1)+"/"
                                 } else if (BRANCH_NAME!="master") {
@@ -528,26 +528,19 @@ EOF"""
                                 }
                                 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()
+                                    script: "snapcraft revisions $snap | " +
+                                    "grep \"$track\" | tail -1 | awk '{print \$1}'").trim()
+                                print "edge rev is $edge_rev"
                                 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()
+                                    script: "snapcraft revisions $snap | " +
+                                    "grep \"$track\" | tail -1 | awk '{print \$1}'").trim()
+                                print "beta rev is $beta_rev"
 
                                 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\"")
+                                    sh "snapcraft release $snap $edge_rev $beta_track"
                                 }
                             }
                         }