CI: Add initial gradle jobs file
[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       - shell: |
81           ./gradlew build
82
83     scm:
84       - lf-infra-gerrit-scm:
85           jenkins-ssh-credential: "{jenkins-ssh-credential}"
86           git-url: "{git-url}"
87           refspec: "$GERRIT_REFSPEC"
88           branch: "$GERRIT_BRANCH"
89           submodule-recursive: "{submodule-recursive}"
90           submodule-timeout: "{submodule-timeout}"
91           submodule-disable: "{submodule-disable}"
92           choosing-strategy: default
93
94     triggers:
95       - timed: "{obj:cron}"
96       - gerrit:
97           server-name: "{gerrit-server-name}"
98           trigger-on: "{obj:gerrit_gradle_triggers}"
99           projects:
100             - project-compare-type: ANT
101               project-pattern: "{project}"
102               branches:
103                 - branch-compare-type: ANT
104                   branch-pattern: "**/{branch}"
105               file-paths: "{obj:gerrit_trigger_file_paths}"
106
107 - job-template:
108     name: "{project-name}-gradle-build-{stream}"
109     id: github-gradle-build
110     <<: *lf_gradle_common
111
112     builders:
113       - shell: |
114           ./gradlew build
115
116     scm:
117       - lf-infra-github-scm:
118           url: "{git-clone-url}{github-org}/{project}"
119           refspec: "+refs/pull/*:refs/remotes/origin/pr/*"
120           branch: "$sha1"
121           submodule-recursive: "{submodule-recursive}"
122           submodule-timeout: "{submodule-timeout}"
123           submodule-disable: "{submodule-disable}"
124           choosing-strategy: default
125           jenkins-ssh-credential: "{jenkins-ssh-credential}"
126
127     triggers:
128       - github-pull-request:
129           trigger-phrase: ^(recheck|reverify)$
130           only-trigger-phrase: false
131           status-context: "Gradle Verify"
132           permit-all: true
133           github-hooks: true
134           white-list-target-branches:
135             - "{branch}"