diff mbox series

[9/9] gitlab-ci: Use absolute path and simplify firmware jobs

Message ID 20210525082556.4011380-10-f4bug@amsat.org (mailing list archive)
State New, archived
Headers show
Series gitlab-ci: Make mainstream CI green again | expand

Commit Message

Philippe Mathieu-Daudé May 25, 2021, 8:25 a.m. UTC
The GitLab 'add job on file changed' feature doesn't work well
with relative paths: use absolute paths instead.

Change the 'rules:' section by an 'only:' one which is easier
to read.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 .gitlab-ci.d/edk2.yml    | 11 +++++------
 .gitlab-ci.d/opensbi.yml | 11 +++++------
 2 files changed, 10 insertions(+), 12 deletions(-)

Comments

Daniel P. Berrangé May 25, 2021, 8:56 a.m. UTC | #1
On Tue, May 25, 2021 at 10:25:56AM +0200, Philippe Mathieu-Daudé wrote:
> The GitLab 'add job on file changed' feature doesn't work well
> with relative paths: use absolute paths instead.
> 
> Change the 'rules:' section by an 'only:' one which is easier
> to read.

GitLab docs say "rules replaces only/except", so I'm not convinced
we should be going back to the old syntax, especially as that means
some jobs will use 'rules' and some jobs will use 'only'. Consistency
across jobs wins for me and "rules" is much more expressive.



> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  .gitlab-ci.d/edk2.yml    | 11 +++++------
>  .gitlab-ci.d/opensbi.yml | 11 +++++------
>  2 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/.gitlab-ci.d/edk2.yml b/.gitlab-ci.d/edk2.yml
> index ba7280605c4..f543a10fbe2 100644
> --- a/.gitlab-ci.d/edk2.yml
> +++ b/.gitlab-ci.d/edk2.yml
> @@ -1,10 +1,9 @@
>  docker-edk2:
>   stage: containers
> - rules: # Only run this job when the Dockerfile is modified
> - - changes:
> -   - .gitlab-ci.d/edk2.yml
> -   - .gitlab-ci.d/edk2/Dockerfile
> -   when: always
> + only: # Only run this job when the Dockerfile is modified
> +   changes:
> +   - /.gitlab-ci.d/edk2.yml
> +   - /.gitlab-ci.d/edk2/Dockerfile
>   image: docker:19.03.1
>   services:
>   - docker:19.03.1-dind
> @@ -28,7 +27,7 @@ build-edk2:
>   needs: ['docker-edk2']
>   rules: # Only run this job when ...
>   - changes: # ... roms/edk2/ is modified (submodule updated)
> -   - roms/edk2/*
> +   - /roms/edk2/*
>     when: always
>   - if: '$CI_COMMIT_REF_NAME =~ /^edk2/' # or the branch/tag starts with 'edk2'
>     when: always
> diff --git a/.gitlab-ci.d/opensbi.yml b/.gitlab-ci.d/opensbi.yml
> index f66cd1d9089..7bc96a29366 100644
> --- a/.gitlab-ci.d/opensbi.yml
> +++ b/.gitlab-ci.d/opensbi.yml
> @@ -1,10 +1,9 @@
>  docker-opensbi:
>   stage: containers
> - rules: # Only run this job when the Dockerfile is modified
> - - changes:
> -   - .gitlab-ci.d/opensbi.yml
> -   - .gitlab-ci.d/opensbi/Dockerfile
> -   when: always
> + only: # Only run this job when the Dockerfile is modified
> +   changes:
> +   - /.gitlab-ci.d/opensbi.yml
> +   - /.gitlab-ci.d/opensbi/Dockerfile
>   image: docker:19.03.1
>   services:
>   - docker:19.03.1-dind
> @@ -28,7 +27,7 @@ build-opensbi:
>   needs: ['docker-opensbi']
>   rules: # Only run this job when ...
>   - changes: # ... roms/opensbi/ is modified (submodule updated)
> -   - roms/opensbi/*
> +   - /roms/opensbi/*
>     when: always
>   - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/' # or the branch/tag starts with 'opensbi'
>     when: always
> -- 
> 2.26.3
> 

Regards,
Daniel
Philippe Mathieu-Daudé May 25, 2021, 9:02 a.m. UTC | #2
On 5/25/21 10:56 AM, Daniel P. Berrangé wrote:
> On Tue, May 25, 2021 at 10:25:56AM +0200, Philippe Mathieu-Daudé wrote:
>> The GitLab 'add job on file changed' feature doesn't work well
>> with relative paths: use absolute paths instead.
>>
>> Change the 'rules:' section by an 'only:' one which is easier
>> to read.
> 
> GitLab docs say "rules replaces only/except", so I'm not convinced
> we should be going back to the old syntax, especially as that means
> some jobs will use 'rules' and some jobs will use 'only'. Consistency
> across jobs wins for me and "rules" is much more expressive.

OK. I wanted to tag this patch RFC anyway, but forgot.
Please disregard it (the rest of the series doesn't rely on it).
diff mbox series

Patch

diff --git a/.gitlab-ci.d/edk2.yml b/.gitlab-ci.d/edk2.yml
index ba7280605c4..f543a10fbe2 100644
--- a/.gitlab-ci.d/edk2.yml
+++ b/.gitlab-ci.d/edk2.yml
@@ -1,10 +1,9 @@ 
 docker-edk2:
  stage: containers
- rules: # Only run this job when the Dockerfile is modified
- - changes:
-   - .gitlab-ci.d/edk2.yml
-   - .gitlab-ci.d/edk2/Dockerfile
-   when: always
+ only: # Only run this job when the Dockerfile is modified
+   changes:
+   - /.gitlab-ci.d/edk2.yml
+   - /.gitlab-ci.d/edk2/Dockerfile
  image: docker:19.03.1
  services:
  - docker:19.03.1-dind
@@ -28,7 +27,7 @@  build-edk2:
  needs: ['docker-edk2']
  rules: # Only run this job when ...
  - changes: # ... roms/edk2/ is modified (submodule updated)
-   - roms/edk2/*
+   - /roms/edk2/*
    when: always
  - if: '$CI_COMMIT_REF_NAME =~ /^edk2/' # or the branch/tag starts with 'edk2'
    when: always
diff --git a/.gitlab-ci.d/opensbi.yml b/.gitlab-ci.d/opensbi.yml
index f66cd1d9089..7bc96a29366 100644
--- a/.gitlab-ci.d/opensbi.yml
+++ b/.gitlab-ci.d/opensbi.yml
@@ -1,10 +1,9 @@ 
 docker-opensbi:
  stage: containers
- rules: # Only run this job when the Dockerfile is modified
- - changes:
-   - .gitlab-ci.d/opensbi.yml
-   - .gitlab-ci.d/opensbi/Dockerfile
-   when: always
+ only: # Only run this job when the Dockerfile is modified
+   changes:
+   - /.gitlab-ci.d/opensbi.yml
+   - /.gitlab-ci.d/opensbi/Dockerfile
  image: docker:19.03.1
  services:
  - docker:19.03.1-dind
@@ -28,7 +27,7 @@  build-opensbi:
  needs: ['docker-opensbi']
  rules: # Only run this job when ...
  - changes: # ... roms/opensbi/ is modified (submodule updated)
-   - roms/opensbi/*
+   - /roms/opensbi/*
    when: always
  - if: '$CI_COMMIT_REF_NAME =~ /^opensbi/' # or the branch/tag starts with 'opensbi'
    when: always