diff mbox series

[isar-cip-core] ci: Reduce build runs

Message ID 4c3c0db9-d5c5-46d9-b45b-edcd5093bc67@siemens.com (mailing list archive)
State Accepted
Headers show
Series [isar-cip-core] ci: Reduce build runs | expand

Commit Message

Jan Kiszka Jan. 18, 2024, 6:57 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Under the assumption that ever revision in master and every tagged
revision has been covered by a run in next before, exclude those two
cases from build runs.

The exclusion of scheduled runs is just translated to rules:.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .gitlab-ci.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Jan Kiszka Jan. 19, 2024, 4:24 p.m. UTC | #1
On 18.01.24 19:57, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Under the assumption that ever revision in master and every tagged
> revision has been covered by a run in next before, exclude those two
> cases from build runs.
> 
> The exclusion of scheduled runs is just translated to rules:.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  .gitlab-ci.yml | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index ba2cdb9d..4f87ec37 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -43,8 +43,12 @@ default:
>  
>  .build_base:
>    stage: build
> -  except:
> -    - schedules
> +  rules:
> +    - if: $CI_COMMIT_BRANCH != "master"
> +    - if: $CI_COMMIT_TAG
> +      when: never
> +    - if: $CI_PIPELINE_SOURCE == "schedule"
> +      when: never
>    tags:
>      - large
>    variables:

This rule set is not yet fully working: CI is building the v1.3-rc1 tag
now. But my push to master was not built. If someone spots the mistake,
please let me know or send a path.

Thanks,
Jan
Chris Paterson Jan. 19, 2024, 5:09 p.m. UTC | #2
Hi Jan,

> From: cip-dev@lists.cip-project.org <cip-dev@lists.cip-project.org> On
> Behalf Of Jan Kiszka via lists.cip-project.org
> Sent: Friday, January 19, 2024 4:25 PM
> 
> On 18.01.24 19:57, Jan Kiszka wrote:
> > From: Jan Kiszka <jan.kiszka@siemens.com>
> >
> > Under the assumption that ever revision in master and every tagged
> > revision has been covered by a run in next before, exclude those two
> > cases from build runs.
> >
> > The exclusion of scheduled runs is just translated to rules:.
> >
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > ---
> >  .gitlab-ci.yml | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> > index ba2cdb9d..4f87ec37 100644
> > --- a/.gitlab-ci.yml
> > +++ b/.gitlab-ci.yml
> > @@ -43,8 +43,12 @@ default:
> >
> >  .build_base:
> >    stage: build
> > -  except:
> > -    - schedules
> > +  rules:
> > +    - if: $CI_COMMIT_BRANCH != "master"

Just a guess, maybe for your tags, this rule is being picked up first.
Even though CI_COMMIT_BRANCH isn't set for tags, perhaps the evaluation of the "missing variable != master", comes out as true, so it builds before reading the next rule.

Maybe try changing to:

             - if: $CI_COMMIT_BRANCH == "master"
                when: never

Or try moving your original rule to the bottom of the list.

Regards, Chris

> > +    - if: $CI_COMMIT_TAG
> > +      when: never
> > +    - if: $CI_PIPELINE_SOURCE == "schedule"
> > +      when: never
> >    tags:
> >      - large
> >    variables:
> 
> This rule set is not yet fully working: CI is building the v1.3-rc1 tag
> now. But my push to master was not built. If someone spots the mistake,
> please let me know or send a path.
> 
> Thanks,
> Jan
> 
> --
> Siemens AG, Technology
> Linux Expert Center
diff mbox series

Patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ba2cdb9d..4f87ec37 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -43,8 +43,12 @@  default:
 
 .build_base:
   stage: build
-  except:
-    - schedules
+  rules:
+    - if: $CI_COMMIT_BRANCH != "master"
+    - if: $CI_COMMIT_TAG
+      when: never
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+      when: never
   tags:
     - large
   variables: