automation/eclair: improvements to the ECLAIR integration
cover automation/eclair: improvements to the ECLAIR integration
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(-)
Signature · 1 line
2.34.1
PATCH 1/4 automation/eclair: add support for tag pipelines
The ECLAIR jobs fail when triggered by tag pipelines (e.g. xen-project/patchew/xen).
This patch extends the integration to support such pipelines.
--- .../eclair_analysis/ECLAIR/action.settings | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-)
automation/eclair_analysis/ECLAIR/action.settings +15 -9
@@ -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
Signature · 1 line
2.34.1
Re: [XEN PATCH 1/4] automation/eclair: add support for tag pipelines
Quoted 6 lines · Simone Ballarin
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 <[email protected]>
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 :-)
Quoted 76 lines
--- .../eclair_analysis/ECLAIR/action.settings | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-)automation/eclair_analysis/ECLAIR/action.settings +15
-9@@ -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}" >&2Signature · 1 line
2.34.1
Re: [XEN PATCH 1/4] automation/eclair: add support for tag pipelines
Il 02/08/2023 00:54 Stefano Stabellini ha scritto:
Quoted 8 lines · Simone Ballarin
Quoted 6 lines
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 <[email protected]>
Quoted 8 lines
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.
Quoted 86 lines
Quoted 86 lines
--- .../eclair_analysis/ECLAIR/action.settings | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-)automation/eclair_analysis/ECLAIR/action.settings +10
-4@@ -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)
automation/eclair_analysis/ECLAIR/action.settings +0
-2- subDir="${branch}" - jobHeadline="ECLAIR ${ANALYSIS_KIND} on repository ${repository}:branch ${branch} (${headCommitId})"
- badgeLabel="ECLAIR ${ANALYSIS_KIND} ${branch}${variantHeadline}
#${jobId}"automation/eclair_analysis/ECLAIR/action.settings +2
-0+ 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 autoPRRemoteautomation/eclair_analysis/ECLAIR/action.settings +1
-1- 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
Signature · 3 lines
Simone Ballarin, M.Sc. Field Application Engineer, BUGSENG (https://bugseng.com)
PATCH 2/4 automation/eclair: add direct link to reports
In reply to Simone BallarinThis patch adds direct links to the analysis findings in the console log.
--- .../eclair_analysis/ECLAIR/action.helpers | 84 ++++++++++++++----- 1 file changed, 65 insertions(+), 19 deletions(-)
automation/eclair_analysis/ECLAIR/action.helpers +65 -19
@@ -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 ;; *)
Signature · 1 line
2.34.1
Re: [XEN PATCH 2/4] automation/eclair: add direct link to reports
Quoted 4 lines · Simone Ballarin
This patch adds direct links to the analysis findings in the console log.
Signed-off-by Simone Ballarin <[email protected]>
Quoted 166 lines
--- .../eclair_analysis/ECLAIR/action.helpers | 84 ++++++++++++++----- 1 file changed, 65 insertions(+), 19 deletions(-)automation/eclair_analysis/ECLAIR/action.helpers +65
-19@@ -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 ;; *)Signature · 1 line
2.34.1
PATCH 3/4 automation/eclair: add scheduled pipelines
In reply to Simone BallarinThis patch introduces six new ECLAIR jobs that run only when triggered by a GitLab scheduled pipeline.
--- .../eclair_analysis/ECLAIR/action.settings | 2 +- automation/gitlab-ci/analyze.yaml | 65 +++++++++++++++++-- 2 files changed, 62 insertions(+), 5 deletions(-)
automation/eclair_analysis/ECLAIR/action.settings +1 -1
@@ -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
automation/gitlab-ci/analyze.yaml +61 -4
81 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
Quoted 46 lines · Simone Ballarin
This patch introduces six new ECLAIR jobs that run only when triggered by a GitLab scheduled pipeline.
Signed-off-by Simone Ballarin <[email protected]>--- .../eclair_analysis/ECLAIR/action.settings | 2 +- automation/gitlab-ci/analyze.yaml | 65 +++++++++++++++++-- 2 files changed, 62 insertions(+), 5 deletions(-)automation/eclair_analysis/ECLAIR/action.settings +1
-1@@ -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=branchautomation/gitlab-ci/analyze.yaml +2
-2@@ -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"
automation/gitlab-ci/analyze.yaml eclair-ARM64: · line 41
Quoted 10 lines
automation/gitlab-ci/analyze.yaml +6
-2VARIANT: "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.
Quoted 56 lines
automation/gitlab-ci/analyze.yaml +52
-0+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: trueSignature · 1 line
2.34.1
Re: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
Quoted 11 lines · Stefano Stabellini
automation/gitlab-ci/analyze.yaml eclair-ARM64: · line 41
Quoted 9 lines · Simone Ballarin
This patch introduces six new ECLAIR jobs that run only when triggered by a GitLab scheduled pipeline.
Signed-off-by Simone Ballarin <[email protected]>---
+.eclair-analysis:on-schedule:automation/gitlab-ci/analyze.yaml +3
-0+ extends: .eclair-analysis + rules: + - if: $CI_PIPELINE_SOURCE == "schedule"
Quoted 3 lines
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
Quoted 7 lines
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.
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Stefano Stabellini
Reviewed-byRe: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
Quoted 12 lines · Marek Marczykowski-Górecki
Quoted 11 lines · Stefano Stabellini
Quoted 9 lines · Simone Ballarin
This patch introduces six new ECLAIR jobs that run only when triggered by a GitLab scheduled pipeline.
Signed-off-by Simone Ballarin <[email protected]>---
+.eclair-analysis:on-schedule:automation/gitlab-ci/analyze.yaml +3
-0+ extends: .eclair-analysis + rules: + - if: $CI_PIPELINE_SOURCE == "schedule"
Quoted 6 lines
Quoted 3 lines
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.
Re: [XEN PATCH 3/4] automation/eclair: add scheduled pipelines
Il 02/08/2023 02:08 Stefano Stabellini ha scritto:
Quoted 17 lines · Marek Marczykowski-Górecki
Quoted 16 lines · Stefano Stabellini
Quoted 14 lines · Simone Ballarin
automation/gitlab-ci/analyze.yaml eclair-ARM64: · line 41
Quoted 9 lines
This patch introduces six new ECLAIR jobs that run only when triggered by a GitLab scheduled pipeline.
Signed-off-by Simone Ballarin <[email protected]>---
+.eclair-analysis:on-schedule:automation/gitlab-ci/analyze.yaml +3
-0+ 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.
Quoted 7 lines
Quoted 2 lines
No, this is pre-defined variable in gitlab:
https://docs.gitlab.com/ee/ci/variables/predefined_variables.htmlEven better! Thanks! Then no need for a comment and the patch is OK as is.
Reviewed-by Stefano Stabellini <[email protected]>
Here is a link with the instructions for creating scheduled pipelines:
https://docs.gitlab.com/ee/ci/pipelines/schedules.html
Signature · 3 lines
Simone Ballarin, M.Sc. Field Application Engineer, BUGSENG (https://bugseng.com)
PATCH 4/4 automation/eclair: avoid failure in case of missing merge point
In reply to Simone BallarinIn the context of an auto pull request, when a common merge point is not found the integration will continue the analysis without failing.
--- automation/eclair_analysis/ECLAIR/action.settings | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
automation/eclair_analysis/ECLAIR/action.settings +3 -1
@@ -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})" ;; *)
Signature · 1 line
2.34.1
Re: [XEN PATCH 4/4] automation/eclair: avoid failure in case of missing merge point
Quoted 5 lines · Simone Ballarin
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 <[email protected]>
Quoted 22 lines
--- automation/eclair_analysis/ECLAIR/action.settings | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)automation/eclair_analysis/ECLAIR/action.settings +3
-1@@ -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})" ;; *)Signature · 1 line
2.34.1