Refactor ORAN build-by-shell job templates
[ci-management.git] / jjb / oran-jjb / oran-shell-jobs.yaml
1 #   Copyright (c) 2019 AT&T Intellectual Property.
2 #
3 #   Licensed under the Apache License, Version 2.0 (the 'License');
4 #   you may not use this file except in compliance with the License.
5 #   You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #   Unless required by applicable law or agreed to in writing, software
10 #   distributed under the License is distributed on an 'AS IS' BASIS,
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #   See the License for the specific language governing permissions and
13 #   limitations under the License.
14 ---
15 - oran_shell_common: &oran_shell_common
16     name: oran-shell-common
17
18     ######################
19     # Default parameters #
20     ######################
21
22     archive-artifacts: >
23       **/*.log
24     branch: master
25     build-days-to-keep: 7
26     build-timeout: 15
27     cron: ''
28     concurrent: false
29     disable-job: false
30     gerrit-skip-vote: false
31     git-url: '$GIT_URL/$GERRIT_PROJECT'
32     stream: master
33     submodule-disable: false
34     submodule-recursive: true
35     submodule-timeout: 10
36
37     gerrit_trigger_file_paths:
38       - compare-type: REG_EXP
39         pattern: '.*'
40
41     #####################
42     # Job Configuration #
43     #####################
44
45     project-type: freestyle
46     node: '{build-node}'
47     disabled: '{disable-job}'
48
49     properties:
50       - lf-infra-properties:
51           build-days-to-keep: '{build-days-to-keep}'
52
53     parameters:
54       - lf-infra-parameters:
55           project: '{project}'
56           branch: '{branch}'
57           stream: '{stream}'
58       - string:
59           name: ARCHIVE_ARTIFACTS
60           default: '{archive-artifacts}'
61           description: Artifacts to archive to the logs server.
62
63     wrappers:
64       - lf-infra-wrappers:
65           build-timeout: '{build-timeout}'
66           jenkins-ssh-credential: '{jenkins-ssh-credential}'
67
68     builders:
69       - shell: '{script}'
70
71     publishers:
72       - lf-infra-publish
73
74 # Verify gerrit changeset by shell script.
75 # Runs on changeset branch to verify new commits; can be run on any branch.
76 #
77 # Required parameters:
78 #   build-node:     label (flavor) of jenkins build minion
79 #   project:        git repository
80 #   project-name:   Jenkins job name prefix
81 #   script:         shell script to execute
82 # Optional parameters:
83 #   branch:         git branch pattern, defaults to master
84 #   stream:         friendly stream name (often same as branch), defaults to master
85 - job-template:
86     name: '{project-name}-shell-verify-{stream}'
87     id: oran-shell-verify
88     <<: *oran_shell_common
89
90     gerrit_verify_triggers:
91       - patchset-created-event:
92           exclude-drafts: true
93           exclude-trivial-rebase: false
94           exclude-no-code-change: false
95       - draft-published-event
96       - comment-added-contains-event:
97           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
98
99     scm:
100       - lf-infra-gerrit-scm:
101           jenkins-ssh-credential: '{jenkins-ssh-credential}'
102           git-url: '{git-url}'
103           refspec: '$GERRIT_REFSPEC'
104           branch: '$GERRIT_BRANCH'
105           submodule-recursive: '{submodule-recursive}'
106           submodule-timeout: '{submodule-timeout}'
107           submodule-disable: '{submodule-disable}'
108           choosing-strategy: gerrit
109
110     triggers:
111       - timed: '{obj:cron}'
112       - gerrit:
113           server-name: '{gerrit-server-name}'
114           trigger-on: '{obj:gerrit_verify_triggers}'
115           projects:
116             - project-compare-type: ANT
117               project-pattern: '{project}'
118               branches:
119                 - branch-compare-type: ANT
120                   branch-pattern: '**/{branch}'
121               file-paths: '{obj:gerrit_trigger_file_paths}'
122           skip-vote:
123             successful: '{gerrit-skip-vote}'
124             failed: '{gerrit-skip-vote}'
125             unstable: '{gerrit-skip-vote}'
126             notbuilt: '{gerrit-skip-vote}'
127
128 # Build from gerrit by shell script.
129 # Triggered automatically by merge; can be run on any branch.
130 #
131 # Required parameters:
132 #   build-node:     label (flavor) of jenkins build minion
133 #   project:        git repository
134 #   project-name:   Jenkins job name prefix
135 #   script:         shell script to execute
136 # Optional parameters:
137 #   branch:         git branch pattern, defaults to master
138 #   stream:         friendly stream name (often same as branch), defaults to master
139 - job-template:
140     name: '{project-name}-shell-merge-{stream}'
141     id: oran-shell-merge
142     <<: *oran_shell_common
143
144     gerrit_merge_triggers:
145       - change-merged-event
146       - comment-added-contains-event:
147           comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$'
148
149     scm:
150       - lf-infra-gerrit-scm:
151           jenkins-ssh-credential: '{jenkins-ssh-credential}'
152           git-url: '{git-url}'
153           refspec: '$GERRIT_REFSPEC'
154           branch: '$GERRIT_BRANCH'
155           submodule-recursive: '{submodule-recursive}'
156           submodule-timeout: '{submodule-timeout}'
157           submodule-disable: '{submodule-disable}'
158           choosing-strategy: default
159
160     triggers:
161       - timed: '{obj:cron}'
162       - gerrit:
163           server-name: '{gerrit-server-name}'
164           trigger-on: '{obj:gerrit_merge_triggers}'
165           projects:
166             - project-compare-type: ANT
167               project-pattern: '{project}'
168               branches:
169                 - branch-compare-type: ANT
170                   branch-pattern: '**/{branch}'
171               file-paths: '{obj:gerrit_trigger_file_paths}'