e66f522cc899ca116b17515e2c99a7abe3f6cd0d
[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 # Anchors & Macros #
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: '{stream}'
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       - lf-infra-tox-parameters:
62           tox-dir: '{tox-dir}'
63           tox-envs: '{tox-envs}'
64
65     wrappers:
66       - lf-infra-wrappers:
67           build-timeout: '{build-timeout}'
68           jenkins-ssh-credential: '{jenkins-ssh-credential}'
69
70     builders:
71       - shell: !include-raw-escape:
72           # Workaround issue where the tox run later breaks the lftools virtualenv.
73           # Without running the install first the run in the publisher will fail
74           # due to missing lftools because it gets installed into a tox venv.
75           - ../shell/lftools-install.sh
76       - shell: !include-raw-escape:
77           - ../shell/tox-install.sh
78           - ../shell/tox-run.sh
79
80     publishers:
81       - lf-infra-publish
82
83 #################
84 # Job Templates #
85 #################
86
87 - job-template:
88     # Python projects typically use tox to run testing.
89     name: '{project-name}-tox-verify-{stream}'
90     id: gerrit-tox-verify
91     <<: *lf_tox_verify
92
93     scm:
94       - lf-infra-gerrit-scm:
95           jenkins-ssh-credential: '{jenkins-ssh-credential}'
96           git-url: '{git-url}'
97           refspec: '$GERRIT_REFSPEC'
98           branch: '$GERRIT_BRANCH'
99           submodule-recursive: '{submodule-recursive}'
100           choosing-strategy: gerrit
101
102     triggers:
103       - gerrit:
104           server-name: '{gerrit-server-name}'
105           trigger-on:
106             - patchset-created-event:
107                 exclude-drafts: false
108                 exclude-trivial-rebase: false
109                 exclude-no-code-change: false
110             - draft-published-event
111             - comment-added-contains-event:
112                 comment-contains-value: recheck$
113           projects:
114             - project-compare-type: ANT
115               project-pattern: '{project}'
116               branches:
117                 - branch-compare-type: ANT
118                   branch-pattern: '**/{branch}'
119
120 - job-template:
121     # Python projects typically use tox to run testing.
122     name: '{project-name}-tox-verify-{stream}'
123     id: github-tox-verify
124     <<: *lf_tox_verify
125
126     properties:
127       - github:
128           url: '{git-url}/{github-org}/{project}'
129
130     scm:
131       - lf-infra-github-scm:
132           url: '{git-clone-url}{github-org}/{project}'
133           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
134           branch: '{branch}'
135           submodule-recursive: '{submodule-recursive}'
136           choosing-strategy: default
137           jenkins-ssh-credential: '{jenkins-ssh-credential}'
138
139     triggers:
140       - github-pull-request:
141           trigger-phrase: '^recheck$'
142           only-trigger-phrase: false
143           status-context: 'JJB Verify'
144           permit-all: true
145           github-hooks: true
146           auto-close-on-fail: false