diff mbox series

[RFC,1/2] GitLab CI: avoid calling before_scripts on unintended jobs

Message ID 20200203032328.12051-1-crosa@redhat.com
State New
Headers show
Series [RFC,1/2] GitLab CI: avoid calling before_scripts on unintended jobs | expand

Commit Message

Cleber Rosa Feb. 3, 2020, 3:23 a.m. UTC
At this point it seems that all jobs depend on those steps, with
maybe the EDK2 jobs as exceptions.

The jobs that will be added will not want those scripts to be
run, so let's move these steps to the appropriate jobs, while
still trying to avoid repetition.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 .gitlab-ci.yml | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Wainer dos Santos Moschetta Feb. 3, 2020, 3:26 p.m. UTC | #1
On 2/3/20 1:23 AM, Cleber Rosa wrote:
> At this point it seems that all jobs depend on those steps, with
> maybe the EDK2 jobs as exceptions.
>
> The jobs that will be added will not want those scripts to be
> run, so let's move these steps to the appropriate jobs, while
> still trying to avoid repetition.
>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
>   .gitlab-ci.yml | 17 ++++++++++++++---
>   1 file changed, 14 insertions(+), 3 deletions(-)


Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>


>
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 228783993e..d2c7d2198e 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -1,11 +1,10 @@
>   include:
>     - local: '/.gitlab-ci-edk2.yml'
>   
> -before_script:
> +build-system1:
> + before_script: &before_scr_apt
>    - apt-get update -qq
>    - apt-get install -y -qq flex bison libglib2.0-dev libpixman-1-dev genisoimage
> -
> -build-system1:
>    script:
>    - apt-get install -y -qq libgtk-3-dev libvte-dev nettle-dev libcacard-dev
>         libusb-dev libvde-dev libspice-protocol-dev libgl1-mesa-dev libvdeplug-dev
> @@ -18,6 +17,8 @@ build-system1:
>    - make -j2 check
>   
>   build-system2:
> + before_script:
> +  *before_scr_apt
>    script:
>    - apt-get install -y -qq libsdl2-dev libgcrypt-dev libbrlapi-dev libaio-dev
>         libfdt-dev liblzo2-dev librdmacm-dev libibverbs-dev libibumad-dev
> @@ -30,6 +31,8 @@ build-system2:
>    - make -j2 check
>   
>   build-disabled:
> + before_script:
> +  *before_scr_apt
>    script:
>    - mkdir build
>    - cd build
> @@ -44,6 +47,8 @@ build-disabled:
>    - make -j2 check-qtest SPEED=slow
>   
>   build-tcg-disabled:
> + before_script:
> +  *before_scr_apt
>    script:
>    - apt-get install -y -qq clang libgtk-3-dev libusb-dev
>    - mkdir build
> @@ -62,6 +67,8 @@ build-tcg-disabled:
>               248 250 254 255 256
>   
>   build-user:
> + before_script:
> +  *before_scr_apt
>    script:
>    - mkdir build
>    - cd build
> @@ -71,6 +78,8 @@ build-user:
>    - make run-tcg-tests-i386-linux-user run-tcg-tests-x86_64-linux-user
>   
>   build-clang:
> + before_script:
> +  *before_scr_apt
>    script:
>    - apt-get install -y -qq clang libsdl2-dev libattr1-dev libcap-ng-dev
>         xfslibs-dev libiscsi-dev libnfs-dev libseccomp-dev gnutls-dev librbd-dev
> @@ -83,6 +92,8 @@ build-clang:
>    - make -j2 check
>   
>   build-tci:
> + before_script:
> +  *before_scr_apt
>    script:
>    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
>    - mkdir build
Thomas Huth Feb. 3, 2020, 4:08 p.m. UTC | #2
On 03/02/2020 04.23, Cleber Rosa wrote:
> At this point it seems that all jobs depend on those steps, with
> maybe the EDK2 jobs as exceptions.
> 
> The jobs that will be added will not want those scripts to be
> run, so let's move these steps to the appropriate jobs, while
> still trying to avoid repetition.
> 
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
>  .gitlab-ci.yml | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 228783993e..d2c7d2198e 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -1,11 +1,10 @@
>  include:
>    - local: '/.gitlab-ci-edk2.yml'
>  
> -before_script:
> +build-system1:
> + before_script: &before_scr_apt
>   - apt-get update -qq
>   - apt-get install -y -qq flex bison libglib2.0-dev libpixman-1-dev genisoimage
> -
> -build-system1:
>   script:
>   - apt-get install -y -qq libgtk-3-dev libvte-dev nettle-dev libcacard-dev
>        libusb-dev libvde-dev libspice-protocol-dev libgl1-mesa-dev libvdeplug-dev

I'm not very familiar with these anchors yet, but would it maybe be
possible to keep the "template" out of build-system1 ? Something like
they show on https://docs.gitlab.com/ee/ci/yaml/#anchors ?

Anyway, patch is also fine for me in its current shape, so FWIW:

Acked-by: Thomas Huth <thuth@redhat.com>
Cleber Rosa Feb. 7, 2020, 8:01 p.m. UTC | #3
On Mon, Feb 03, 2020 at 05:08:58PM +0100, Thomas Huth wrote:
> On 03/02/2020 04.23, Cleber Rosa wrote:
> > At this point it seems that all jobs depend on those steps, with
> > maybe the EDK2 jobs as exceptions.
> > 
> > The jobs that will be added will not want those scripts to be
> > run, so let's move these steps to the appropriate jobs, while
> > still trying to avoid repetition.
> > 
> > Signed-off-by: Cleber Rosa <crosa@redhat.com>
> > ---
> >  .gitlab-ci.yml | 17 ++++++++++++++---
> >  1 file changed, 14 insertions(+), 3 deletions(-)
> > 
> > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> > index 228783993e..d2c7d2198e 100644
> > --- a/.gitlab-ci.yml
> > +++ b/.gitlab-ci.yml
> > @@ -1,11 +1,10 @@
> >  include:
> >    - local: '/.gitlab-ci-edk2.yml'
> >  
> > -before_script:
> > +build-system1:
> > + before_script: &before_scr_apt
> >   - apt-get update -qq
> >   - apt-get install -y -qq flex bison libglib2.0-dev libpixman-1-dev genisoimage
> > -
> > -build-system1:
> >   script:
> >   - apt-get install -y -qq libgtk-3-dev libvte-dev nettle-dev libcacard-dev
> >        libusb-dev libvde-dev libspice-protocol-dev libgl1-mesa-dev libvdeplug-dev
> 
> I'm not very familiar with these anchors yet, but would it maybe be
> possible to keep the "template" out of build-system1 ? Something like
> they show on https://docs.gitlab.com/ee/ci/yaml/#anchors ?
>

Me neither!  In fact, thanks for the link above (I simply replayed
something I did on another YAML file and validated it on the GitLab CI
linter).

> Anyway, patch is also fine for me in its current shape, so FWIW:
> 
> Acked-by: Thomas Huth <thuth@redhat.com>

I'll check out the other possible approaches and let you know.

Thanks,
- Cleber.
diff mbox series

Patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 228783993e..d2c7d2198e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,10 @@ 
 include:
   - local: '/.gitlab-ci-edk2.yml'
 
-before_script:
+build-system1:
+ before_script: &before_scr_apt
  - apt-get update -qq
  - apt-get install -y -qq flex bison libglib2.0-dev libpixman-1-dev genisoimage
-
-build-system1:
  script:
  - apt-get install -y -qq libgtk-3-dev libvte-dev nettle-dev libcacard-dev
       libusb-dev libvde-dev libspice-protocol-dev libgl1-mesa-dev libvdeplug-dev
@@ -18,6 +17,8 @@  build-system1:
  - make -j2 check
 
 build-system2:
+ before_script:
+  *before_scr_apt
  script:
  - apt-get install -y -qq libsdl2-dev libgcrypt-dev libbrlapi-dev libaio-dev
       libfdt-dev liblzo2-dev librdmacm-dev libibverbs-dev libibumad-dev
@@ -30,6 +31,8 @@  build-system2:
  - make -j2 check
 
 build-disabled:
+ before_script:
+  *before_scr_apt
  script:
  - mkdir build
  - cd build
@@ -44,6 +47,8 @@  build-disabled:
  - make -j2 check-qtest SPEED=slow
 
 build-tcg-disabled:
+ before_script:
+  *before_scr_apt
  script:
  - apt-get install -y -qq clang libgtk-3-dev libusb-dev
  - mkdir build
@@ -62,6 +67,8 @@  build-tcg-disabled:
             248 250 254 255 256
 
 build-user:
+ before_script:
+  *before_scr_apt
  script:
  - mkdir build
  - cd build
@@ -71,6 +78,8 @@  build-user:
  - make run-tcg-tests-i386-linux-user run-tcg-tests-x86_64-linux-user
 
 build-clang:
+ before_script:
+  *before_scr_apt
  script:
  - apt-get install -y -qq clang libsdl2-dev libattr1-dev libcap-ng-dev
       xfslibs-dev libiscsi-dev libnfs-dev libseccomp-dev gnutls-dev librbd-dev
@@ -83,6 +92,8 @@  build-clang:
  - make -j2 check
 
 build-tci:
+ before_script:
+  *before_scr_apt
  script:
  - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
  - mkdir build