Refactor templates and scripts for container tag
[releng/global-jjb.git] / jjb / lf-docker-jobs.yaml
index 9b8b731..6fbf09b 100644 (file)
     builders:
       - inject:
           properties-content: |
+            CONTAINER_TAG_METHOD={container-tag-method}
+            CONTAINER_TAG_YAML_DIR={container-tag-yaml-dir}
             DOCKER_ROOT={docker-root}
-      - conditional-step:
-          condition-kind: regex-match
-          regex: git-describe-params
-          label: '{docker-use-params-from}'
-          steps:
-            - shell: !include-raw-escape:
-                - ../shell/docker-get-git-describe.sh
-      - conditional-step:
-          condition-kind: regex-match
-          regex: yaml-file-params
-          label: '{docker-use-params-from}'
-          steps:
-            - shell: !include-raw-escape:
-                - ../shell/docker-get-yaml-tag.sh
+      - shell: !include-raw-escape:
+          - ../shell/docker-get-container-tag.sh
       - inject:
-          # Import the docker image information from the previous build step
+          # Import the container tag set by this build step
           properties-file: 'env_docker_inject.txt'
 
-
 - builder:
     name: lf-docker-build
     builders:
     submodule-timeout: 10
     pre_docker_build_script: '# pre docker build script goes here'
     post_docker_build_script: '# post docker build script goes here'
-    docker-use-params-from: ''
     disable-job: 'false'
     docker-root: '$WORKSPACE'
     docker-build-args: ''
     git-url: '$GIT_URL/$PROJECT'
+    container-tag-method: 'latest'
+    # TODO: how to interpolate value of {docker-root} parameter?
+    container-tag-yaml-dir: ''
 
     #####################
     # Job Configuration #
       - comment-added-contains-event:
           comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
 
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: '.*'
+
+    # github_included_regions MUST match gerrit_trigger_file_paths
+    github_included_regions:
+      - '.*'
+
     builders:
       - lf-infra-pre-build
       - lf-infra-docker-login:
           settings-file: '{mvn-settings}'
       - shell: '{pre_docker_build_script}'
       - lf-docker-get-container-tag:
-          docker-use-params-from: '{docker-use-params-from}'
+          container-tag-method: '{container-tag-method}'
+          container-tag-yaml-dir: '{container-tag-yaml-dir}'
           docker-root: '{docker-root}'
       - lf-docker-build:
           docker-build-args: '{docker-build-args}'
 
 - docker_merge_common: &docker_merge_common
     name: docker-merge-common
+    cron: ''
 
     scm:
       - lf-infra-gerrit-scm:
       - comment-added-contains-event:
           comment-contains-value: remerge$
 
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: '.*'
+
+    # github_included_regions MUST match gerrit_trigger_file_paths
+    github_included_regions:
+      - '.*'
+
     builders:
       - lf-infra-pre-build
       - lf-infra-docker-login:
           settings-file: '{mvn-settings}'
       - shell: '{pre_docker_build_script}'
       - lf-docker-get-container-tag:
-          docker-use-params-from: '{docker-use-params-from}'
+          container-tag-method: '{container-tag-method}'
+          container-tag-yaml-dir: '{container-tag-yaml-dir}'
           docker-root: '{docker-root}'
       - lf-docker-build:
           docker-build-args: '{docker-build-args}'
               branches:
                 - branch-compare-type: ANT
                   branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
 
 - job-template:
     name: '{project-name}-docker-verify-{stream}'
     <<: *docker_merge_common
 
     triggers:
+      - timed: '{obj:cron}'
       - gerrit:
           server-name: '{gerrit-server-name}'
           trigger-on: '{obj:gerrit_merge_triggers}'
               branches:
                 - branch-compare-type: ANT
                   branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
 
 - job-template:
     name: '{project-name}-docker-merge-{stream}'
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
     triggers:
+      - timed: '{obj:cron}'
       - github
       - pollscm:
           cron: ''