Simplify ORAN jjb file organization
[ci-management.git] / jjb / oran-templates / oran-shell-jobs.yaml
diff --git a/jjb/oran-templates/oran-shell-jobs.yaml b/jjb/oran-templates/oran-shell-jobs.yaml
new file mode 100644 (file)
index 0000000..f4a236c
--- /dev/null
@@ -0,0 +1,226 @@
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the 'License');
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an 'AS IS' BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+---
+- oran_shell_common: &oran_shell_common
+    name: oran-shell-common
+
+    ######################
+    # Default parameters #
+    ######################
+
+    archive-artifacts: >
+      **/*.log
+    branch: master
+    build-days-to-keep: 30
+    build-timeout: 15
+    cron: ''
+    concurrent: false
+    disable-job: false
+    gerrit-skip-vote: false
+    git-url: '$GIT_URL/$GERRIT_PROJECT'
+    mvn-global-settings: global-settings
+    stream: master
+    submodule-disable: false
+    submodule-recursive: true
+    submodule-timeout: 10
+
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: '.*'
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: '{build-node}'
+    disabled: '{disable-job}'
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    parameters:
+      - lf-infra-parameters:
+          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}'
+
+    builders:
+      - lf-infra-pre-build
+      - lf-provide-maven-settings:
+          global-settings-file: "{mvn-global-settings}"
+          settings-file: "{mvn-settings}"
+      - lf-infra-create-netrc:
+          server-id: "{mvn-site-id}"
+      - shell: '{script}'
+      - lf-provide-maven-settings-cleanup
+
+    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}'
+          git-url: '{git-url}'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-recursive: '{submodule-recursive}'
+          submodule-timeout: '{submodule-timeout}'
+          submodule-disable: '{submodule-disable}'
+          choosing-strategy: gerrit
+
+    triggers:
+      - timed: '{obj:cron}'
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_verify_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
+          skip-vote:
+            successful: '{gerrit-skip-vote}'
+            failed: '{gerrit-skip-vote}'
+            unstable: '{gerrit-skip-vote}'
+            notbuilt: '{gerrit-skip-vote}'
+
+# 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
+
+    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}'
+
+# Build and publish artifact from gerrit by shell script.
+# Triggered automatically by merging specific release file;
+# 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
+#   gerrit_release_file_paths: Pathname pattern of the release file to trigger this job
+- job-template:
+    name: '{project-name}-shell-release-{stream}'
+    id: oran-shell-release
+    <<: *oran_shell_common
+
+    gerrit_release_file_paths:
+      - compare-type: REG_EXP
+        pattern: 'releases\/oran-shell-release.*\.yaml'
+
+    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:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on:
+            - change-merged-event
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_release_file_paths}'
+