Workaround for Charmcraft Display Bug 51/12551/2
authorMark Beierl <mark.beierl@canonical.com>
Fri, 16 Sep 2022 20:41:13 +0000 (16:41 -0400)
committerbeierlm <mark.beierl@canonical.com>
Mon, 19 Sep 2022 19:22:22 +0000 (21:22 +0200)
https://github.com/canonical/charmcraft/issues/834

The same revision can be displayed more then once, so
we just take the first one

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

index d804d06..9b03016 100644 (file)
@@ -699,14 +699,12 @@ EOF"""
                                     sh "charmcraft status $charm --format json > ${charm}.json"
                                     isCharm = sh(returnStdout: true, script: "grep architecture ${charm}.json | wc -l").trim() as int
                                     if (isCharm) {
-                                        jqScriptEdge = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[] | select(.base.architecture==\"amd64\" and .base.channel==\"20.04\") | .releases[] | select(.channel==\"latest/edge/merged\")| .version'"
-                                        jqScriptBeta = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[] | select(.base.architecture==\"amd64\" and .base.channel==\"20.04\") | .releases[] | select(.channel==\"latest/beta\")| .version'"
+                                        jqScriptEdge = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[] | select(.base.architecture==\"amd64\" and .base.channel==\"20.04\") | .releases[] | select(.channel==\"latest/edge/merged\")| .version'|head -1"
+                                        jqScriptBeta = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[] | select(.base.architecture==\"amd64\" and .base.channel==\"20.04\") | .releases[] | select(.channel==\"latest/beta\")| .version'|head -1"
                                     } else {
-                                        jqScriptEdge = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[].releases[] | select(.channel==\"latest/edge/merged\")| .version'"
-                                        jqScriptBeta = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[].releases[] | select(.channel==\"latest/beta\")| .version'"
+                                        jqScriptEdge = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[].releases[] | select(.channel==\"latest/edge/merged\")| .version'|head -1"
+                                        jqScriptBeta = "cat ${charm}.json | jq -r '.[] | select(.track==\"$channel\") | .mappings[].releases[] | select(.channel==\"latest/beta\")| .version'|head -1"
                                     }
-                                    println(jqScriptEdge)
-                                    println(jqScriptBeta)
                                     // edge/merged is used in place of /edge as 10.1.0 LTS uses latest/edge
                                     edge_rev = sh(returnStdout: true, script: jqScriptEdge).trim()
                                     beta_rev = sh(returnStdout: true, script: jqScriptBeta).trim()