Merge "Install git-review outside of loop"
[releng/global-jjb.git] / jjb / lf-python-jobs.yaml
1 ---
2 - job-group:
3     name: '{project-name}-python-jobs'
4
5     # This job group contains all the recommended jobs that should be deployed
6     # for any project ci that is using Gerrit.
7
8     jobs:
9       - gerrit-tox-verify
10
11 - job-group:
12     name: '{project-name}-github-python-jobs'
13
14     # This job group contains all the recommended jobs that should be deployed
15     # for any project ci that is using GitHub.
16
17     jobs:
18       - github-tox-verify
19
20 ##########
21 # Macros #
22 ##########
23
24 - builder:
25     name: lf-infra-tox-install
26     builders:
27       - inject:
28           properties-content: 'PYTHON_VERSION={python-version}'
29       - shell: !include-raw-escape: ../shell/tox-install.sh
30
31 ##############
32 # Tox Verify #
33 ##############
34
35 - lf_tox_verify: &lf_tox_verify
36     name: lf-tox-verify
37
38     ######################
39     # Default parameters #
40     ######################
41
42     branch: master
43     build-days-to-keep: 7
44     build-timeout: 10
45     git-url: '$GIT_URL/$GERRIT_PROJECT'
46     python-version: python3
47     stream: master
48     submodule-recursive: true
49     tox-dir: ''
50     tox-envs: ''
51
52     #####################
53     # Job Configuration #
54     #####################
55
56     project-type: freestyle
57     node: '{build-node}'
58     concurrent: true
59
60     properties:
61       - lf-infra-properties:
62           build-days-to-keep: '{build-days-to-keep}'
63
64     parameters:
65       - lf-infra-parameters:
66           project: '{project}'
67           branch: '{branch}'
68           stream: '{stream}'
69           lftools-version: '{lftools-version}'
70       - lf-infra-tox-parameters:
71           tox-dir: '{tox-dir}'
72           tox-envs: '{tox-envs}'
73
74     wrappers:
75       - lf-infra-wrappers:
76           build-timeout: '{build-timeout}'
77           jenkins-ssh-credential: '{jenkins-ssh-credential}'
78
79     builders:
80       - shell: !include-raw-escape:
81           # Workaround issue where the tox run later breaks the lftools virtualenv.
82           # Without running the install first the run in the publisher will fail
83           # due to missing lftools because it gets installed into a tox venv.
84           - ../shell/lftools-install.sh
85       - lf-infra-tox-install:
86           python-version: '{python-version}'
87       - shell: !include-raw-escape: ../shell/tox-run.sh
88
89     publishers:
90       - lf-infra-publish
91
92 - job-template:
93     # Python projects typically use tox to run testing.
94     name: '{project-name}-tox-verify-{stream}'
95     id: gerrit-tox-verify
96     <<: *lf_tox_verify
97
98     ######################
99     # Default parameters #
100     ######################
101
102     gerrit_verify_triggers:
103       - patchset-created-event:
104           exclude-drafts: true
105           exclude-trivial-rebase: false
106           exclude-no-code-change: false
107       - draft-published-event
108       - comment-added-contains-event:
109           comment-contains-value: recheck$
110
111     #####################
112     # Job Configuration #
113     #####################
114
115     scm:
116       - lf-infra-gerrit-scm:
117           jenkins-ssh-credential: '{jenkins-ssh-credential}'
118           git-url: '{git-url}'
119           refspec: '$GERRIT_REFSPEC'
120           branch: '$GERRIT_BRANCH'
121           submodule-recursive: '{submodule-recursive}'
122           choosing-strategy: gerrit
123
124     triggers:
125       - gerrit:
126           server-name: '{gerrit-server-name}'
127           trigger-on: '{obj:gerrit_verify_triggers}'
128           projects:
129             - project-compare-type: ANT
130               project-pattern: '{project}'
131               branches:
132                 - branch-compare-type: ANT
133                   branch-pattern: '**/{branch}'
134
135 - job-template:
136     # Python projects typically use tox to run testing.
137     name: '{project-name}-tox-verify-{stream}'
138     id: github-tox-verify
139     <<: *lf_tox_verify
140
141     properties:
142       - github:
143           url: '{git-url}/{github-org}/{project}'
144
145     scm:
146       - lf-infra-github-scm:
147           url: '{git-clone-url}{github-org}/{project}'
148           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
149           branch: '$sha1'
150           submodule-recursive: '{submodule-recursive}'
151           choosing-strategy: default
152           jenkins-ssh-credential: '{jenkins-ssh-credential}'
153
154     triggers:
155       - github-pull-request:
156           trigger-phrase: '^recheck$'
157           only-trigger-phrase: false
158           status-context: 'JJB Verify'
159           permit-all: true
160           github-hooks: true
161           auto-close-on-fail: false