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