Merge changes I7d7323b8,Ib796cfee
[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 # Tox Verify #
22 ##############
23
24 - lf_tox_verify: &lf_tox_verify
25     name: lf-tox-verify
26
27     # Required Variables:
28     #     branch:    git branch (default: master)
29     #     tox-dir:   directory containing the project's tox.ini relative to
30     #                the workspace. Empty works if tox.ini is at project root.
31
32     project-type: freestyle
33     node: '{build-node}'
34     concurrent: true
35
36     ######################
37     # Default parameters #
38     ######################
39
40     branch: master
41     build-timeout: 10
42     git-url: '$GIT_URL/$GERRIT_PROJECT'
43     stream: master
44     submodule-recursive: true
45     tox-dir: ''
46     tox-envs: ''
47
48     #####################
49     # Job Configuration #
50     #####################
51
52     properties:
53       - lf-infra-properties:
54           build-days-to-keep: 7
55
56     parameters:
57       - lf-infra-parameters:
58           project: '{project}'
59           branch: '{branch}'
60           stream: '{stream}'
61           lftools-version: '{lftools-version}'
62       - lf-infra-tox-parameters:
63           tox-dir: '{tox-dir}'
64           tox-envs: '{tox-envs}'
65
66     wrappers:
67       - lf-infra-wrappers:
68           build-timeout: '{build-timeout}'
69           jenkins-ssh-credential: '{jenkins-ssh-credential}'
70
71     builders:
72       - shell: !include-raw-escape:
73           # Workaround issue where the tox run later breaks the lftools virtualenv.
74           # Without running the install first the run in the publisher will fail
75           # due to missing lftools because it gets installed into a tox venv.
76           - ../shell/lftools-install.sh
77       - shell: !include-raw-escape:
78           - ../shell/tox-install.sh
79           - ../shell/tox-run.sh
80
81     publishers:
82       - lf-infra-publish
83
84 - job-template:
85     # Python projects typically use tox to run testing.
86     name: '{project-name}-tox-verify-{stream}'
87     id: gerrit-tox-verify
88     <<: *lf_tox_verify
89
90     ######################
91     # Default parameters #
92     ######################
93
94     gerrit_verify_triggers:
95       - patchset-created-event:
96           exclude-drafts: false
97           exclude-trivial-rebase: false
98           exclude-no-code-change: false
99       - draft-published-event
100       - comment-added-contains-event:
101           comment-contains-value: recheck$
102
103     #####################
104     # Job Configuration #
105     #####################
106
107     scm:
108       - lf-infra-gerrit-scm:
109           jenkins-ssh-credential: '{jenkins-ssh-credential}'
110           git-url: '{git-url}'
111           refspec: '$GERRIT_REFSPEC'
112           branch: '$GERRIT_BRANCH'
113           submodule-recursive: '{submodule-recursive}'
114           choosing-strategy: gerrit
115
116     triggers:
117       - gerrit:
118           server-name: '{gerrit-server-name}'
119           trigger-on: '{obj:gerrit_verify_triggers}'
120           projects:
121             - project-compare-type: ANT
122               project-pattern: '{project}'
123               branches:
124                 - branch-compare-type: ANT
125                   branch-pattern: '**/{branch}'
126
127 - job-template:
128     # Python projects typically use tox to run testing.
129     name: '{project-name}-tox-verify-{stream}'
130     id: github-tox-verify
131     <<: *lf_tox_verify
132
133     properties:
134       - github:
135           url: '{git-url}/{github-org}/{project}'
136
137     scm:
138       - lf-infra-github-scm:
139           url: '{git-clone-url}{github-org}/{project}'
140           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
141           branch: '{branch}'
142           submodule-recursive: '{submodule-recursive}'
143           choosing-strategy: default
144           jenkins-ssh-credential: '{jenkins-ssh-credential}'
145
146     triggers:
147       - github-pull-request:
148           trigger-phrase: '^recheck$'
149           only-trigger-phrase: false
150           status-context: 'JJB Verify'
151           permit-all: true
152           github-hooks: true
153           auto-close-on-fail: false