Fix: Add JDK configuration step in Gradle jobs
[releng/global-jjb.git] / jjb / lf-gradle-jobs.yaml
1 ####################
2 # COMMON FUNCTIONS #
3 ####################
4
5 - _lf_gradle_common: &lf_gradle_common
6     name: lf-gradle-common
7
8     ######################
9     # Default parameters #
10     ######################
11
12     branch: master
13     build-days-to-keep: 7
14     build-timeout: 60
15     disable-job: false
16     git-url: "$GIT_URL/$PROJECT"
17     github-url: https://github.com
18     java-version: openjdk17
19     stream: master
20     submodule-recursive: true
21     submodule-timeout: 10
22     submodule-disable: false
23     cron: "@daily"
24
25     archive-artifacts: >
26       **/*.log
27       **/hs_err_*.log
28       **/target/**/feature.xml
29       **/target/failsafe-reports/failsafe-summary.xml
30       **/target/surefire-reports/*-output.txt
31
32     #####################
33     # Job Configuration #
34     #####################
35
36     project-type: freestyle
37     node: "{build-node}"
38
39     properties:
40       - lf-infra-properties:
41           build-days-to-keep: "{build-days-to-keep}"
42
43     parameters:
44       - lf-infra-parameters:
45           project: "{project}"
46           branch: "{branch}"
47           stream: "{stream}"
48       - string:
49           name: ARCHIVE_ARTIFACTS
50           default: "{archive-artifacts}"
51           description: Artifacts to archive to the logs server.
52
53     wrappers:
54       - lf-infra-wrappers:
55           build-timeout: "{build-timeout}"
56           jenkins-ssh-credential: "{jenkins-ssh-credential}"
57
58     publishers:
59       - lf-infra-publish
60
61     gerrit_gradle_triggers:
62       - patchset-created-event:
63           exclude-drafts: true
64           exclude-trivial-rebase: false
65           exclude-no-code-change: false
66       - draft-published-event
67       - comment-added-contains-event:
68           comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$'
69
70     gerrit_trigger_file_paths:
71       - compare-type: REG_EXP
72         pattern: ".*"
73
74 - job-template:
75     name: "{project-name}-gradle-build-{stream}"
76     id: gerrit-gradle-build
77     <<: *lf_gradle_common
78
79     builders:
80       - lf-infra-pre-build
81       - lf-update-java-alternatives:
82           java-version: "{java-version}"
83       - shell: |
84           ./gradlew build
85
86     scm:
87       - lf-infra-gerrit-scm:
88           jenkins-ssh-credential: "{jenkins-ssh-credential}"
89           git-url: "{git-url}"
90           refspec: "$GERRIT_REFSPEC"
91           branch: "$GERRIT_BRANCH"
92           submodule-recursive: "{submodule-recursive}"
93           submodule-timeout: "{submodule-timeout}"
94           submodule-disable: "{submodule-disable}"
95           choosing-strategy: default
96
97     triggers:
98       - timed: "{obj:cron}"
99       - gerrit:
100           server-name: "{gerrit-server-name}"
101           trigger-on: "{obj:gerrit_gradle_triggers}"
102           projects:
103             - project-compare-type: ANT
104               project-pattern: "{project}"
105               branches:
106                 - branch-compare-type: ANT
107                   branch-pattern: "**/{branch}"
108               file-paths: "{obj:gerrit_trigger_file_paths}"
109
110 - job-template:
111     name: "{project-name}-gradle-build-{stream}"
112     id: github-gradle-build
113     <<: *lf_gradle_common
114
115     builders:
116       - shell: |
117           ./gradlew build
118
119     scm:
120       - lf-infra-github-scm:
121           url: "{git-clone-url}{github-org}/{project}"
122           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
123           branch: "$sha1"
124           submodule-recursive: "{submodule-recursive}"
125           submodule-timeout: "{submodule-timeout}"
126           submodule-disable: "{submodule-disable}"
127           choosing-strategy: default
128           jenkins-ssh-credential: "{jenkins-ssh-credential}"
129
130     triggers:
131       - github-pull-request:
132           trigger-phrase: ^(recheck|reverify)$
133           only-trigger-phrase: false
134           status-context: "Gradle Verify"
135           permit-all: true
136           github-hooks: true
137           white-list-target-branches:
138             - "{branch}"