diff mbox series

[XEN,v2,1/2] automation/eclair: avoid unintentional ECLAIR analysis

Message ID 4de9a2e93015b12186675b9a3f7ebff7fcd71baa.1692607487.git.simone.ballarin@bugseng.com (mailing list archive)
State New, archived
Headers show
Series automation: avoid unnecessary analyses | expand

Commit Message

Simone Ballarin Aug. 21, 2023, 8:54 a.m. UTC
With this patch, ECLAIR jobs will need to be manually
started for "people/.*" pipelines and will not be triggered
if the WTOKEN variable is missing.

This avoids occupying the runner on analyzes that might
not be used by developers.

If developers want to analyze their own repositories
they need to launch them from GitLab.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>

---
Changes in v2:
- avoid ECLAIR jobs if the WTOKEN variable is not defined.
---
 automation/gitlab-ci/analyze.yaml | 22 +++++++++++++++++-----
 automation/scripts/eclair         |  5 -----
 2 files changed, 17 insertions(+), 10 deletions(-)

Comments

Stefano Stabellini Aug. 22, 2023, 12:45 a.m. UTC | #1
On Mon, 21 Aug 2023, Simone Ballarin wrote:
> With this patch, ECLAIR jobs will need to be manually
> started for "people/.*" pipelines and will not be triggered
> if the WTOKEN variable is missing.
> 
> This avoids occupying the runner on analyzes that might
> not be used by developers.
> 
> If developers want to analyze their own repositories
> they need to launch them from GitLab.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>

Great job!

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> Changes in v2:
> - avoid ECLAIR jobs if the WTOKEN variable is not defined.
> ---
>  automation/gitlab-ci/analyze.yaml | 22 +++++++++++++++++-----
>  automation/scripts/eclair         |  5 -----
>  2 files changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/automation/gitlab-ci/analyze.yaml b/automation/gitlab-ci/analyze.yaml
> index 4aa4abe2ee..bd9a68de31 100644
> --- a/automation/gitlab-ci/analyze.yaml
> +++ b/automation/gitlab-ci/analyze.yaml
> @@ -18,28 +18,40 @@
>        - '*.log'
>      reports:
>        codequality: gl-code-quality-report.json
> +  rules:
> +    - if: $WTOKEN == null
> +      when: never
> +    - when: always
>    needs: []
>  
> -eclair-x86_64:
> +.eclair-analysis:triggered:
>    extends: .eclair-analysis
> +  allow_failure: true
> +  rules:
> +    - if: $WTOKEN && $CI_PROJECT_PATH =~ /^xen-project\/people\/.*$/
> +      when: manual
> +    - !reference [.eclair-analysis, rules]
> +
> +eclair-x86_64:
> +  extends: .eclair-analysis:triggered
>    variables:
>      LOGFILE: "eclair-x86_64.log"
>      VARIANT: "X86_64"
>      RULESET: "Set1"
> -  allow_failure: true
>  
>  eclair-ARM64:
> -  extends: .eclair-analysis
> +  extends: .eclair-analysis:triggered
>    variables:
>      LOGFILE: "eclair-ARM64.log"
>      VARIANT: "ARM64"
>      RULESET: "Set1"
> -  allow_failure: true
>  
>  .eclair-analysis:on-schedule:
>    extends: .eclair-analysis
>    rules:
> -    - if: $CI_PIPELINE_SOURCE == "schedule"
> +    - if: $CI_PIPELINE_SOURCE != "schedule"
> +      when: never
> +    - !reference [.eclair-analysis, rules]
>  
>  eclair-x86_64-Set1:on-schedule:
>    extends: .eclair-analysis:on-schedule
> diff --git a/automation/scripts/eclair b/automation/scripts/eclair
> index 813a56eb6a..14e47a6f97 100755
> --- a/automation/scripts/eclair
> +++ b/automation/scripts/eclair
> @@ -4,11 +4,6 @@ ECLAIR_ANALYSIS_DIR=automation/eclair_analysis
>  ECLAIR_DIR="${ECLAIR_ANALYSIS_DIR}/ECLAIR"
>  ECLAIR_OUTPUT_DIR=$(realpath "${ECLAIR_OUTPUT_DIR}")
>  
> -if [ -z "${WTOKEN:-}" ]; then
> -    echo "Failure: the WTOKEN variable is not defined." >&2
> -    exit 1
> -fi
> -
>  "${ECLAIR_ANALYSIS_DIR}/prepare.sh" "${VARIANT}"
>  
>  ex=0
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/automation/gitlab-ci/analyze.yaml b/automation/gitlab-ci/analyze.yaml
index 4aa4abe2ee..bd9a68de31 100644
--- a/automation/gitlab-ci/analyze.yaml
+++ b/automation/gitlab-ci/analyze.yaml
@@ -18,28 +18,40 @@ 
       - '*.log'
     reports:
       codequality: gl-code-quality-report.json
+  rules:
+    - if: $WTOKEN == null
+      when: never
+    - when: always
   needs: []
 
-eclair-x86_64:
+.eclair-analysis:triggered:
   extends: .eclair-analysis
+  allow_failure: true
+  rules:
+    - if: $WTOKEN && $CI_PROJECT_PATH =~ /^xen-project\/people\/.*$/
+      when: manual
+    - !reference [.eclair-analysis, rules]
+
+eclair-x86_64:
+  extends: .eclair-analysis:triggered
   variables:
     LOGFILE: "eclair-x86_64.log"
     VARIANT: "X86_64"
     RULESET: "Set1"
-  allow_failure: true
 
 eclair-ARM64:
-  extends: .eclair-analysis
+  extends: .eclair-analysis:triggered
   variables:
     LOGFILE: "eclair-ARM64.log"
     VARIANT: "ARM64"
     RULESET: "Set1"
-  allow_failure: true
 
 .eclair-analysis:on-schedule:
   extends: .eclair-analysis
   rules:
-    - if: $CI_PIPELINE_SOURCE == "schedule"
+    - if: $CI_PIPELINE_SOURCE != "schedule"
+      when: never
+    - !reference [.eclair-analysis, rules]
 
 eclair-x86_64-Set1:on-schedule:
   extends: .eclair-analysis:on-schedule
diff --git a/automation/scripts/eclair b/automation/scripts/eclair
index 813a56eb6a..14e47a6f97 100755
--- a/automation/scripts/eclair
+++ b/automation/scripts/eclair
@@ -4,11 +4,6 @@  ECLAIR_ANALYSIS_DIR=automation/eclair_analysis
 ECLAIR_DIR="${ECLAIR_ANALYSIS_DIR}/ECLAIR"
 ECLAIR_OUTPUT_DIR=$(realpath "${ECLAIR_OUTPUT_DIR}")
 
-if [ -z "${WTOKEN:-}" ]; then
-    echo "Failure: the WTOKEN variable is not defined." >&2
-    exit 1
-fi
-
 "${ECLAIR_ANALYSIS_DIR}/prepare.sh" "${VARIANT}"
 
 ex=0