Improve Merge Job Speed 96/12896/1
authorMark Beierl <mark.beierl@canonical.com>
Sat, 28 Jan 2023 04:05:48 +0000 (04:05 +0000)
committerMark Beierl <mark.beierl@canonical.com>
Sat, 28 Jan 2023 04:05:48 +0000 (04:05 +0000)
Checks for charms that were changed for the merge job too
instead of forcing all charms to be rebuilt

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

index a6dcfa4..0691dcc 100644 (file)
@@ -147,9 +147,14 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifa
         for (charmPath in charms) {
             def directory = charmPath
             if (fileExists("$charmPath/charmcraft.yaml")) {
-                CHECK_CHANGES = "git diff --name-only origin/$GERRIT_BRANCH -- $directory |wc -l"
+                if (isMergeJob) {
+                    CHECK_CHANGES = "git diff --name-only HEAD^1 -- $directory |wc -l"
+                } else {
+                    CHECK_CHANGES = "git diff --name-only origin/$GERRIT_BRANCH -- $directory |wc -l"
+                }
                 charmsChanged = sh(returnStdout:true,  script: CHECK_CHANGES).trim()
-                if (charmsChanged != "0" || isMergeJob) {
+
+                if (charmsChanged != "0") {
                     println("$directory has changes, rebuilding")
 
                     parallelSteps[directory] = {