dcc59855c33def6f28a2c33ae8e6f8b36a8548f2
[ci-management.git] / jjb / global-templates-python.yaml
1 ---
2 - job-template:
3     # Job template for python verify jobs
4     #
5     # The purpose of this job template is to run:
6     # 1. tox
7     #
8     # This job supports subprojects.
9     #
10     # Required Variables:
11     #     branch:    git branch (eg. stable/lithium or master)
12     # Optional Variables:
13     #     path:      directory containing the project's tox.ini relative to
14     #                the workspace. The default is the project root.
15     #     pattern:   ant file-path pattern relative to the workspace used to
16     #                trigger the job
17
18     name: '{project-name}-{stream}-{subproject}-verify-python'
19     path: '$WORKSPACE'
20
21     project-type: freestyle
22     concurrent: true
23     node: '{build-node}'
24
25     properties:
26       - infra-properties:
27           build-days-to-keep: '{build-days-to-keep}'
28
29     parameters:
30       - infra-parameters:
31           project: '{project}'
32           branch: '{branch}'
33           refspec: 'refs/heads/{branch}'
34           artifacts: '{archive-artifacts}'
35       - maven-exec:
36           maven-version: '{maven-version}'
37
38     scm:
39       - gerrit-trigger-scm:
40           refspec: '$GERRIT_REFSPEC'
41           choosing-strategy: 'gerrit'
42           submodule-recursive: '{submodule-recursive}'
43
44     wrappers:
45       - infra-wrappers:
46           build-timeout: '{build-timeout}'
47
48     triggers:
49       - gerrit-trigger-patch-submitted:
50           server: '{server-name}'
51           project: '{project}'
52           branch: '{branch}'
53           files: '{pattern}'
54
55     builders:
56       - lf-infra-pre-build
57       - provide-maven-settings:
58           global-settings-file: 'global-settings'
59           settings-file: '{mvn-settings}'
60       - shell: |
61           #!/bin/bash
62           # shellcheck disable=SC1090
63           source ~/lf-env.sh
64
65           lf-activate-venv --python python3.8 --venv-file /tmp/.toxenv \
66             tox==3.27.1 tox-pyenv virtualenv
67
68           if [[ -d /opt/pyenv ]]; then
69             echo "---> Setting up pyenv"
70             export PYENV_ROOT="/opt/pyenv"
71             export PATH="$PYENV_ROOT/bin:$PATH"
72             PYTHONPATH="$(pwd)"
73             export PYTHONPATH
74             export TOX_TESTENV_PASSENV=PYTHONPATH
75           fi
76
77           # Useful debugging
78           python --version
79           tox --version
80
81           tox
82
83     publishers:
84       - lf-infra-publish
85
86 - job-template:
87     # Job template for docker daily jobs for 3 SCMs
88     #
89     # The purpose of this job template is to run:
90     # 1. inject a version properties file
91     # 2. login into the docker registry
92     # 4. run a specified shell script
93     #
94     # Required Variables:
95     #     branch:    git branch (eg. stable/lithium or master)
96
97     name: '{project-name}-{stream}-3scm-docker-shell-daily'
98     project-type: freestyle
99     node: 'queue-docker-4c-4g'
100
101     properties:
102       - infra-properties:
103           build-days-to-keep: '{build-days-to-keep}'
104
105     parameters:
106       - infra-parameters:
107           project: '{project}'
108           branch: '{branch}'
109           refspec: 'refs/heads/{branch}'
110           artifacts: '{archive-artifacts}'
111       - maven-exec:
112           maven-version: '{maven-version}'
113     scm:
114       - gerrit-trigger-scm:
115           refspec: ''
116           choosing-strategy: 'default'
117           submodule-recursive: '{submodule-recursive}'
118
119     wrappers:
120       - infra-wrappers-docker-build:
121           build-timeout: '{build-timeout}'
122
123     triggers:
124       - timed: 'H */4 * * *'
125       - gerrit-trigger-release-manually:
126           server: '{server-name}'
127           project: '{project}'
128           branch: '{branch}'
129       - gerrit-trigger-patch-merged:
130           server: '{server-name}'
131           project: '{project}'
132           branch: '{branch}'
133           files: '**'
134
135     builders:
136       - lf-infra-pre-build
137       - provide-maven-settings:
138           global-settings-file: 'global-settings'
139           settings-file: '{mvn-settings}'
140       - inject:
141           properties-file: version.properties
142       - docker-login
143       - shell: '{script}'
144
145     publishers:
146       - lf-infra-publish