Re: [XEN PATCH] automation/eclair: improve scheduled analyses

2023-11-22 Thread Stefano Stabellini
On Wed, 22 Nov 2023, Simone Ballarin wrote:
> > > diff --git a/automation/gitlab-ci/build.yaml
> > > b/automation/gitlab-ci/build.yaml
> > > index 32af30cced..6b2ac97248 100644
> > > --- a/automation/gitlab-ci/build.yaml
> > > +++ b/automation/gitlab-ci/build.yaml
> > > @@ -1,6 +1,10 @@
> > >   .build-tmpl: 
> > > stage: build
> > > image: registry.gitlab.com/xen-project/xen/${CONTAINER}
> > > +  rules:
> > > +- if: $CI_PIPELINE_SOURCE == "schedule"
> > > +  when: never
> > > +- when: always
> > 
> > ...does it mean that we are going to stop all the build jobs...
> > 
> > 
> > > script:
> > >   - ./automation/scripts/build 2>&1 | tee build.log
> > > artifacts:
> > > diff --git a/automation/gitlab-ci/test.yaml
> > > b/automation/gitlab-ci/test.yaml
> > > index 61e642cce0..47fc8cb3eb 100644
> > > --- a/automation/gitlab-ci/test.yaml
> > > +++ b/automation/gitlab-ci/test.yaml
> > > @@ -1,6 +1,10 @@
> > >   .test-jobs-common:
> > > stage: test
> > > image: registry.gitlab.com/xen-project/xen/${CONTAINER}
> > > +  rules:
> > > +- if: $CI_PIPELINE_SOURCE == "schedule"
> > > +  when: never
> > > +- when: always
> > 
> > ...and also stop all the test jobs?
> > 
> > So basically the only thing left is .eclair-analysis:on-schedule ?
> 
> Yes, you're right. I don't know if this is the indented behavior,
> but without these changes all jobs run implicitly.
> 
> If test and build stages are supposed to run on scheduled pipelines,
> I suggest making it explicit by reversing the guard.

Yes I think it is OK to run build and test jobs on scheduled pipelines,
it is not worth optimized them out. I would reduce this patch to the
below. Would that work?

If so, please resend with only the below, and you can add my
Reviewed-by: Stefano Stabellini 


diff --git a/automation/eclair_analysis/ECLAIR/action.settings 
b/automation/eclair_analysis/ECLAIR/action.settings
index f96368ffc7..3cba1a3afb 100644
--- a/automation/eclair_analysis/ECLAIR/action.settings
+++ b/automation/eclair_analysis/ECLAIR/action.settings
@@ -134,7 +134,7 @@ push)
 badgeLabel="ECLAIR ${ANALYSIS_KIND} ${ref}${variantHeadline} #${jobId}"
 ;;
 auto_pull_request)
-git remote remove autoPRRemote || true
+git remote remove autoPRRemote 2>/dev/null || true
 git remote add autoPRRemote "${autoPRRemoteUrl}"
 git fetch -q autoPRRemote
 subDir="${ref}"
diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl 
b/automation/eclair_analysis/ECLAIR/analysis.ecl
index fe418d6da1..2507a8e787 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -2,7 +2,13 @@
 -project_name=getenv("ECLAIR_PROJECT_NAME")
 -project_root=getenv("ECLAIR_PROJECT_ROOT")
 
--setq=data_dir,getenv("ECLAIR_DATA_DIR")
+setq(data_dir,getenv("ECLAIR_DATA_DIR"))
+setq(analysis_kind,getenv("ANALYSIS_KIND"))
+setq(scheduled_analysis,nil)
+
+strings_map("scheduled-analysis",500,"","^.*scheduled$",0,setq(scheduled_analysis,t))
+strings_map("scheduled-analysis",500,"","^.*$",0)
+map_strings("scheduled-analysis",analysis_kind)
 
 -verbose
 
@@ -15,7 +21,9 @@
 
 -eval_file=toolchain.ecl
 -eval_file=public_APIs.ecl
--eval_file=out_of_scope.ecl
+if(scheduled_analysis,
+eval_file("out_of_scope.ecl")
+)
 -eval_file=deviations.ecl
 -eval_file=call_properties.ecl
 -eval_file=tagging.ecl
diff --git a/automation/gitlab-ci/analyze.yaml 
b/automation/gitlab-ci/analyze.yaml
index bd9a68de31..6631db53fa 100644
--- a/automation/gitlab-ci/analyze.yaml
+++ b/automation/gitlab-ci/analyze.yaml
@@ -28,6 +28,8 @@
   extends: .eclair-analysis
   allow_failure: true
   rules:
+- if: $CI_PIPELINE_SOURCE == "schedule"
+  when: never
 - if: $WTOKEN && $CI_PROJECT_PATH =~ /^xen-project\/people\/.*$/
   when: manual
 - !reference [.eclair-analysis, rules]



Re: [XEN PATCH] automation/eclair: improve scheduled analyses

2023-11-22 Thread Simone Ballarin

On 22/11/23 02:35, Stefano Stabellini wrote:

On Mon, 20 Nov 2023, Simone Ballarin wrote:

The scheduled analyses are intended to maintain an overall vision
of the MISRA complaince of the entire project. For this reason,
the file exclusions in "out_of_scope.ecl" should not be applied.

This patch amends ECLAIR settings to prevent exempting files for
scheduled analyses and prevents scheduled pipelines from triggering
non-analysis jobs.


The last sentence...



Signed-off-by: Simone Ballarin 
---
  .../eclair_analysis/ECLAIR/action.settings |  2 +-
  automation/eclair_analysis/ECLAIR/analysis.ecl | 12 ++--
  automation/gitlab-ci/analyze.yaml  |  2 ++
  automation/gitlab-ci/build.yaml|  4 
  automation/gitlab-ci/test.yaml | 18 --
  5 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/action.settings 
b/automation/eclair_analysis/ECLAIR/action.settings
index f96368ffc7..3cba1a3afb 100644
--- a/automation/eclair_analysis/ECLAIR/action.settings
+++ b/automation/eclair_analysis/ECLAIR/action.settings
@@ -134,7 +134,7 @@ push)
  badgeLabel="ECLAIR ${ANALYSIS_KIND} ${ref}${variantHeadline} #${jobId}"
  ;;
  auto_pull_request)
-git remote remove autoPRRemote || true
+git remote remove autoPRRemote 2>/dev/null || true
  git remote add autoPRRemote "${autoPRRemoteUrl}"
  git fetch -q autoPRRemote
  subDir="${ref}"
diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl 
b/automation/eclair_analysis/ECLAIR/analysis.ecl
index fe418d6da1..2507a8e787 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -2,7 +2,13 @@
  -project_name=getenv("ECLAIR_PROJECT_NAME")
  -project_root=getenv("ECLAIR_PROJECT_ROOT")
  
--setq=data_dir,getenv("ECLAIR_DATA_DIR")

+setq(data_dir,getenv("ECLAIR_DATA_DIR"))
+setq(analysis_kind,getenv("ANALYSIS_KIND"))
+setq(scheduled_analysis,nil)
+
+strings_map("scheduled-analysis",500,"","^.*scheduled$",0,setq(scheduled_analysis,t))
+strings_map("scheduled-analysis",500,"","^.*$",0)
+map_strings("scheduled-analysis",analysis_kind)
  
  -verbose
  
@@ -15,7 +21,9 @@
  
  -eval_file=toolchain.ecl

  -eval_file=public_APIs.ecl
--eval_file=out_of_scope.ecl
+if(scheduled_analysis,
+eval_file("out_of_scope.ecl")
+)
  -eval_file=deviations.ecl
  -eval_file=call_properties.ecl
  -eval_file=tagging.ecl
diff --git a/automation/gitlab-ci/analyze.yaml 
b/automation/gitlab-ci/analyze.yaml
index bd9a68de31..6631db53fa 100644
--- a/automation/gitlab-ci/analyze.yaml
+++ b/automation/gitlab-ci/analyze.yaml
@@ -28,6 +28,8 @@
extends: .eclair-analysis
allow_failure: true
rules:
+- if: $CI_PIPELINE_SOURCE == "schedule"
+  when: never
  - if: $WTOKEN && $CI_PROJECT_PATH =~ /^xen-project\/people\/.*$/
when: manual
  - !reference [.eclair-analysis, rules]
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 32af30cced..6b2ac97248 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -1,6 +1,10 @@
  .build-tmpl: 
stage: build
image: registry.gitlab.com/xen-project/xen/${CONTAINER}
+  rules:
+- if: $CI_PIPELINE_SOURCE == "schedule"
+  when: never
+- when: always


...does it mean that we are going to stop all the build jobs...



script:
  - ./automation/scripts/build 2>&1 | tee build.log
artifacts:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 61e642cce0..47fc8cb3eb 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -1,6 +1,10 @@
  .test-jobs-common:
stage: test
image: registry.gitlab.com/xen-project/xen/${CONTAINER}
+  rules:
+- if: $CI_PIPELINE_SOURCE == "schedule"
+  when: never
+- when: always


...and also stop all the test jobs?

So basically the only thing left is .eclair-analysis:on-schedule ?


Yes, you're right. I don't know if this is the indented behavior,
but without these changes all jobs run implicitly.

If test and build stages are supposed to run on scheduled pipelines,
I suggest making it explicit by reversing the guard.





  .arm64-test-needs: 
- alpine-3.18-arm64-rootfs-export
@@ -90,9 +94,10 @@
- '*.log'
- '*.dtb'
  when: always
-  only:
-variables:
-  - $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  rules:
+- if: $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  when: always
+- !reference [.test-jobs-common, rules]
tags:
  - xilinx
  
@@ -110,9 +115,10 @@

- smoke.serial
- '*.log'
  when: always
-  only:
-variables:
-  - $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  rules:
+- if: $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  when: always
+- !reference [.test-jobs-common, rules]
tags:
  - qubes-hw2
  
--

Re: [XEN PATCH] automation/eclair: improve scheduled analyses

2023-11-21 Thread Stefano Stabellini
On Mon, 20 Nov 2023, Simone Ballarin wrote:
> The scheduled analyses are intended to maintain an overall vision
> of the MISRA complaince of the entire project. For this reason,
> the file exclusions in "out_of_scope.ecl" should not be applied.
> 
> This patch amends ECLAIR settings to prevent exempting files for
> scheduled analyses and prevents scheduled pipelines from triggering
> non-analysis jobs.

The last sentence...


> Signed-off-by: Simone Ballarin 
> ---
>  .../eclair_analysis/ECLAIR/action.settings |  2 +-
>  automation/eclair_analysis/ECLAIR/analysis.ecl | 12 ++--
>  automation/gitlab-ci/analyze.yaml  |  2 ++
>  automation/gitlab-ci/build.yaml|  4 
>  automation/gitlab-ci/test.yaml | 18 --
>  5 files changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/automation/eclair_analysis/ECLAIR/action.settings 
> b/automation/eclair_analysis/ECLAIR/action.settings
> index f96368ffc7..3cba1a3afb 100644
> --- a/automation/eclair_analysis/ECLAIR/action.settings
> +++ b/automation/eclair_analysis/ECLAIR/action.settings
> @@ -134,7 +134,7 @@ push)
>  badgeLabel="ECLAIR ${ANALYSIS_KIND} ${ref}${variantHeadline} #${jobId}"
>  ;;
>  auto_pull_request)
> -git remote remove autoPRRemote || true
> +git remote remove autoPRRemote 2>/dev/null || true
>  git remote add autoPRRemote "${autoPRRemoteUrl}"
>  git fetch -q autoPRRemote
>  subDir="${ref}"
> diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl 
> b/automation/eclair_analysis/ECLAIR/analysis.ecl
> index fe418d6da1..2507a8e787 100644
> --- a/automation/eclair_analysis/ECLAIR/analysis.ecl
> +++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
> @@ -2,7 +2,13 @@
>  -project_name=getenv("ECLAIR_PROJECT_NAME")
>  -project_root=getenv("ECLAIR_PROJECT_ROOT")
>  
> --setq=data_dir,getenv("ECLAIR_DATA_DIR")
> +setq(data_dir,getenv("ECLAIR_DATA_DIR"))
> +setq(analysis_kind,getenv("ANALYSIS_KIND"))
> +setq(scheduled_analysis,nil)
> +
> +strings_map("scheduled-analysis",500,"","^.*scheduled$",0,setq(scheduled_analysis,t))
> +strings_map("scheduled-analysis",500,"","^.*$",0)
> +map_strings("scheduled-analysis",analysis_kind)
>  
>  -verbose
>  
> @@ -15,7 +21,9 @@
>  
>  -eval_file=toolchain.ecl
>  -eval_file=public_APIs.ecl
> --eval_file=out_of_scope.ecl
> +if(scheduled_analysis,
> +eval_file("out_of_scope.ecl")
> +)
>  -eval_file=deviations.ecl
>  -eval_file=call_properties.ecl
>  -eval_file=tagging.ecl
> diff --git a/automation/gitlab-ci/analyze.yaml 
> b/automation/gitlab-ci/analyze.yaml
> index bd9a68de31..6631db53fa 100644
> --- a/automation/gitlab-ci/analyze.yaml
> +++ b/automation/gitlab-ci/analyze.yaml
> @@ -28,6 +28,8 @@
>extends: .eclair-analysis
>allow_failure: true
>rules:
> +- if: $CI_PIPELINE_SOURCE == "schedule"
> +  when: never
>  - if: $WTOKEN && $CI_PROJECT_PATH =~ /^xen-project\/people\/.*$/
>when: manual
>  - !reference [.eclair-analysis, rules]
> diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
> index 32af30cced..6b2ac97248 100644
> --- a/automation/gitlab-ci/build.yaml
> +++ b/automation/gitlab-ci/build.yaml
> @@ -1,6 +1,10 @@
>  .build-tmpl: 
>stage: build
>image: registry.gitlab.com/xen-project/xen/${CONTAINER}
> +  rules:
> +- if: $CI_PIPELINE_SOURCE == "schedule"
> +  when: never
> +- when: always

...does it mean that we are going to stop all the build jobs...


>script:
>  - ./automation/scripts/build 2>&1 | tee build.log
>artifacts:
> diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
> index 61e642cce0..47fc8cb3eb 100644
> --- a/automation/gitlab-ci/test.yaml
> +++ b/automation/gitlab-ci/test.yaml
> @@ -1,6 +1,10 @@
>  .test-jobs-common:
>stage: test
>image: registry.gitlab.com/xen-project/xen/${CONTAINER}
> +  rules:
> +- if: $CI_PIPELINE_SOURCE == "schedule"
> +  when: never
> +- when: always

...and also stop all the test jobs?

So basically the only thing left is .eclair-analysis:on-schedule ?


>  .arm64-test-needs: 
>- alpine-3.18-arm64-rootfs-export
> @@ -90,9 +94,10 @@
>- '*.log'
>- '*.dtb'
>  when: always
> -  only:
> -variables:
> -  - $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
> +  rules:
> +- if: $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
> +  when: always
> +- !reference [.test-jobs-common, rules]
>tags:
>  - xilinx
>  
> @@ -110,9 +115,10 @@
>- smoke.serial
>- '*.log'
>  when: always
> -  only:
> -variables:
> -  - $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
> +  rules:
> +- if: $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
> +  when: always
> +- !reference [.test-jobs-common, rules]
>tags:
>  - qubes-hw2
>  
> -- 
> 2.34.1
>