def channel="latest"
if (BRANCH_NAME.startsWith("v")) {
channel=BRANCH_NAME.substring(1)
- } else if (BRANCH_NAME!="master") {
+ } else if (BRANCH_NAME!="master" && JOB_NAME.contains('merge')) {
charmBranch=BRANCH_NAME
}
try {
def resourceName = sh(
returnStdout:true,
- script: "cat metadata.yaml | yq '.resources | keys | .[0]'").trim()
+ script: "cat metadata.yaml | yq '.resources | keys | .[0]'"
+ ).trim()
+ if( resourceName != "null" ) {
+ sh "charmcraft resource-revisions $charmName $resourceName | head -2 | tail -1 | awk '{print \$1}'"
+ def resourceVers = sh(
+ returnStdout:true,
+ script: "charmcraft resource-revisions $charmName $resourceName | head -2 | tail -1 | awk '{print \$1}'"
+ ).trim()
- resourceArgument = "--resource $resourceName:1"
+ resourceArgument = "--resource $resourceName:$resourceVers"
- resourceName = sh(
- returnStdout:true,
- script: "cat metadata.yaml | yq '.resources | keys | .[1]'").trim()
- if( resourceName != "null" ) {
- resourceArgument += " --resource $resourceName:1"
+ resourceName = sh(
+ returnStdout:true,
+ script: "cat metadata.yaml | yq '.resources | keys | .[1]'").trim()
+
+ if( resourceName != "null" ) {
+ resourceVers = sh(
+ returnStdout:true,
+ script: "charmcraft resource-revisions $charmName $resourceName | head -2 | tail -1 | awk '{print \$1}'"
+ ).trim()
+ resourceArgument += " --resource $resourceName:$resourceVers"
+ }
}
} catch (Exception discard) {