validation: Only run tagged docker build once 60/3360/2
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 15 Apr 2020 19:11:34 +0000 (21:11 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 15 Apr 2020 20:43:49 +0000 (22:43 +0200)
Previously, we used to manually change the release tag for the Docker
container image(s) built for the validation project, let the build run
once, then create another change that disabled the job to prevent
further (useless) rebuilds happening each night.

Instead of triggering the docker build job for the release (tag) using
cron, switch to triggering the job based on gerrit merge events
affecting the ci-management repository and only if the said merge event
affects the 'validation-docker.yaml' configuration file (the one where
the release tag is defined/updated).

Change-Id: Ia4493b558ee7d1319c42a04690aa1c7580eb3731
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
jjb/akraino-templates/akraino-validation-templates.yaml
jjb/validation/validation-docker.yaml

index 8a64fed..33fb9be 100644 (file)
@@ -23,9 +23,7 @@
             - 'validation-docker-.*'
           block-level: 'NODE'
 
-    triggers:
-      # Build nigtly at 12:10 AM
-      - timed: '10 0 * * *'
+    triggers: '{obj:triggers}'
 
     builders:
       - multijob:
index c8fffa6..539ed75 100644 (file)
@@ -7,9 +7,28 @@
       - master:
           branch: '{stream}'
           disabled: false
+          triggers:
+            # Build nigtly at 12:10 AM
+            - timed: '10 0 * * *'
       - 3.0.0:
           branch: 'master'
           disabled: false
+          triggers:
+            - gerrit:
+                server-name: '{gerrit-server-name}'
+                trigger-on:
+                  - change-merged-event
+                  - comment-added-contains-event:
+                      comment-contains-value: remerge$
+                projects:
+                  - project-compare-type: ANT
+                    project-pattern: 'ci-management'
+                    branches:
+                      - branch-compare-type: ANT
+                        branch-pattern: '**/master'
+                    file-paths:
+                      - compare-type: REG_EXP
+                        pattern: 'jjb/validation/validation-docker.yaml'
 
     arch_tag:
       - 'amd64':