ci: Rebuild CI files
[nbdkit.git] / ci / gitlab / build-templates.yml
blob8c56851f096cba02309fba5eea9bb7c8945b6a97
1 # THIS FILE WAS AUTO-GENERATED
3 #  $ lcitool manifest ci/manifest.yml
5 # https://gitlab.com/libvirt/libvirt-ci
9 # We use pre-built containers for any pipelines that are:
11 #  - Validating code committed on default upstream branch
12 #  - Validating patches targetting default upstream branch
13 #    which do not have CI changes
15 # We use a local build env for any pipelines that are:
17 #  - Validating code committed to a non-default upstream branch
18 #  - Validating patches targetting a non-default upstream branch
19 #  - Validating patches targetting default upstream branch which
20 #    include CI changes
21 #  - Validating code committed to a fork branch
23 # Note: the rules across the prebuilt_env and local_env templates
24 # should be logical inverses, such that jobs are mutually exclusive
26 .gitlab_native_build_job_prebuilt_env:
27   image: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/nbdkit/ci-$NAME:latest
28   stage: builds
29   before_script:
30     - cat /packages.txt
31   rules:
32     # upstream: pushes to the default branch
33     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
34       when: manual
35       allow_failure: true
36     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
37       when: on_success
39     # upstream: other web/api/scheduled pipelines targetting the default branch
40     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
41       when: manual
42       allow_failure: true
43     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
44       when: on_success
46     # upstream+forks: merge requests targetting the default branch, without CI changes
47     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
48       changes:
49         - ci/gitlab/container-templates.yml
50         - ci/containers/$NAME.Dockerfile
51       when: never
52     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
53       when: manual
54       allow_failure: true
55     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
56       when: on_success
58     # upstream+forks: that's all folks
59     - when: never
61 .gitlab_native_build_job_local_env:
62   image: $IMAGE
63   stage: builds
64   before_script:
65     - source ci/buildenv/$NAME.sh
66     - install_buildenv
67     - cat /packages.txt
68   rules:
69     # upstream: pushes to a non-default branch
70     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
71       when: manual
72       allow_failure: true
73     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
74       when: on_success
76     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE && $JOB_OPTIONAL'
77       when: manual
78       allow_failure: true
79     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE'
80       when: on_success
82     # upstream: other web/api/scheduled pipelines targetting non-default branches
83     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
84       when: manual
85       allow_failure: true
86     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH'
87       when: on_success
89     # forks: other web/api/scheduled pipelines
90     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $JOB_OPTIONAL'
91       when: manual
92       allow_failure: true
93     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/'
94       when: on_success
96     # upstream+forks: merge requests targetting the default branch, with CI changes
97     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
98       changes:
99         - ci/gitlab/container-templates.yml
100         - ci/containers/$NAME.Dockerfile
101       when: manual
102       allow_failure: true
103     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
104       changes:
105         - ci/gitlab/container-templates.yml
106         - ci/containers/$NAME.Dockerfile
107       when: on_success
109     # upstream+forks: merge requests targetting non-default branches
110     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
111       when: manual
112       allow_failure: true
113     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH'
114       when: on_success
116     # upstream+forks: that's all folks
117     - when: never
121 # We use pre-built containers for any pipelines that are:
123 #  - Validating code committed on default upstream branch
124 #  - Validating patches targetting default upstream branch
125 #    which do not have CI changes
127 # We use a local build env for any pipelines that are:
129 #  - Validating code committed to a non-default upstream branch
130 #  - Validating patches targetting a non-default upstream branch
131 #  - Validating patches targetting default upstream branch which
132 #    include CI changes
133 #  - Validating code committed to a fork branch
135 # Note: the rules across the prebuilt_env and local_env templates
136 # should be logical inverses, such that jobs are mutually exclusive
138 .gitlab_cross_build_job_prebuilt_env:
139   image: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/nbdkit/ci-$NAME-cross-$CROSS:latest
140   stage: builds
141   before_script:
142     - cat /packages.txt
143   rules:
144     # upstream: pushes to the default branch
145     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
146       when: manual
147       allow_failure: true
148     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
149       when: on_success
151     # upstream: other web/api/scheduled pipelines targetting the default branch
152     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
153       when: manual
154       allow_failure: true
155     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
156       when: on_success
158     # upstream+forks: merge requests targetting the default branch, without CI changes
159     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
160       changes:
161         - ci/gitlab/container-templates.yml
162         - ci/containers/$NAME.Dockerfile
163       when: never
164     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
165       when: manual
166       allow_failure: true
167     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
168       when: on_success
170     # upstream+forks: that's all folks
171     - when: never
173 .gitlab_cross_build_job_local_env:
174   image: $IMAGE
175   stage: builds
176   before_script:
177     - source ci/buildenv/$NAME.sh
178     - install_buildenv
179     - cat /packages.txt
180   rules:
181     # upstream: pushes to a non-default branch
182     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
183       when: manual
184       allow_failure: true
185     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
186       when: on_success
188     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE && $JOB_OPTIONAL'
189       when: manual
190       allow_failure: true
191     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE'
192       when: on_success
194     # upstream: other web/api/scheduled pipelines targetting non-default branches
195     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
196       when: manual
197       allow_failure: true
198     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH'
199       when: on_success
201     # forks: other web/api/scheduled pipelines
202     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $JOB_OPTIONAL'
203       when: manual
204       allow_failure: true
205     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/'
206       when: on_success
208     # upstream+forks: merge requests targetting the default branch, with CI changes
209     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
210       changes:
211         - ci/gitlab/container-templates.yml
212         - ci/containers/$NAME.Dockerfile
213       when: manual
214       allow_failure: true
215     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
216       changes:
217         - ci/gitlab/container-templates.yml
218         - ci/containers/$NAME.Dockerfile
219       when: on_success
221     # upstream+forks: merge requests targetting non-default branches
222     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
223       when: manual
224       allow_failure: true
225     - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH'
226       when: on_success
228     # upstream+forks: that's all folks
229     - when: never
232 .cirrus_build_job:
233   stage: builds
234   image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master
235   needs: []
236   script:
237     - source ci/cirrus/$NAME.vars
238     - sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
239           -e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
240           -e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
241           -e "s|[@]CIRRUS_VM_INSTANCE_TYPE@|$CIRRUS_VM_INSTANCE_TYPE|g"
242           -e "s|[@]CIRRUS_VM_IMAGE_SELECTOR@|$CIRRUS_VM_IMAGE_SELECTOR|g"
243           -e "s|[@]CIRRUS_VM_IMAGE_NAME@|$CIRRUS_VM_IMAGE_NAME|g"
244           -e "s|[@]UPDATE_COMMAND@|$UPDATE_COMMAND|g"
245           -e "s|[@]UPGRADE_COMMAND@|$UPGRADE_COMMAND|g"
246           -e "s|[@]INSTALL_COMMAND@|$INSTALL_COMMAND|g"
247           -e "s|[@]PATH@|$PATH_EXTRA${PATH_EXTRA:+:}\$PATH|g"
248           -e "s|[@]PKG_CONFIG_PATH@|$PKG_CONFIG_PATH|g"
249           -e "s|[@]PKGS@|$PKGS|g"
250           -e "s|[@]MAKE@|$MAKE|g"
251           -e "s|[@]PYTHON@|$PYTHON|g"
252           -e "s|[@]PIP3@|$PIP3|g"
253           -e "s|[@]PYPI_PKGS@|$PYPI_PKGS|g"
254           -e "s|[@]XML_CATALOG_FILES@|$XML_CATALOG_FILES|g"
255       <ci/cirrus/build.yml >ci/cirrus/$NAME.yml
256     - cat ci/cirrus/$NAME.yml
257     - cirrus-run -v --show-build-log always ci/cirrus/$NAME.yml
258   rules:
259     # upstream+forks: Can't run unless Cirrus is configured
260     - if: '$CIRRUS_GITHUB_REPO == null || $CIRRUS_API_TOKEN == null'
261       when: never
263     # upstream: pushes to branches
264     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $JOB_OPTIONAL'
265       when: manual
266       allow_failure: true
267     - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push"'
268       when: on_success
270     # forks: pushes to branches with pipeline requested
271     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE && $JOB_OPTIONAL'
272       when: manual
273       allow_failure: true
274     - if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE'
275       when: on_success
277     # upstream+forks: Run pipelines on MR, web, api & scheduled
278     - if: '$CI_PIPELINE_SOURCE =~ /(web|api|schedule|merge_request_event)/ && $JOB_OPTIONAL'
279       when: manual
280       allow_failure: true
281     - if: '$CI_PIPELINE_SOURCE =~ /(web|api|schedule|merge_request_event)/'
282       when: on_success
284     # upstream+forks: that's all folks
285     - when: never