[libvirt PATCH v2 3/9] gitlab: group jobs into stages

Daniel P. Berrangé posted 9 patches 5 years, 10 months ago
[libvirt PATCH v2 3/9] gitlab: group jobs into stages
Posted by Daniel P. Berrangé 5 years, 10 months ago
Within a stage all jobs run in parallel. Stages are ordered so later
stages are only executed if previous stages succeeded. By using separate
stages for the cross builds, we can avoid wasting CI resources if the
relatively simple website build fails. Later we can avoid running cross
builds, if the native build fails too.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 .gitlab-ci.yml | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1249ec6df5..8d6b5a0787 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,9 @@
-.job_template: &job_definition
+stages:
+  - prebuild
+  - cross_build
+
+.cross_build_job_template: &cross_build_job_definition
+  stage: cross_build
   script:
     - mkdir build
     - cd build
@@ -13,17 +18,18 @@
 # between Debian 10 and sid to help detect problems on the horizon.
 
 debian-10-cross-s390x:
-  <<: *job_definition
+  <<: *cross_build_job_definition
   image: quay.io/libvirt/buildenv-libvirt-debian-10-cross-s390x:latest
 
 debian-sid-cross-armv7l:
-  <<: *job_definition
+  <<: *cross_build_job_definition
   image: quay.io/libvirt/buildenv-libvirt-debian-sid-cross-armv7l:latest
 
 # This artifact published by this job is downloaded by libvirt.org to
 # be deployed to the web root:
 #    https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=website
 website:
+  stage: prebuild
   script:
     - mkdir build
     - cd build
-- 
2.24.1

Re: [libvirt PATCH v2 3/9] gitlab: group jobs into stages
Posted by Andrea Bolognani 5 years, 10 months ago
On Tue, 2020-03-24 at 16:23 +0000, Daniel P. Berrangé wrote:
> Within a stage all jobs run in parallel. Stages are ordered so later
> stages are only executed if previous stages succeeded. By using separate
> stages for the cross builds, we can avoid wasting CI resources if the
> relatively simple website build fails. Later we can avoid running cross
> builds, if the native build fails too.
> 
> Reviewed-by: Erik Skultety <eskultet@redhat.com>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  .gitlab-ci.yml | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization