5c44bda9d674fae14de6c5111e30b3ab51875835
[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           python -m pip install --upgrade pip
78           python -m pip install --upgrade tox argparse
79
80           # Useful debugging
81           python --version
82           python -m pip freeze
83           tox --version
84
85           cd $WORKSPACE/{path}
86           tox
87
88     publishers:
89       - lf-infra-publish
90
91 - job-template:
92     # Job template for docker daily jobs for 3 SCMs
93     #
94     # The purpose of this job template is to run:
95     # 1. inject a version properties file
96     # 2. login into the docker registry
97     # 4. run a specified shell script
98     #
99     # Required Variables:
100     #     branch:    git branch (eg. stable/lithium or master)
101
102     name: '{project-name}-{stream}-3scm-docker-shell-daily'
103     project-type: freestyle
104     node: 'queue-docker-4c-4g'
105
106     properties:
107       - infra-properties:
108           build-days-to-keep: '{build-days-to-keep}'
109
110     parameters:
111       - infra-parameters:
112           project: '{project}'
113           branch: '{branch}'
114           refspec: 'refs/heads/{branch}'
115           artifacts: '{archive-artifacts}'
116       - maven-exec:
117           maven-version: '{maven-version}'
118     scm:
119       - gerrit-trigger-scm:
120           refspec: ''
121           choosing-strategy: 'default'
122           submodule-recursive: '{submodule-recursive}'
123
124     wrappers:
125       - infra-wrappers-docker-build:
126           build-timeout: '{build-timeout}'
127
128     triggers:
129       - timed: 'H */4 * * *'
130       - gerrit-trigger-release-manually:
131           server: '{server-name}'
132           project: '{project}'
133           branch: '{branch}'
134       - gerrit-trigger-patch-merged:
135           server: '{server-name}'
136           project: '{project}'
137           branch: '{branch}'
138           files: '**'
139
140     builders:
141       - lf-infra-pre-build
142       - provide-maven-settings:
143           global-settings-file: 'global-settings'
144           settings-file: '{mvn-settings}'
145       - inject:
146           properties-file: version.properties
147       - docker-login
148       - shell: '{script}'
149
150     publishers:
151       - lf-infra-publish