Merge "Migrate node-verify job to global-jjb"
[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     # Tox runner to verify a project
28     #
29     # Runs tox to verify a project.
30     #
31     # Required Parameters:
32     #
33     #     :build-node: The node to run build on.
34     #     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
35     #         be configured in defaults.yaml)
36     #
37     # Optional Parameters:
38     #
39     #     :branch: The branch to build against. (default: master)
40     #     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
41     #     :build-timeout: Timeout in seconds before aborting build. (default: 10)
42     #     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
43     #     :stream: Keyword that can be used to represent a release code-name.
44     #         Often the same as the branch. (default: master)
45     #     :submodule-recursive: Whether to checkout submodules recursively.
46     #         (default: true)
47     #     :tox-dir: Directory containing the project's tox.ini relative to
48     #         the workspace. Empty works if tox.ini is at project root.
49     #         (default: '')
50     #     :tox-envs: Tox environments to run. If blank run everything described
51     #         in tox.ini. (default: '')
52
53     ######################
54     # Default parameters #
55     ######################
56
57     branch: master
58     build-days-to-keep: 7
59     build-timeout: 10
60     git-url: '$GIT_URL/$GERRIT_PROJECT'
61     stream: master
62     submodule-recursive: true
63     tox-dir: ''
64     tox-envs: ''
65
66     #####################
67     # Job Configuration #
68     #####################
69
70     project-type: freestyle
71     node: '{build-node}'
72     concurrent: true
73
74     properties:
75       - lf-infra-properties:
76           build-days-to-keep: '{build-days-to-keep}'
77
78     parameters:
79       - lf-infra-parameters:
80           project: '{project}'
81           branch: '{branch}'
82           stream: '{stream}'
83           lftools-version: '{lftools-version}'
84       - lf-infra-tox-parameters:
85           tox-dir: '{tox-dir}'
86           tox-envs: '{tox-envs}'
87
88     wrappers:
89       - lf-infra-wrappers:
90           build-timeout: '{build-timeout}'
91           jenkins-ssh-credential: '{jenkins-ssh-credential}'
92
93     builders:
94       - shell: !include-raw-escape:
95           # Workaround issue where the tox run later breaks the lftools virtualenv.
96           # Without running the install first the run in the publisher will fail
97           # due to missing lftools because it gets installed into a tox venv.
98           - ../shell/lftools-install.sh
99       - shell: !include-raw-escape:
100           - ../shell/tox-install.sh
101           - ../shell/tox-run.sh
102
103     publishers:
104       - lf-infra-publish
105
106 - job-template:
107     # Python projects typically use tox to run testing.
108     name: '{project-name}-tox-verify-{stream}'
109     id: gerrit-tox-verify
110     <<: *lf_tox_verify
111
112     ######################
113     # Default parameters #
114     ######################
115
116     gerrit_verify_triggers:
117       - patchset-created-event:
118           exclude-drafts: true
119           exclude-trivial-rebase: false
120           exclude-no-code-change: false
121       - draft-published-event
122       - comment-added-contains-event:
123           comment-contains-value: recheck$
124
125     #####################
126     # Job Configuration #
127     #####################
128
129     scm:
130       - lf-infra-gerrit-scm:
131           jenkins-ssh-credential: '{jenkins-ssh-credential}'
132           git-url: '{git-url}'
133           refspec: '$GERRIT_REFSPEC'
134           branch: '$GERRIT_BRANCH'
135           submodule-recursive: '{submodule-recursive}'
136           choosing-strategy: gerrit
137
138     triggers:
139       - gerrit:
140           server-name: '{gerrit-server-name}'
141           trigger-on: '{obj:gerrit_verify_triggers}'
142           projects:
143             - project-compare-type: ANT
144               project-pattern: '{project}'
145               branches:
146                 - branch-compare-type: ANT
147                   branch-pattern: '**/{branch}'
148
149 - job-template:
150     # Python projects typically use tox to run testing.
151     name: '{project-name}-tox-verify-{stream}'
152     id: github-tox-verify
153     <<: *lf_tox_verify
154
155     properties:
156       - github:
157           url: '{git-url}/{github-org}/{project}'
158
159     scm:
160       - lf-infra-github-scm:
161           url: '{git-clone-url}{github-org}/{project}'
162           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
163           branch: '{branch}'
164           submodule-recursive: '{submodule-recursive}'
165           choosing-strategy: default
166           jenkins-ssh-credential: '{jenkins-ssh-credential}'
167
168     triggers:
169       - github-pull-request:
170           trigger-phrase: '^recheck$'
171           only-trigger-phrase: false
172           status-context: 'JJB Verify'
173           permit-all: true
174           github-hooks: true
175           auto-close-on-fail: false