Pass multiple pattern args in logs-deploy.sh
[releng/global-jjb.git] / jjb / lf-whitesource-jobs.yaml
1 ---
2
3 ##########
4 # Macros #
5 ##########
6
7 - builder:
8     name: lf-infra-wss-mvn-clean-install
9     builders:
10       - conditional-step:
11           condition-kind: boolean-expression
12           condition-expression: '{mvn-clean-install}'
13           steps:
14             - maven-target:
15                 maven-version: '{mvn-version}'
16                 pom: '{mvn-pom}'
17                 goals: 'clean install'
18                 settings: '{mvn-settings}'
19                 settings-type: cfp
20                 global-settings: 'global-settings'
21                 global-settings-type: cfp
22
23 - builder:
24     name: lf-infra-wss-unified-agent-scan
25     builders:
26       - config-file-provider:
27           files:
28             - file-id: wss-unified-agent.config
29               target: $WORKSPACE/wss-unified-agent.config
30       - shell: !include-raw:
31           - ../shell/whitesource-unified-agent-cli.sh
32
33 ####################
34 # COMMON FUNCTIONS #
35 ####################
36
37 - lf_whitesource_common: &lf_whitesource_common
38     name: lf-whitesource-common
39
40     ######################
41     # Default parameters #
42     ######################
43
44     archive-artifacts: >
45       **/*.log
46
47     #####################
48     # Job Configuration #
49     #####################
50
51     project-type: freestyle
52     node: '{build-node}'
53
54     properties:
55       - lf-infra-properties:
56           build-days-to-keep: '{build-days-to-keep}'
57
58     parameters:
59       - lf-infra-parameters:
60           project: '{project}'
61           branch: '{branch}'
62           stream: '{stream}'
63
64     wrappers:
65       - lf-infra-wrappers:
66           build-timeout: '{build-timeout}'
67           jenkins-ssh-credential: '{jenkins-ssh-credential}'
68       - credentials-binding:
69           - text:
70               credential-id: wss-apiKey
71               variable: wss-apiKey
72
73     publishers:
74       - lf-infra-publish
75
76 ##################################
77 # WHITESOURCE UNIFIED AGENT SCAN #
78 ##################################
79
80 - lf_wss_unified_agent_scan: &lf_wss_unified_agent_scan
81     name: lf-wss-unified-agent-scan
82
83     ######################
84     # Default parameters #
85     ######################
86
87     branch: master
88     build-days-to-keep: 30
89     build-timeout: 60
90     cron: '@daily'
91     disable-job: false
92     git-url: '$GIT_URL/$PROJECT'
93     github-url: 'https://github.com'
94     java-version: openjdk8
95     mvn-clean-install: false
96     mvn-global-settings: global-settings
97     mvn-pom: ''
98     mvn-version: mvn35
99     stream: master
100     submodule-recursive: true
101     submodule-timeout: 10
102     wss-unified-agent-opts: ''
103     wss-unified-agent-version: 19.2.2.2
104
105     gerrit_trigger_file_paths:
106       - compare-type: ANT
107         pattern: '.*'
108
109     # github_included_regions MUST match gerrit_trigger_file_paths
110     github_included_regions:
111       - '.*'
112
113     #####################
114     # Job Configuration #
115     #####################
116
117     disabled: '{disable-job}'
118
119     parameters:
120       - lf-infra-parameters:
121           project: '{project}'
122           branch: '{branch}'
123           stream: '{stream}'
124       - string:
125           name: WSS_PROJECT_NAME
126           default: '{project-name}'
127           description: Project to asociate the WhiteSource report in the dashboard.
128       - string:
129           name: WSS_PRODUCT_NAME
130           default: '{wss-product-name}'
131           description: Product to asociate the WhiteSource report in the dashboard.
132       - string:
133           name: WSS_UNIFIED_AGENT_OPTIONS
134           default: '{wss-unified-agent-opts}'
135           description: Options to pass to the WhiteSource Unified Agent CLI.
136       - string:
137           name: WSS_UNIFIED_AGENT_VERSION
138           default: '{wss-unified-agent-version}'
139           description: WhiteSource Unified Agent version package to download and use.
140
141     builders:
142       - lf-infra-pre-build
143       - lf-update-java-alternatives:
144           java-version: '{java-version}'
145       - lf-infra-wss-mvn-clean-install:
146           mvn-clean-install: '{mvn-clean-install}'
147           mvn-version: '{mvn-version}'
148           mvn-pom: '{mvn-pom}'
149           mvn-settings: '{mvn-settings}'
150       - lf-infra-wss-unified-agent-scan
151
152 - job-template:
153     name: '{project-name}-whitesource-scan-{stream}'
154     id: gerrit-whitesource-scan
155     <<: *lf_whitesource_common
156     # yamllint disable-line rule:key-duplicates
157     <<: *lf_wss_unified_agent_scan
158
159     ######################
160     # Default parameters #
161     ######################
162
163     gerrit_wss_triggers:
164       - comment-added-contains-event:
165           comment-contains-value: run-whitesource$
166
167     #####################
168     # Job Configuration #
169     #####################
170
171     scm:
172       - lf-infra-gerrit-scm:
173           jenkins-ssh-credential: '{jenkins-ssh-credential}'
174           git-url: '{git-url}'
175           refspec: '$GERRIT_REFSPEC'
176           branch: '$GERRIT_BRANCH'
177           submodule-recursive: '{submodule-recursive}'
178           submodule-timeout: '{submodule-timeout}'
179           choosing-strategy: default
180
181     triggers:
182       # Build weekly on Saturdays
183       - timed: '{obj:cron}'
184       - gerrit:
185           server-name: '{gerrit-server-name}'
186           trigger-on: '{obj:gerrit_wss_triggers}'
187           projects:
188             - project-compare-type: ANT
189               project-pattern: '{project}'
190               branches:
191                 - branch-compare-type: ANT
192                   branch-pattern: '**/{branch}'
193               file-paths: '{obj:gerrit_trigger_file_paths}'
194           skip-vote:
195             successful: true
196             failed: true
197             unstable: true
198             notbuilt: true
199
200 - job-template:
201     name: '{project-name}-whitesource-scan-{stream}'
202     id: github-whitesource-scan
203     <<: *lf_whitesource_common
204     # yamllint disable-line rule:key-duplicates
205     <<: *lf_wss_unified_agent_scan
206
207     properties:
208       - lf-infra-properties:
209           build-days-to-keep: '{build-days-to-keep}'
210       - github:
211           url: '{github-url}/{github-org}/{project}'
212
213     scm:
214       - lf-infra-github-scm:
215           url: '{git-clone-url}{github-org}/{project}'
216           refspec: ''
217           branch: 'refs/heads/{branch}'
218           submodule-recursive: '{submodule-recursive}'
219           submodule-timeout: '{submodule-timeout}'
220           choosing-strategy: default
221           jenkins-ssh-credential: '{jenkins-ssh-credential}'
222
223     triggers:
224       # Build weekly on Saturdays
225       - timed: '{obj:cron}'
226       - github-pull-request:
227           trigger-phrase: '^run-whitesource$'
228           only-trigger-phrase: false
229           status-context: 'WhiteSource'
230           permit-all: true
231           github-hooks: true
232           white-list-target-branches:
233             - '{branch}'
234           included-regions: '{obj:github_included_regions}'