Refactor ORAN build-by-shell job templates 55/1455/1
authorLott, Christopher (cl778h) <cl778h@att.com>
Fri, 8 Nov 2019 18:39:36 +0000 (13:39 -0500)
committerLott, Christopher (cl778h) <cl778h@att.com>
Fri, 8 Nov 2019 18:39:36 +0000 (13:39 -0500)
Add common block with default parameters etc.
Rename verify template to oran-shell-verify.
Add merge template oran-shell-merge.
Update pti/rtp job for renamed verify template.

Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: If34617e6a838433928a4993622908fe48026bf6a

jjb/oran-jjb/oran-shell-jobs.yaml
jjb/pti-rtp/pti-rtp.yaml

index 5a5b861..3b68853 100644 (file)
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 ---
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 ---
-#
-# Template for verifying gerrit changeset by shell script.
-# Runs on changeset branch to verify new commits; can also run on master.
-#
-# Required parameters:
-#   build-node:     label (flavor) of jenkins build minion
-#   project:        git repository
-#   project-name:   Jenkins job name prefix
-#   script:         shell script to execute
-# Optional parameters:
-#   branch:         git branch, defaults to master
-#   stream:         friendly stream name (often same as branch), defaults to master
-- job-template:
-    name: '{project-name}-verify-shell-{stream}'
-    id: oran-verify-shell
+- oran_shell_common: &oran_shell_common
+    name: oran-shell-common
 
     ######################
     # Default parameters #
     ######################
 
 
     ######################
     # Default parameters #
     ######################
 
+    archive-artifacts: >
+      **/*.log
     branch: master
     build-days-to-keep: 7
     build-timeout: 15
     branch: master
     build-days-to-keep: 7
     build-timeout: 15
+    cron: ''
+    concurrent: false
     disable-job: false
     disable-job: false
-    gerrit_trigger_file_paths:
-      - compare-type: REG_EXP
-        pattern: '.*'
     gerrit-skip-vote: false
     gerrit-skip-vote: false
-    gerrit_verify_triggers:
-      - patchset-created-event:
-          exclude-drafts: true
-          exclude-trivial-rebase: false
-          exclude-no-code-change: false
-      - draft-published-event
-      - comment-added-contains-event:
-          comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
-    git-url: '$GIT_URL/$PROJECT'
+    git-url: '$GIT_URL/$GERRIT_PROJECT'
     stream: master
     stream: master
+    submodule-disable: false
     submodule-recursive: true
     submodule-timeout: 10
     submodule-recursive: true
     submodule-timeout: 10
-    submodule-disable: false
+
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: '.*'
 
     #####################
     # Job Configuration #
 
     #####################
     # Job Configuration #
           project: '{project}'
           branch: '{branch}'
           stream: '{stream}'
           project: '{project}'
           branch: '{branch}'
           stream: '{stream}'
+      - string:
+          name: ARCHIVE_ARTIFACTS
+          default: '{archive-artifacts}'
+          description: Artifacts to archive to the logs server.
 
     wrappers:
       - lf-infra-wrappers:
           build-timeout: '{build-timeout}'
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
 
     wrappers:
       - lf-infra-wrappers:
           build-timeout: '{build-timeout}'
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
+    builders:
+      - shell: '{script}'
+
+    publishers:
+      - lf-infra-publish
+
+# Verify gerrit changeset by shell script.
+# Runs on changeset branch to verify new commits; can be run on any branch.
+#
+# Required parameters:
+#   build-node:     label (flavor) of jenkins build minion
+#   project:        git repository
+#   project-name:   Jenkins job name prefix
+#   script:         shell script to execute
+# Optional parameters:
+#   branch:         git branch pattern, defaults to master
+#   stream:         friendly stream name (often same as branch), defaults to master
+- job-template:
+    name: '{project-name}-shell-verify-{stream}'
+    id: oran-shell-verify
+    <<: *oran_shell_common
+
+    gerrit_verify_triggers:
+      - patchset-created-event:
+          exclude-drafts: true
+          exclude-trivial-rebase: false
+          exclude-no-code-change: false
+      - draft-published-event
+      - comment-added-contains-event:
+          comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
+
     scm:
       - lf-infra-gerrit-scm:
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
     scm:
       - lf-infra-gerrit-scm:
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
           choosing-strategy: gerrit
 
     triggers:
           choosing-strategy: gerrit
 
     triggers:
+      - timed: '{obj:cron}'
       - gerrit:
           server-name: '{gerrit-server-name}'
           trigger-on: '{obj:gerrit_verify_triggers}'
       - gerrit:
           server-name: '{gerrit-server-name}'
           trigger-on: '{obj:gerrit_verify_triggers}'
             unstable: '{gerrit-skip-vote}'
             notbuilt: '{gerrit-skip-vote}'
 
             unstable: '{gerrit-skip-vote}'
             notbuilt: '{gerrit-skip-vote}'
 
-    builders:
-      - shell: '{script}'
+# Build from gerrit by shell script.
+# Triggered automatically by merge; can be run on any branch.
+#
+# Required parameters:
+#   build-node:     label (flavor) of jenkins build minion
+#   project:        git repository
+#   project-name:   Jenkins job name prefix
+#   script:         shell script to execute
+# Optional parameters:
+#   branch:         git branch pattern, defaults to master
+#   stream:         friendly stream name (often same as branch), defaults to master
+- job-template:
+    name: '{project-name}-shell-merge-{stream}'
+    id: oran-shell-merge
+    <<: *oran_shell_common
 
 
-    publishers:
-      - lf-infra-publish
+    gerrit_merge_triggers:
+      - change-merged-event
+      - comment-added-contains-event:
+          comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+          git-url: '{git-url}'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-recursive: '{submodule-recursive}'
+          submodule-timeout: '{submodule-timeout}'
+          submodule-disable: '{submodule-disable}'
+          choosing-strategy: default
+
+    triggers:
+      - timed: '{obj:cron}'
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_merge_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
index 240d58c..14f231e 100644 (file)
@@ -23,4 +23,4 @@
     build-timeout: 60
     script: !include-raw-escape: verify-pti-rtp-centos.sh
     jobs:
     build-timeout: 60
     script: !include-raw-escape: verify-pti-rtp-centos.sh
     jobs:
-      - oran-verify-shell
+      - oran-shell-verify