All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN PATCH 0/4] automation/eclair: improvements to the ECLAIR integration
@ 2023-08-01  9:57 Simone Ballarin
  2023-08-01  9:57 ` [XEN PATCH 1/4] automation/eclair: add support for tag pipelines Simone Ballarin
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Simone Ballarin @ 2023-08-01  9:57 UTC (permalink / raw)
  To: xen-devel; +Cc: consulting, Simone Ballarin, Doug Goldstein, Stefano Stabellini

This series contains a series of improvements to the ECLAIR integration.

The integration was not initially intended to operate in tag pipelines,
for this reason the analyses fail when triggered from xen-project/patchew.
This series add support for such pipelines.

The summary() reporting facility in action.helpers has been partially
rewritten to make it more readable and easier to follow. The utility
has been extended to print directs links to the findings in the GitLab
console log.

Six new ECLAIR jobs have been added, these jobs run only when triggered
by a scheduled pipeline.

This series avoids failures when a merge point with xen-project/xen(staging)
is not found.

Simone Ballarin (4):
  automation/eclair: add support for tag pipelines
  automation/eclair: add direct link to reports
  automation/eclair: add scheduled pipelines
  automation/eclair: avoid failure in case of missing merge point

 .../eclair_analysis/ECLAIR/action.helpers     | 84 ++++++++++++++-----
 .../eclair_analysis/ECLAIR/action.settings    | 30 ++++---
 automation/gitlab-ci/analyze.yaml             | 65 +++++++++++++-
 3 files changed, 145 insertions(+), 34 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [XEN PATCH 1/4] automation/eclair: add support for tag pipelines
  2023-08-01  9:57 [XEN PATCH 0/4] automation/eclair: improvements to the ECLAIR integration Simone Ballarin
@ 2023-08-01  9:57 ` Simone Ballarin
  2023-08-01 22:54   ` Stefano Stabellini
  2023-08-01  9:57 ` [XEN PATCH 2/4] automation/eclair: add direct link to reports Simone Ballarin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Simone Ballarin @ 2023-08-01  9:57 UTC (permalink / raw)
  To: xen-devel; +Cc: consulting, Simone Ballarin, Doug Goldstein, Stefano Stabellini

The ECLAIR jobs fail when triggered by tag pipelines (e.g.
xen-project/patchew/xen).

This patch extends the integration to support such pipelines.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 .../eclair_analysis/ECLAIR/action.settings    | 24 ++++++++++++-------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/action.settings b/automation/eclair_analysis/ECLAIR/action.settings
index 96426811a8..71c10d5141 100644
--- a/automation/eclair_analysis/ECLAIR/action.settings
+++ b/automation/eclair_analysis/ECLAIR/action.settings
@@ -41,7 +41,7 @@ github)
     push | workflow_dispatch)
         event=push
         # Extract the branch name from "refs/heads/<branch>"
-        branch="${GITHUB_REF#refs/heads/}"
+        ref="${GITHUB_REF#refs/heads/}"
         headCommitId="${GITHUB_SHA}"
         pushUser="${GITHUB_ACTOR}"
         ;;
@@ -75,7 +75,13 @@ gitlab)
         ;;
     push | pipeline | web)
         event=push
-        branch="${CI_COMMIT_BRANCH}"
+        if [ -n "${CI_COMMIT_BRANCH:-}" ]; then
+            ref_kind=branch
+            ref="${CI_COMMIT_BRANCH}"
+        else
+            ref_kind=tag
+            ref="${CI_COMMIT_TAG}"
+        fi
         headCommitId="${CI_COMMIT_SHA}"
         pushUser="${GITLAB_USER_NAME}"
         ;;
@@ -99,7 +105,7 @@ jenkins)
     jenkinsBotToken="${ECLAIR_BOT_TOKEN:-}"
 
     event=push
-    branch="${GIT_BRANCH}"
+    ref="${GIT_BRANCH}"
     headCommitId="${GIT_COMMIT}"
     pushUser=$(git show --pretty='format:%aN' -s)
     ;;
@@ -111,7 +117,7 @@ esac
 
 if [ "${event}" = "push" ] && [ -n "${autoPRBranch:-}" ]; then
     # AUTO PR Feature enabled
-    if ! [ "${branch}" = "${autoPRBranch}" ] ||
+    if ! [ "${ref}" = "${autoPRBranch}" ] ||
         ! [ "${repository}" = "${autoPRRepository}" ]; then
         event=auto_pull_request
     fi
@@ -123,17 +129,17 @@ pull_request)
     jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pullRequestUser} wants to merge ${pullRequestHeadRepo}:${pullRequestHeadRef} (${headCommitId}) into ${pullRequestBaseRef} (${baseCommitId})"
     ;;
 push)
-    subDir="${branch}"
-    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: branch ${branch} (${headCommitId})"
-    badgeLabel="ECLAIR ${ANALYSIS_KIND} ${branch}${variantHeadline} #${jobId}"
+    subDir="${ref}"
+    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${ref_kind} ${ref} (${headCommitId})"
+    badgeLabel="ECLAIR ${ANALYSIS_KIND} ${ref}${variantHeadline} #${jobId}"
     ;;
 auto_pull_request)
     git remote remove autoPRRemote || true
     git remote add autoPRRemote "${autoPRRemoteUrl}"
     git fetch -q autoPRRemote
-    subDir="${branch}"
+    subDir="${ref}"
     baseCommitId=$(git merge-base "autoPRRemote/${autoPRBranch}" HEAD)
-    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pushUser} wants to merge ${repository}:${branch} (${headCommitId}) into ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
+    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pushUser} wants to merge ${repository}:${ref} (${headCommitId}) into ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
     ;;
 *)
     echo "Unexpected event ${event}" >&2
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [XEN PATCH 2/4] automation/eclair: add direct link to reports
  2023-08-01  9:57 [XEN PATCH 0/4] automation/eclair: improvements to the ECLAIR integration Simone Ballarin
  2023-08-01  9:57 ` [XEN PATCH 1/4] automation/eclair: add support for tag pipelines Simone Ballarin
@ 2023-08-01  9:57 ` Simone Ballarin
  2023-08-01 22:55   ` Stefano Stabellini
  2023-08-01  9:57 ` [XEN PATCH 3/4] automation/eclair: add scheduled pipelines Simone Ballarin
  2023-08-01  9:57 ` [XEN PATCH 4/4] automation/eclair: avoid failure in case of missing merge point Simone Ballarin
  3 siblings, 1 reply; 13+ messages in thread
From: Simone Ballarin @ 2023-08-01  9:57 UTC (permalink / raw)
  To: xen-devel; +Cc: consulting, Simone Ballarin, Doug Goldstein, Stefano Stabellini

This patch adds direct links to the analysis findings in the
console log.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 .../eclair_analysis/ECLAIR/action.helpers     | 84 ++++++++++++++-----
 1 file changed, 65 insertions(+), 19 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/action.helpers b/automation/eclair_analysis/ECLAIR/action.helpers
index 2ad6428eaa..df9bf2bd11 100644
--- a/automation/eclair_analysis/ECLAIR/action.helpers
+++ b/automation/eclair_analysis/ECLAIR/action.helpers
@@ -1,17 +1,26 @@
+esc=$(printf '\e')
+cr=$(printf '\r')
+
 if [ -n "${GITLAB_CI:-}" ]; then
     ci=gitlab
+    eol=
+    link_start="${esc}[33m"
+    link_end="${esc}[m"
 elif [ -n "${GITHUB_ACTION:-}" ]; then
     ci=github
+    eol="\\"
+    link_start=
+    link_end=
 elif [ -n "${JENKINS_HOME:-}" ]; then
     ci=jenkins
+    eol="<br/>"
+    link_start=
+    link_end=
 else
     echo "Unexpected CI/CD context" >&2
     exit 1
 fi
 
-esc=$(printf '\e')
-cr=$(printf '\r')
-
 open_section() {
     id=$1
     title=$2
@@ -36,54 +45,86 @@ summary() {
 
     case "${ci}" in
     github)
-        nl="\\"
+        eol="\\"
         ;;
     gitlab)
-        nl=
+        eol=
         ;;
     jenkins)
-        nl="<br/>"
+        eol="<br/>"
         ;;
     *)
-        nl=
+        eol=
         ;;
     esac
 
+    currentDbReportsUrl="${eclairReportUrlPrefix}/fs${jobDir}/PROJECT.ecd;/by_service.html#service&kind"
     if [ -z "${newReports}" ]; then
-        fixedMsg=
+        fixedMsg="No fixed reports as there is no baseline"
         unfixedMsg="Unfixed reports: ${unfixedReports}"
-        countsMsg="${unfixedMsg}"
+        referenceReportsMsgTxt=
+        referenceReportsMsgLog=
     else
         fixedMsg="Fixed reports: ${fixedReports}"
         unfixedMsg="Unfixed reports: ${unfixedReports} [new: ${newReports}]"
-        countsMsg="${fixedMsg}${nl}
-${unfixedMsg}"
+        case "${event}" in
+        pull_request | auto_pull_request)
+            referenceDbReportsUrl="${eclairReportUrlPrefix}/fs${jobDir}/base/PROJECT.ecd;/by_service.html#service&kind"
+            reference_kind=base
+            ;;
+        push)
+            referenceDbReportsUrl="${eclairReportUrlPrefix}/fs${jobDir}/prev/PROJECT.ecd;/by_service.html#service&kind"
+            reference_kind=previous
+            ;;
+        *)
+            echo "Unexpected event ${event}" >&2
+            exit 1
+            ;;
+        esac
     fi
+
     case "${ci}" in
     jenkins)
+        if [ -n "${newReports}" ]; then
+            referenceReportsMsgTxt="<a href="${referenceDbReportsUrl}">Browse ${reference_kind} reports</a>"
+        fi
         cat <<EOF >"${summaryTxt}"
-${countsMsg}                                                                              ${nl}
+${fixedMsg}${eol}
+${unfixedMsg}                                                                              ${eol}
 <a href="https://www.bugseng.com/eclair">
   <img src="${eclairReportUrlPrefix}/rsrc/eclair.svg" width="100" />
 </a>
 <h3>${jobHeadline}</h3>
-<a href="${indexHtmlUrl}">Browse analysis results</a>
+<a href="${indexHtmlUrl}">Browse analysis summary</a>
+<a href="${currentDbReportsUrl}">Browse current reports</a>
+${referenceReportsMsgTxt}
 EOF
         ;;
     *)
+        if [ -n "${newReports}" ]; then
+            referenceReportsMsgTxt="Browse ${reference_kind} reports: ${referenceDbReportsUrl}"
+        fi
         cat <<EOF >"${summaryTxt}"
 <a href="https://www.bugseng.com/eclair">
   <img src="${eclairReportUrlPrefix}/rsrc/eclair.svg" width="100" />
 </a>
 Analysis Summary
 
-${jobHeadline}${nl}
-${countsMsg}${nl}
-[Browse analysis](${indexHtmlUrl})
+${jobHeadline}${eol}
+${fixedMsg}${eol}
+${unfixedMsg}${eol}
+Browse analysis summary: ${indexHtmlUrl}
+Browse current reports: ${currentDbReportsUrl}
+${referenceReportsMsgTxt}
 EOF
         ;;
     esac
 
+    analysisSummaryMsgLog="Browse analysis summary: ${link_start}${indexHtmlUrl}${link_end}"
+    currentReportsMsgLog="Browse current reports: ${link_start}${currentDbReportsUrl}${link_end}"
+    if [ -n "${newReports}" ]; then
+        referenceReportsMsgLog="Browse ${reference_kind} reports: ${link_start}${referenceDbReportsUrl}${link_end}"
+    fi
     case ${ci} in
     github)
         cat "${summaryTxt}" >"${GITHUB_STEP_SUMMARY}"
@@ -93,8 +134,11 @@ EOF
         # Generate summary and print it (GitLab-specific)
         cat <<EOF
 ${jobHeadline}
-${countsMsg}
-Browse analysis: ${esc}[33m${indexHtmlUrl}${esc}[m
+${fixedMsg}
+${unfixedMsg}
+${analysisSummaryMsgLog}
+${currentReportsMsgLog}
+${referenceReportsMsgLog}
 EOF
         close_section ECLAIR_summary
         ;;
@@ -103,7 +147,9 @@ EOF
 ${jobHeadline}
 ${fixedMsg}
 ${unfixedMsg}
-Browse analysis: ${indexHtmlUrl}
+${analysisSummaryMsgLog}
+${currentReportsMsgLog}
+${referenceReportsMsgLog}
 EOF
         ;;
     *)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
  2023-08-01  9:57 [XEN PATCH 0/4] automation/eclair: improvements to the ECLAIR integration Simone Ballarin
  2023-08-01  9:57 ` [XEN PATCH 1/4] automation/eclair: add support for tag pipelines Simone Ballarin
  2023-08-01  9:57 ` [XEN PATCH 2/4] automation/eclair: add direct link to reports Simone Ballarin
@ 2023-08-01  9:57 ` Simone Ballarin
  2023-08-01 22:55   ` Stefano Stabellini
  2023-08-01  9:57 ` [XEN PATCH 4/4] automation/eclair: avoid failure in case of missing merge point Simone Ballarin
  3 siblings, 1 reply; 13+ messages in thread
From: Simone Ballarin @ 2023-08-01  9:57 UTC (permalink / raw)
  To: xen-devel; +Cc: consulting, Simone Ballarin, Doug Goldstein, Stefano Stabellini

This patch introduces six new ECLAIR jobs that run only
when triggered by a GitLab scheduled pipeline.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 .../eclair_analysis/ECLAIR/action.settings    |  2 +-
 automation/gitlab-ci/analyze.yaml             | 65 +++++++++++++++++--
 2 files changed, 62 insertions(+), 5 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/action.settings b/automation/eclair_analysis/ECLAIR/action.settings
index 71c10d5141..528bc24c72 100644
--- a/automation/eclair_analysis/ECLAIR/action.settings
+++ b/automation/eclair_analysis/ECLAIR/action.settings
@@ -73,7 +73,7 @@ gitlab)
         headCommitId="${CI_COMMIT_SHA}"
         baseCommitId="${CI_MERGE_REQUEST_DIFF_BASE_SHA}"
         ;;
-    push | pipeline | web)
+    push | pipeline | web | schedule)
         event=push
         if [ -n "${CI_COMMIT_BRANCH:-}" ]; then
             ref_kind=branch
diff --git a/automation/gitlab-ci/analyze.yaml b/automation/gitlab-ci/analyze.yaml
index 3d8166572b..3325ef9d9a 100644
--- a/automation/gitlab-ci/analyze.yaml
+++ b/automation/gitlab-ci/analyze.yaml
@@ -8,6 +8,8 @@
     ENABLE_ECLAIR_BOT: "n"
     AUTO_PR_BRANCH: "staging"
     AUTO_PR_REPOSITORY: "xen-project/xen"
+  script:
+    - ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
   artifacts:
     when: always
     paths:
@@ -23,8 +25,6 @@ eclair-x86_64:
     LOGFILE: "eclair-x86_64.log"
     VARIANT: "X86_64"
     RULESET: "Set1"
-  script:
-    - ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
   allow_failure: true
 
 eclair-ARM64:
@@ -33,6 +33,63 @@ eclair-ARM64:
     LOGFILE: "eclair-ARM64.log"
     VARIANT: "ARM64"
     RULESET: "Set1"
-  script:
-    - ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
+  allow_failure: true
+
+.eclair-analysis:on-schedule:
+  extends: .eclair-analysis
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+
+eclair-x86_64-Set1:on-schedule:
+  extends: .eclair-analysis:on-schedule
+  variables:
+    VARIANT: "X86_64"
+    RULESET: "Set1"
+    ANALYSIS_KIND: "${RULESET}-scheduled"
+    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
+  allow_failure: true
+
+eclair-x86_64-Set2:on-schedule:
+  extends: .eclair-analysis:on-schedule
+  variables:
+    VARIANT: "X86_64"
+    RULESET: "Set2"
+    ANALYSIS_KIND: "${RULESET}-scheduled"
+    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
+  allow_failure: true
+
+eclair-x86_64-Set3:on-schedule:
+  extends: .eclair-analysis:on-schedule
+  variables:
+    VARIANT: "X86_64"
+    RULESET: "Set3"
+    ANALYSIS_KIND: "${RULESET}-scheduled"
+    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
+  allow_failure: true
+
+eclair-ARM64-Set1:on-schedule:
+  extends: .eclair-analysis:on-schedule
+  variables:
+    VARIANT: "ARM64"
+    RULESET: "Set1"
+    ANALYSIS_KIND: "${RULESET}-scheduled"
+    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
+  allow_failure: true
+
+eclair-ARM64-Set2:on-schedule:
+  extends: .eclair-analysis:on-schedule
+  variables:
+    VARIANT: "ARM64"
+    RULESET: "Set2"
+    ANALYSIS_KIND: "${RULESET}-scheduled"
+    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
+  allow_failure: true
+
+eclair-ARM64-Set3:on-schedule:
+  extends: .eclair-analysis:on-schedule
+  variables:
+    VARIANT: "ARM64"
+    RULESET: "Set3"
+    ANALYSIS_KIND: "${RULESET}-scheduled"
+    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
   allow_failure: true
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [XEN PATCH 4/4] automation/eclair: avoid failure in case of missing merge point
  2023-08-01  9:57 [XEN PATCH 0/4] automation/eclair: improvements to the ECLAIR integration Simone Ballarin
                   ` (2 preceding siblings ...)
  2023-08-01  9:57 ` [XEN PATCH 3/4] automation/eclair: add scheduled pipelines Simone Ballarin
@ 2023-08-01  9:57 ` Simone Ballarin
  2023-08-01 22:55   ` Stefano Stabellini
  3 siblings, 1 reply; 13+ messages in thread
From: Simone Ballarin @ 2023-08-01  9:57 UTC (permalink / raw)
  To: xen-devel; +Cc: consulting, Simone Ballarin, Doug Goldstein, Stefano Stabellini

In the context of an auto pull request, when a common merge point
is not found the integration will continue the analysis without
failing.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/action.settings | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/action.settings b/automation/eclair_analysis/ECLAIR/action.settings
index 528bc24c72..f96368ffc7 100644
--- a/automation/eclair_analysis/ECLAIR/action.settings
+++ b/automation/eclair_analysis/ECLAIR/action.settings
@@ -138,7 +138,9 @@ auto_pull_request)
     git remote add autoPRRemote "${autoPRRemoteUrl}"
     git fetch -q autoPRRemote
     subDir="${ref}"
-    baseCommitId=$(git merge-base "autoPRRemote/${autoPRBranch}" HEAD)
+    if ! baseCommitId=$(git merge-base "autoPRRemote/${autoPRBranch}" HEAD); then
+        baseCommitId=no_merge_point
+    fi
     jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pushUser} wants to merge ${repository}:${ref} (${headCommitId}) into ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
     ;;
 *)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 1/4] automation/eclair: add support for tag pipelines
  2023-08-01  9:57 ` [XEN PATCH 1/4] automation/eclair: add support for tag pipelines Simone Ballarin
@ 2023-08-01 22:54   ` Stefano Stabellini
  2023-08-02  7:43     ` Simone Ballarin
  0 siblings, 1 reply; 13+ messages in thread
From: Stefano Stabellini @ 2023-08-01 22:54 UTC (permalink / raw)
  To: Simone Ballarin; +Cc: xen-devel, consulting, Doug Goldstein, Stefano Stabellini

On Tue, 1 Aug 2023, Simone Ballarin wrote:
> The ECLAIR jobs fail when triggered by tag pipelines (e.g.
> xen-project/patchew/xen).
> 
> This patch extends the integration to support such pipelines.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>

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

Thanks for the fix! One good suggestion from Andrew would be to check
for required variables at the beginning, rather than at the end. As it
is now we are doing all the work just to fail at the end. It would have
been better to fail immediately saving resources. It could be another
patch :-)


> ---
>  .../eclair_analysis/ECLAIR/action.settings    | 24 ++++++++++++-------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/automation/eclair_analysis/ECLAIR/action.settings b/automation/eclair_analysis/ECLAIR/action.settings
> index 96426811a8..71c10d5141 100644
> --- a/automation/eclair_analysis/ECLAIR/action.settings
> +++ b/automation/eclair_analysis/ECLAIR/action.settings
> @@ -41,7 +41,7 @@ github)
>      push | workflow_dispatch)
>          event=push
>          # Extract the branch name from "refs/heads/<branch>"
> -        branch="${GITHUB_REF#refs/heads/}"
> +        ref="${GITHUB_REF#refs/heads/}"
>          headCommitId="${GITHUB_SHA}"
>          pushUser="${GITHUB_ACTOR}"
>          ;;
> @@ -75,7 +75,13 @@ gitlab)
>          ;;
>      push | pipeline | web)
>          event=push
> -        branch="${CI_COMMIT_BRANCH}"
> +        if [ -n "${CI_COMMIT_BRANCH:-}" ]; then
> +            ref_kind=branch
> +            ref="${CI_COMMIT_BRANCH}"
> +        else
> +            ref_kind=tag
> +            ref="${CI_COMMIT_TAG}"
> +        fi
>          headCommitId="${CI_COMMIT_SHA}"
>          pushUser="${GITLAB_USER_NAME}"
>          ;;
> @@ -99,7 +105,7 @@ jenkins)
>      jenkinsBotToken="${ECLAIR_BOT_TOKEN:-}"
>  
>      event=push
> -    branch="${GIT_BRANCH}"
> +    ref="${GIT_BRANCH}"
>      headCommitId="${GIT_COMMIT}"
>      pushUser=$(git show --pretty='format:%aN' -s)
>      ;;
> @@ -111,7 +117,7 @@ esac
>  
>  if [ "${event}" = "push" ] && [ -n "${autoPRBranch:-}" ]; then
>      # AUTO PR Feature enabled
> -    if ! [ "${branch}" = "${autoPRBranch}" ] ||
> +    if ! [ "${ref}" = "${autoPRBranch}" ] ||
>          ! [ "${repository}" = "${autoPRRepository}" ]; then
>          event=auto_pull_request
>      fi
> @@ -123,17 +129,17 @@ pull_request)
>      jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pullRequestUser} wants to merge ${pullRequestHeadRepo}:${pullRequestHeadRef} (${headCommitId}) into ${pullRequestBaseRef} (${baseCommitId})"
>      ;;
>  push)
> -    subDir="${branch}"
> -    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: branch ${branch} (${headCommitId})"
> -    badgeLabel="ECLAIR ${ANALYSIS_KIND} ${branch}${variantHeadline} #${jobId}"
> +    subDir="${ref}"
> +    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${ref_kind} ${ref} (${headCommitId})"
> +    badgeLabel="ECLAIR ${ANALYSIS_KIND} ${ref}${variantHeadline} #${jobId}"
>      ;;
>  auto_pull_request)
>      git remote remove autoPRRemote || true
>      git remote add autoPRRemote "${autoPRRemoteUrl}"
>      git fetch -q autoPRRemote
> -    subDir="${branch}"
> +    subDir="${ref}"
>      baseCommitId=$(git merge-base "autoPRRemote/${autoPRBranch}" HEAD)
> -    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pushUser} wants to merge ${repository}:${branch} (${headCommitId}) into ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
> +    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pushUser} wants to merge ${repository}:${ref} (${headCommitId}) into ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
>      ;;
>  *)
>      echo "Unexpected event ${event}" >&2
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 2/4] automation/eclair: add direct link to reports
  2023-08-01  9:57 ` [XEN PATCH 2/4] automation/eclair: add direct link to reports Simone Ballarin
@ 2023-08-01 22:55   ` Stefano Stabellini
  0 siblings, 0 replies; 13+ messages in thread
From: Stefano Stabellini @ 2023-08-01 22:55 UTC (permalink / raw)
  To: Simone Ballarin; +Cc: xen-devel, consulting, Doug Goldstein, Stefano Stabellini

On Tue, 1 Aug 2023, Simone Ballarin wrote:
> This patch adds direct links to the analysis findings in the
> console log.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>

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


> ---
>  .../eclair_analysis/ECLAIR/action.helpers     | 84 ++++++++++++++-----
>  1 file changed, 65 insertions(+), 19 deletions(-)
> 
> diff --git a/automation/eclair_analysis/ECLAIR/action.helpers b/automation/eclair_analysis/ECLAIR/action.helpers
> index 2ad6428eaa..df9bf2bd11 100644
> --- a/automation/eclair_analysis/ECLAIR/action.helpers
> +++ b/automation/eclair_analysis/ECLAIR/action.helpers
> @@ -1,17 +1,26 @@
> +esc=$(printf '\e')
> +cr=$(printf '\r')
> +
>  if [ -n "${GITLAB_CI:-}" ]; then
>      ci=gitlab
> +    eol=
> +    link_start="${esc}[33m"
> +    link_end="${esc}[m"
>  elif [ -n "${GITHUB_ACTION:-}" ]; then
>      ci=github
> +    eol="\\"
> +    link_start=
> +    link_end=
>  elif [ -n "${JENKINS_HOME:-}" ]; then
>      ci=jenkins
> +    eol="<br/>"
> +    link_start=
> +    link_end=
>  else
>      echo "Unexpected CI/CD context" >&2
>      exit 1
>  fi
>  
> -esc=$(printf '\e')
> -cr=$(printf '\r')
> -
>  open_section() {
>      id=$1
>      title=$2
> @@ -36,54 +45,86 @@ summary() {
>  
>      case "${ci}" in
>      github)
> -        nl="\\"
> +        eol="\\"
>          ;;
>      gitlab)
> -        nl=
> +        eol=
>          ;;
>      jenkins)
> -        nl="<br/>"
> +        eol="<br/>"
>          ;;
>      *)
> -        nl=
> +        eol=
>          ;;
>      esac
>  
> +    currentDbReportsUrl="${eclairReportUrlPrefix}/fs${jobDir}/PROJECT.ecd;/by_service.html#service&kind"
>      if [ -z "${newReports}" ]; then
> -        fixedMsg=
> +        fixedMsg="No fixed reports as there is no baseline"
>          unfixedMsg="Unfixed reports: ${unfixedReports}"
> -        countsMsg="${unfixedMsg}"
> +        referenceReportsMsgTxt=
> +        referenceReportsMsgLog=
>      else
>          fixedMsg="Fixed reports: ${fixedReports}"
>          unfixedMsg="Unfixed reports: ${unfixedReports} [new: ${newReports}]"
> -        countsMsg="${fixedMsg}${nl}
> -${unfixedMsg}"
> +        case "${event}" in
> +        pull_request | auto_pull_request)
> +            referenceDbReportsUrl="${eclairReportUrlPrefix}/fs${jobDir}/base/PROJECT.ecd;/by_service.html#service&kind"
> +            reference_kind=base
> +            ;;
> +        push)
> +            referenceDbReportsUrl="${eclairReportUrlPrefix}/fs${jobDir}/prev/PROJECT.ecd;/by_service.html#service&kind"
> +            reference_kind=previous
> +            ;;
> +        *)
> +            echo "Unexpected event ${event}" >&2
> +            exit 1
> +            ;;
> +        esac
>      fi
> +
>      case "${ci}" in
>      jenkins)
> +        if [ -n "${newReports}" ]; then
> +            referenceReportsMsgTxt="<a href="${referenceDbReportsUrl}">Browse ${reference_kind} reports</a>"
> +        fi
>          cat <<EOF >"${summaryTxt}"
> -${countsMsg}                                                                              ${nl}
> +${fixedMsg}${eol}
> +${unfixedMsg}                                                                              ${eol}
>  <a href="https://www.bugseng.com/eclair">
>    <img src="${eclairReportUrlPrefix}/rsrc/eclair.svg" width="100" />
>  </a>
>  <h3>${jobHeadline}</h3>
> -<a href="${indexHtmlUrl}">Browse analysis results</a>
> +<a href="${indexHtmlUrl}">Browse analysis summary</a>
> +<a href="${currentDbReportsUrl}">Browse current reports</a>
> +${referenceReportsMsgTxt}
>  EOF
>          ;;
>      *)
> +        if [ -n "${newReports}" ]; then
> +            referenceReportsMsgTxt="Browse ${reference_kind} reports: ${referenceDbReportsUrl}"
> +        fi
>          cat <<EOF >"${summaryTxt}"
>  <a href="https://www.bugseng.com/eclair">
>    <img src="${eclairReportUrlPrefix}/rsrc/eclair.svg" width="100" />
>  </a>
>  Analysis Summary
>  
> -${jobHeadline}${nl}
> -${countsMsg}${nl}
> -[Browse analysis](${indexHtmlUrl})
> +${jobHeadline}${eol}
> +${fixedMsg}${eol}
> +${unfixedMsg}${eol}
> +Browse analysis summary: ${indexHtmlUrl}
> +Browse current reports: ${currentDbReportsUrl}
> +${referenceReportsMsgTxt}
>  EOF
>          ;;
>      esac
>  
> +    analysisSummaryMsgLog="Browse analysis summary: ${link_start}${indexHtmlUrl}${link_end}"
> +    currentReportsMsgLog="Browse current reports: ${link_start}${currentDbReportsUrl}${link_end}"
> +    if [ -n "${newReports}" ]; then
> +        referenceReportsMsgLog="Browse ${reference_kind} reports: ${link_start}${referenceDbReportsUrl}${link_end}"
> +    fi
>      case ${ci} in
>      github)
>          cat "${summaryTxt}" >"${GITHUB_STEP_SUMMARY}"
> @@ -93,8 +134,11 @@ EOF
>          # Generate summary and print it (GitLab-specific)
>          cat <<EOF
>  ${jobHeadline}
> -${countsMsg}
> -Browse analysis: ${esc}[33m${indexHtmlUrl}${esc}[m
> +${fixedMsg}
> +${unfixedMsg}
> +${analysisSummaryMsgLog}
> +${currentReportsMsgLog}
> +${referenceReportsMsgLog}
>  EOF
>          close_section ECLAIR_summary
>          ;;
> @@ -103,7 +147,9 @@ EOF
>  ${jobHeadline}
>  ${fixedMsg}
>  ${unfixedMsg}
> -Browse analysis: ${indexHtmlUrl}
> +${analysisSummaryMsgLog}
> +${currentReportsMsgLog}
> +${referenceReportsMsgLog}
>  EOF
>          ;;
>      *)
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
  2023-08-01  9:57 ` [XEN PATCH 3/4] automation/eclair: add scheduled pipelines Simone Ballarin
@ 2023-08-01 22:55   ` Stefano Stabellini
  2023-08-02  0:05     ` Marek Marczykowski-Górecki
  0 siblings, 1 reply; 13+ messages in thread
From: Stefano Stabellini @ 2023-08-01 22:55 UTC (permalink / raw)
  To: Simone Ballarin; +Cc: xen-devel, consulting, Doug Goldstein, Stefano Stabellini

On Tue, 1 Aug 2023, Simone Ballarin wrote:
> This patch introduces six new ECLAIR jobs that run only
> when triggered by a GitLab scheduled pipeline.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
> ---
>  .../eclair_analysis/ECLAIR/action.settings    |  2 +-
>  automation/gitlab-ci/analyze.yaml             | 65 +++++++++++++++++--
>  2 files changed, 62 insertions(+), 5 deletions(-)
> 
> diff --git a/automation/eclair_analysis/ECLAIR/action.settings b/automation/eclair_analysis/ECLAIR/action.settings
> index 71c10d5141..528bc24c72 100644
> --- a/automation/eclair_analysis/ECLAIR/action.settings
> +++ b/automation/eclair_analysis/ECLAIR/action.settings
> @@ -73,7 +73,7 @@ gitlab)
>          headCommitId="${CI_COMMIT_SHA}"
>          baseCommitId="${CI_MERGE_REQUEST_DIFF_BASE_SHA}"
>          ;;
> -    push | pipeline | web)
> +    push | pipeline | web | schedule)
>          event=push
>          if [ -n "${CI_COMMIT_BRANCH:-}" ]; then
>              ref_kind=branch
> diff --git a/automation/gitlab-ci/analyze.yaml b/automation/gitlab-ci/analyze.yaml
> index 3d8166572b..3325ef9d9a 100644
> --- a/automation/gitlab-ci/analyze.yaml
> +++ b/automation/gitlab-ci/analyze.yaml
> @@ -8,6 +8,8 @@
>      ENABLE_ECLAIR_BOT: "n"
>      AUTO_PR_BRANCH: "staging"
>      AUTO_PR_REPOSITORY: "xen-project/xen"
> +  script:
> +    - ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
>    artifacts:
>      when: always
>      paths:
> @@ -23,8 +25,6 @@ eclair-x86_64:
>      LOGFILE: "eclair-x86_64.log"
>      VARIANT: "X86_64"
>      RULESET: "Set1"
> -  script:
> -    - ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
>    allow_failure: true
>  
>  eclair-ARM64:
> @@ -33,6 +33,63 @@ eclair-ARM64:
>      LOGFILE: "eclair-ARM64.log"
>      VARIANT: "ARM64"
>      RULESET: "Set1"
> -  script:
> -    - ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
> +  allow_failure: true
> +
> +.eclair-analysis:on-schedule:
> +  extends: .eclair-analysis
> +  rules:
> +    - if: $CI_PIPELINE_SOURCE == "schedule"

If I understand this right, the idea is that someone would schedule a
pipeline (Build -> "Pipeline Schedules") and as part of that, they would
also define the variable "CI_PIPELINE_SOURCE" to schedule.

Is that correct?

If so, please add a good in-code comments here on top of
.eclair-analysis:on-schedule to explain it. So that someone reading this
might know how what to do with the Gitlab CI settings.


> +eclair-x86_64-Set1:on-schedule:
> +  extends: .eclair-analysis:on-schedule
> +  variables:
> +    VARIANT: "X86_64"
> +    RULESET: "Set1"
> +    ANALYSIS_KIND: "${RULESET}-scheduled"
> +    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
> +  allow_failure: true
> +
> +eclair-x86_64-Set2:on-schedule:
> +  extends: .eclair-analysis:on-schedule
> +  variables:
> +    VARIANT: "X86_64"
> +    RULESET: "Set2"
> +    ANALYSIS_KIND: "${RULESET}-scheduled"
> +    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
> +  allow_failure: true
> +
> +eclair-x86_64-Set3:on-schedule:
> +  extends: .eclair-analysis:on-schedule
> +  variables:
> +    VARIANT: "X86_64"
> +    RULESET: "Set3"
> +    ANALYSIS_KIND: "${RULESET}-scheduled"
> +    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
> +  allow_failure: true
> +
> +eclair-ARM64-Set1:on-schedule:
> +  extends: .eclair-analysis:on-schedule
> +  variables:
> +    VARIANT: "ARM64"
> +    RULESET: "Set1"
> +    ANALYSIS_KIND: "${RULESET}-scheduled"
> +    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
> +  allow_failure: true
> +
> +eclair-ARM64-Set2:on-schedule:
> +  extends: .eclair-analysis:on-schedule
> +  variables:
> +    VARIANT: "ARM64"
> +    RULESET: "Set2"
> +    ANALYSIS_KIND: "${RULESET}-scheduled"
> +    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
> +  allow_failure: true
> +
> +eclair-ARM64-Set3:on-schedule:
> +  extends: .eclair-analysis:on-schedule
> +  variables:
> +    VARIANT: "ARM64"
> +    RULESET: "Set3"
> +    ANALYSIS_KIND: "${RULESET}-scheduled"
> +    LOGFILE: "eclair-${VARIANT}-${RULESET}.log"
>    allow_failure: true
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 4/4] automation/eclair: avoid failure in case of missing merge point
  2023-08-01  9:57 ` [XEN PATCH 4/4] automation/eclair: avoid failure in case of missing merge point Simone Ballarin
@ 2023-08-01 22:55   ` Stefano Stabellini
  0 siblings, 0 replies; 13+ messages in thread
From: Stefano Stabellini @ 2023-08-01 22:55 UTC (permalink / raw)
  To: Simone Ballarin; +Cc: xen-devel, consulting, Doug Goldstein, Stefano Stabellini

On Tue, 1 Aug 2023, Simone Ballarin wrote:
> In the context of an auto pull request, when a common merge point
> is not found the integration will continue the analysis without
> failing.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>

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


> ---
>  automation/eclair_analysis/ECLAIR/action.settings | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/automation/eclair_analysis/ECLAIR/action.settings b/automation/eclair_analysis/ECLAIR/action.settings
> index 528bc24c72..f96368ffc7 100644
> --- a/automation/eclair_analysis/ECLAIR/action.settings
> +++ b/automation/eclair_analysis/ECLAIR/action.settings
> @@ -138,7 +138,9 @@ auto_pull_request)
>      git remote add autoPRRemote "${autoPRRemoteUrl}"
>      git fetch -q autoPRRemote
>      subDir="${ref}"
> -    baseCommitId=$(git merge-base "autoPRRemote/${autoPRBranch}" HEAD)
> +    if ! baseCommitId=$(git merge-base "autoPRRemote/${autoPRBranch}" HEAD); then
> +        baseCommitId=no_merge_point
> +    fi
>      jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: ${pushUser} wants to merge ${repository}:${ref} (${headCommitId}) into ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
>      ;;
>  *)
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
  2023-08-01 22:55   ` Stefano Stabellini
@ 2023-08-02  0:05     ` Marek Marczykowski-Górecki
  2023-08-02  0:08       ` Stefano Stabellini
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Marczykowski-Górecki @ 2023-08-02  0:05 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: Simone Ballarin, xen-devel, consulting, Doug Goldstein

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]

On Tue, Aug 01, 2023 at 03:55:20PM -0700, Stefano Stabellini wrote:
> On Tue, 1 Aug 2023, Simone Ballarin wrote:
> > This patch introduces six new ECLAIR jobs that run only
> > when triggered by a GitLab scheduled pipeline.
> > 
> > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
> > ---
> > +.eclair-analysis:on-schedule:
> > +  extends: .eclair-analysis
> > +  rules:
> > +    - if: $CI_PIPELINE_SOURCE == "schedule"
> 
> If I understand this right, the idea is that someone would schedule a
> pipeline (Build -> "Pipeline Schedules") and as part of that, they would
> also define the variable "CI_PIPELINE_SOURCE" to schedule.

No, this is pre-defined variable in gitlab:
https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

> 
> Is that correct?
> 
> If so, please add a good in-code comments here on top of
> .eclair-analysis:on-schedule to explain it. So that someone reading this
> might know how what to do with the Gitlab CI settings.
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
  2023-08-02  0:05     ` Marek Marczykowski-Górecki
@ 2023-08-02  0:08       ` Stefano Stabellini
  2023-08-02  7:39         ` Simone Ballarin
  0 siblings, 1 reply; 13+ messages in thread
From: Stefano Stabellini @ 2023-08-02  0:08 UTC (permalink / raw)
  To: Marek Marczykowski-Górecki
  Cc: Stefano Stabellini, Simone Ballarin, xen-devel, consulting,
	Doug Goldstein

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

On Wed, 2 Aug 2023, Marek Marczykowski-Górecki wrote:
> On Tue, Aug 01, 2023 at 03:55:20PM -0700, Stefano Stabellini wrote:
> > On Tue, 1 Aug 2023, Simone Ballarin wrote:
> > > This patch introduces six new ECLAIR jobs that run only
> > > when triggered by a GitLab scheduled pipeline.
> > > 
> > > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
> > > ---
> > > +.eclair-analysis:on-schedule:
> > > +  extends: .eclair-analysis
> > > +  rules:
> > > +    - if: $CI_PIPELINE_SOURCE == "schedule"
> > 
> > If I understand this right, the idea is that someone would schedule a
> > pipeline (Build -> "Pipeline Schedules") and as part of that, they would
> > also define the variable "CI_PIPELINE_SOURCE" to schedule.
> 
> No, this is pre-defined variable in gitlab:
> https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

Even better! Thanks! Then no need for a comment and the patch is OK as
is.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
  2023-08-02  0:08       ` Stefano Stabellini
@ 2023-08-02  7:39         ` Simone Ballarin
  0 siblings, 0 replies; 13+ messages in thread
From: Simone Ballarin @ 2023-08-02  7:39 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Marek Marczykowski-Górecki, xen-devel, consulting,
	Doug Goldstein

Il 02/08/2023 02:08 Stefano Stabellini ha scritto:
> On Wed, 2 Aug 2023, Marek Marczykowski-Górecki wrote:
>> On Tue, Aug 01, 2023 at 03:55:20PM -0700, Stefano Stabellini wrote:
>> > On Tue, 1 Aug 2023, Simone Ballarin wrote:
>> > > This patch introduces six new ECLAIR jobs that run only
>> > > when triggered by a GitLab scheduled pipeline.
>> > >
>> > > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
>> > > ---
>> > > +.eclair-analysis:on-schedule:
>> > > +  extends: .eclair-analysis
>> > > +  rules:
>> > > +    - if: $CI_PIPELINE_SOURCE == "schedule"
>> >
>> > If I understand this right, the idea is that someone would schedule a
>> > pipeline (Build -> "Pipeline Schedules") and as part of that, they would
>> > also define the variable "CI_PIPELINE_SOURCE" to schedule.
>> 
>> No, this is pre-defined variable in gitlab:
>> https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
> 
> Even better! Thanks! Then no need for a comment and the patch is OK as
> is.
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Here is a link with the instructions for creating scheduled pipelines:
https://docs.gitlab.com/ee/ci/pipelines/schedules.html

-- 
Simone Ballarin, M.Sc.

Field Application Engineer, BUGSENG (https://bugseng.com)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [XEN PATCH 1/4] automation/eclair: add support for tag pipelines
  2023-08-01 22:54   ` Stefano Stabellini
@ 2023-08-02  7:43     ` Simone Ballarin
  0 siblings, 0 replies; 13+ messages in thread
From: Simone Ballarin @ 2023-08-02  7:43 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: xen-devel, consulting, Doug Goldstein

Il 02/08/2023 00:54 Stefano Stabellini ha scritto:
> On Tue, 1 Aug 2023, Simone Ballarin wrote:
>> The ECLAIR jobs fail when triggered by tag pipelines (e.g.
>> xen-project/patchew/xen).
>> 
>> This patch extends the integration to support such pipelines.
>> 
>> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
> 
> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> Thanks for the fix! One good suggestion from Andrew would be to check
> for required variables at the beginning, rather than at the end. As it
> is now we are doing all the work just to fail at the end. It would have
> been better to fail immediately saving resources. It could be another
> patch :-)
> 

Yes, this is definitely a good idea.
I will propose a new patch.

> 
>> ---
>>  .../eclair_analysis/ECLAIR/action.settings    | 24 
>> ++++++++++++-------
>>  1 file changed, 15 insertions(+), 9 deletions(-)
>> 
>> diff --git a/automation/eclair_analysis/ECLAIR/action.settings 
>> b/automation/eclair_analysis/ECLAIR/action.settings
>> index 96426811a8..71c10d5141 100644
>> --- a/automation/eclair_analysis/ECLAIR/action.settings
>> +++ b/automation/eclair_analysis/ECLAIR/action.settings
>> @@ -41,7 +41,7 @@ github)
>>      push | workflow_dispatch)
>>          event=push
>>          # Extract the branch name from "refs/heads/<branch>"
>> -        branch="${GITHUB_REF#refs/heads/}"
>> +        ref="${GITHUB_REF#refs/heads/}"
>>          headCommitId="${GITHUB_SHA}"
>>          pushUser="${GITHUB_ACTOR}"
>>          ;;
>> @@ -75,7 +75,13 @@ gitlab)
>>          ;;
>>      push | pipeline | web)
>>          event=push
>> -        branch="${CI_COMMIT_BRANCH}"
>> +        if [ -n "${CI_COMMIT_BRANCH:-}" ]; then
>> +            ref_kind=branch
>> +            ref="${CI_COMMIT_BRANCH}"
>> +        else
>> +            ref_kind=tag
>> +            ref="${CI_COMMIT_TAG}"
>> +        fi
>>          headCommitId="${CI_COMMIT_SHA}"
>>          pushUser="${GITLAB_USER_NAME}"
>>          ;;
>> @@ -99,7 +105,7 @@ jenkins)
>>      jenkinsBotToken="${ECLAIR_BOT_TOKEN:-}"
>> 
>>      event=push
>> -    branch="${GIT_BRANCH}"
>> +    ref="${GIT_BRANCH}"
>>      headCommitId="${GIT_COMMIT}"
>>      pushUser=$(git show --pretty='format:%aN' -s)
>>      ;;
>> @@ -111,7 +117,7 @@ esac
>> 
>>  if [ "${event}" = "push" ] && [ -n "${autoPRBranch:-}" ]; then
>>      # AUTO PR Feature enabled
>> -    if ! [ "${branch}" = "${autoPRBranch}" ] ||
>> +    if ! [ "${ref}" = "${autoPRBranch}" ] ||
>>          ! [ "${repository}" = "${autoPRRepository}" ]; then
>>          event=auto_pull_request
>>      fi
>> @@ -123,17 +129,17 @@ pull_request)
>>      jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: 
>> ${pullRequestUser} wants to merge 
>> ${pullRequestHeadRepo}:${pullRequestHeadRef} (${headCommitId}) into 
>> ${pullRequestBaseRef} (${baseCommitId})"
>>      ;;
>>  push)
>> -    subDir="${branch}"
>> -    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: 
>> branch ${branch} (${headCommitId})"
>> -    badgeLabel="ECLAIR ${ANALYSIS_KIND} ${branch}${variantHeadline} 
>> #${jobId}"
>> +    subDir="${ref}"
>> +    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: 
>> ${ref_kind} ${ref} (${headCommitId})"
>> +    badgeLabel="ECLAIR ${ANALYSIS_KIND} ${ref}${variantHeadline} 
>> #${jobId}"
>>      ;;
>>  auto_pull_request)
>>      git remote remove autoPRRemote || true
>>      git remote add autoPRRemote "${autoPRRemoteUrl}"
>>      git fetch -q autoPRRemote
>> -    subDir="${branch}"
>> +    subDir="${ref}"
>>      baseCommitId=$(git merge-base "autoPRRemote/${autoPRBranch}" 
>> HEAD)
>> -    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: 
>> ${pushUser} wants to merge ${repository}:${branch} (${headCommitId}) 
>> into ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
>> +    jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}: 
>> ${pushUser} wants to merge ${repository}:${ref} (${headCommitId}) into 
>> ${autoPRRepository}/${autoPRBranch} (${baseCommitId})"
>>      ;;
>>  *)
>>      echo "Unexpected event ${event}" >&2
>> --
>> 2.34.1
>> 

-- 
Simone Ballarin, M.Sc.

Field Application Engineer, BUGSENG (https://bugseng.com)


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-08-02  7:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01  9:57 [XEN PATCH 0/4] automation/eclair: improvements to the ECLAIR integration Simone Ballarin
2023-08-01  9:57 ` [XEN PATCH 1/4] automation/eclair: add support for tag pipelines Simone Ballarin
2023-08-01 22:54   ` Stefano Stabellini
2023-08-02  7:43     ` Simone Ballarin
2023-08-01  9:57 ` [XEN PATCH 2/4] automation/eclair: add direct link to reports Simone Ballarin
2023-08-01 22:55   ` Stefano Stabellini
2023-08-01  9:57 ` [XEN PATCH 3/4] automation/eclair: add scheduled pipelines Simone Ballarin
2023-08-01 22:55   ` Stefano Stabellini
2023-08-02  0:05     ` Marek Marczykowski-Górecki
2023-08-02  0:08       ` Stefano Stabellini
2023-08-02  7:39         ` Simone Ballarin
2023-08-01  9:57 ` [XEN PATCH 4/4] automation/eclair: avoid failure in case of missing merge point Simone Ballarin
2023-08-01 22:55   ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.