Message ID | alpine.DEB.2.22.394.2408011500280.114241@ubuntu-linux-20-04-desktop (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | automation: fix eclair scanning for merge requests | expand |
On 2024-08-02 00:06, Stefano Stabellini wrote: > The ECLAIR jobs part of the Gitlab CI pipeline fail reliably when the > pipeline is started from a merge request. This is the error: > > Unexpected event pull_request > > The error is a consequence of action.settings setting > event=pull_request > for merge_request_event. Given that we don't need any special behavior > from ECLAIR for merge requests, just run the regular scan, change > action.settings to set event=push for merge_request_event (same as for > pipeline triggered by git push). > According to my analysis, the error stems from the fact that automation/scripts/eclair unconditionally calls action_push.sh, which is not designed to handle merge requests (that would be action_pull_request.sh). One approach, that needs to be tested, could be to execute that second script based on the value of ${CI_PIPELINE_SOURCE}. The main difference the approach taken in this patch is that the analysis results will be relative to the nearest merge point with the staging tree. If that's not something that is desired, then this approach looks good to me. > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> > > --- > Example of a failure: > https://gitlab.com/xen-project/hardware/xen/-/jobs/7486162928 > > Example of a success with this patch applies: > https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines/1397672866 > > diff --git a/automation/eclair_analysis/ECLAIR/action.settings > b/automation/eclair_analysis/ECLAIR/action.settings > index 1577368b61..1bfb22b1c1 100644 > --- a/automation/eclair_analysis/ECLAIR/action.settings > +++ b/automation/eclair_analysis/ECLAIR/action.settings > @@ -64,14 +64,11 @@ gitlab) > > case "${CI_PIPELINE_SOURCE}" in > merge_request_event) > - event=pull_request > - pullRequestId="${CI_MERGE_REQUEST_IID}" > - pullRequestHeadRef="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" > - pullRequestHeadRepo="${CI_MERGE_REQUEST_SOURCE_PROJECT_PATH}" > - pullRequestBaseRef="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" > - pullRequestUser="${GITLAB_USER_LOGIN}" > + event=push > + ref_kind=branch > + ref="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" > headCommitId="${CI_COMMIT_SHA}" > - baseCommitId="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" > + pushUser="${GITLAB_USER_NAME}" > ;; > push | pipeline | web | schedule) > event=push
On Sat, 3 Aug 2024, Nicola Vetrini wrote: > On 2024-08-02 00:06, Stefano Stabellini wrote: > > The ECLAIR jobs part of the Gitlab CI pipeline fail reliably when the > > pipeline is started from a merge request. This is the error: > > > > Unexpected event pull_request > > > > The error is a consequence of action.settings setting event=pull_request > > for merge_request_event. Given that we don't need any special behavior > > from ECLAIR for merge requests, just run the regular scan, change > > action.settings to set event=push for merge_request_event (same as for > > pipeline triggered by git push). > > > > According to my analysis, the error stems from the fact that > automation/scripts/eclair unconditionally calls action_push.sh, which is not > designed to handle merge requests (that would be action_pull_request.sh). One > approach, that needs to be tested, could be to execute that second script > based on the value of ${CI_PIPELINE_SOURCE}. > > The main difference the approach taken in this patch is that the analysis > results will be relative to the nearest merge point with the staging tree. If > that's not something that is desired, then this approach looks good to me. You are right. I tested the below and it works as expected, see: https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines/1401863307 --- From dee036081cb367862daba264e1eb84ca2505f678 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini <stefano.stabellini@amd.com> Date: Mon, 5 Aug 2024 14:24:23 -0700 Subject: [PATCH] automation: fix eclair gitlab jobs for merge requests The "eclair" script calls action_push.sh even for merge request, while instead action_pull_request.sh should be called, resulting in a job failure with this error: Unexpected event pull_request Fix the script to call action_pull_request.sh appropriately. Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> --- automation/eclair_analysis/ECLAIR/action_pull_request.sh | 2 +- automation/scripts/eclair | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 automation/eclair_analysis/ECLAIR/action_pull_request.sh diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh b/automation/eclair_analysis/ECLAIR/action_pull_request.sh old mode 100644 new mode 100755 index 68f7e6282e..812238e07f --- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh +++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh @@ -3,7 +3,7 @@ set -eu usage() { - echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2 + echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2 exit 2 } diff --git a/automation/scripts/eclair b/automation/scripts/eclair index ebcaf09b54..97d743ab53 100755 --- a/automation/scripts/eclair +++ b/automation/scripts/eclair @@ -21,5 +21,12 @@ ex=0 # Fail in case of new reports for clean guidelines "${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || ex=$? -"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" +case "${CI_PIPELINE_SOURCE}" in +merge_request_event) + "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" + ;; +push | pipeline | web | schedule) + "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" + ;; +esac [ "${ex}" = 0 ] || exit "${ex}"
On 2024-08-06 03:03, Stefano Stabellini wrote: > On Sat, 3 Aug 2024, Nicola Vetrini wrote: >> On 2024-08-02 00:06, Stefano Stabellini wrote: >> > The ECLAIR jobs part of the Gitlab CI pipeline fail reliably when the >> > pipeline is started from a merge request. This is the error: >> > >> > Unexpected event pull_request >> > >> > The error is a consequence of action.settings setting event=pull_request >> > for merge_request_event. Given that we don't need any special behavior >> > from ECLAIR for merge requests, just run the regular scan, change >> > action.settings to set event=push for merge_request_event (same as for >> > pipeline triggered by git push). >> > >> >> According to my analysis, the error stems from the fact that >> automation/scripts/eclair unconditionally calls action_push.sh, which >> is not >> designed to handle merge requests (that would be >> action_pull_request.sh). One >> approach, that needs to be tested, could be to execute that second >> script >> based on the value of ${CI_PIPELINE_SOURCE}. >> >> The main difference the approach taken in this patch is that the >> analysis >> results will be relative to the nearest merge point with the staging >> tree. If >> that's not something that is desired, then this approach looks good to >> me. > > You are right. I tested the below and it works as expected, see: > https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines/1401863307 > > Hi Stefano, the patch looks ok. Don't know whether is should be submitted again. Only one minor nit: > --- > From dee036081cb367862daba264e1eb84ca2505f678 Mon Sep 17 00:00:00 2001 > From: Stefano Stabellini <stefano.stabellini@amd.com> > Date: Mon, 5 Aug 2024 14:24:23 -0700 > Subject: [PATCH] automation: fix eclair gitlab jobs for merge requests > > The "eclair" script calls action_push.sh even for merge request, while > instead action_pull_request.sh should be called, resulting in a job > failure with this error: > > Unexpected event pull_request > > Fix the script to call action_pull_request.sh appropriately. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> > --- > automation/eclair_analysis/ECLAIR/action_pull_request.sh | 2 +- > automation/scripts/eclair | 9 ++++++++- > 2 files changed, 9 insertions(+), 2 deletions(-) > mode change 100644 => 100755 > automation/eclair_analysis/ECLAIR/action_pull_request.sh > > diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh > b/automation/eclair_analysis/ECLAIR/action_pull_request.sh > old mode 100644 > new mode 100755 > index 68f7e6282e..812238e07f > --- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh > +++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh > @@ -3,7 +3,7 @@ > set -eu > > usage() { > - echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2 > + echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2 > exit 2 > } > > diff --git a/automation/scripts/eclair b/automation/scripts/eclair > index ebcaf09b54..97d743ab53 100755 > --- a/automation/scripts/eclair > +++ b/automation/scripts/eclair > @@ -21,5 +21,12 @@ ex=0 > # Fail in case of new reports for clean guidelines > "${ECLAIR_DIR}/action_check_clean_regressions.sh" > "${ECLAIR_OUTPUT_DIR}" || ex=$? > > -"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" > +case "${CI_PIPELINE_SOURCE}" in > +merge_request_event) > + "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" > "${ECLAIR_OUTPUT_DIR}" > + ;; > +push | pipeline | web | schedule) > + "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" > + ;; > +esac here I think it's better to give an error if the event is not handled. Something similar to *) echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2 ex=1 ;; > [ "${ex}" = 0 ] || exit "${ex}"
On Tue, 6 Aug 2024, Simone Ballarin wrote: > On 2024-08-06 03:03, Stefano Stabellini wrote: > > On Sat, 3 Aug 2024, Nicola Vetrini wrote: > > > On 2024-08-02 00:06, Stefano Stabellini wrote: > > > > The ECLAIR jobs part of the Gitlab CI pipeline fail reliably when the > > > > pipeline is started from a merge request. This is the error: > > > > > > > > Unexpected event pull_request > > > > > > > > The error is a consequence of action.settings setting event=pull_request > > > > for merge_request_event. Given that we don't need any special behavior > > > > from ECLAIR for merge requests, just run the regular scan, change > > > > action.settings to set event=push for merge_request_event (same as for > > > > pipeline triggered by git push). > > > > > > > > > > According to my analysis, the error stems from the fact that > > > automation/scripts/eclair unconditionally calls action_push.sh, which is > > > not > > > designed to handle merge requests (that would be action_pull_request.sh). > > > One > > > approach, that needs to be tested, could be to execute that second script > > > based on the value of ${CI_PIPELINE_SOURCE}. > > > > > > The main difference the approach taken in this patch is that the analysis > > > results will be relative to the nearest merge point with the staging tree. > > > If > > > that's not something that is desired, then this approach looks good to me. > > > > You are right. I tested the below and it works as expected, see: > > https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines/1401863307 > > > > > > Hi Stefano, > > the patch looks ok. Don't know whether is should be submitted again. Only one > minor nit: > > > --- > > From dee036081cb367862daba264e1eb84ca2505f678 Mon Sep 17 00:00:00 2001 > > From: Stefano Stabellini <stefano.stabellini@amd.com> > > Date: Mon, 5 Aug 2024 14:24:23 -0700 > > Subject: [PATCH] automation: fix eclair gitlab jobs for merge requests > > > > The "eclair" script calls action_push.sh even for merge request, while > > instead action_pull_request.sh should be called, resulting in a job > > failure with this error: > > > > Unexpected event pull_request > > > > Fix the script to call action_pull_request.sh appropriately. > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> > > --- > > automation/eclair_analysis/ECLAIR/action_pull_request.sh | 2 +- > > automation/scripts/eclair | 9 ++++++++- > > 2 files changed, 9 insertions(+), 2 deletions(-) > > mode change 100644 => 100755 > > automation/eclair_analysis/ECLAIR/action_pull_request.sh > > > > diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh > > b/automation/eclair_analysis/ECLAIR/action_pull_request.sh > > old mode 100644 > > new mode 100755 > > index 68f7e6282e..812238e07f > > --- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh > > +++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh > > @@ -3,7 +3,7 @@ > > set -eu > > > > usage() { > > - echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2 > > + echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2 > > exit 2 > > } > > > > diff --git a/automation/scripts/eclair b/automation/scripts/eclair > > index ebcaf09b54..97d743ab53 100755 > > --- a/automation/scripts/eclair > > +++ b/automation/scripts/eclair > > @@ -21,5 +21,12 @@ ex=0 > > # Fail in case of new reports for clean guidelines > > "${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || > > ex=$? > > > > -"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" > > +case "${CI_PIPELINE_SOURCE}" in > > +merge_request_event) > > + "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" > > "${ECLAIR_OUTPUT_DIR}" > > + ;; > > +push | pipeline | web | schedule) > > + "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" > > + ;; > > +esac > > here I think it's better to give an error if the event is not handled. > Something similar to > > *) > echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2 > ex=1 > ;; Good suggestion. Here is the updated patch, please ack. --- From f49aacb3f281eca073ccdd9fd1326d79b58b7ed2 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini <stefano.stabellini@amd.com> Date: Mon, 5 Aug 2024 14:24:23 -0700 Subject: [PATCH v3] automation: fix eclair gitlab jobs for merge requests The "eclair" script calls action_push.sh even for merge request, while instead action_pull_request.sh should be called, resulting in a job failure with this error: Unexpected event pull_request Fix the script to call action_pull_request.sh appropriately. Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> --- Changes in v3: - handle unexpected ${CI_PIPELINE_SOURCE} --- .../eclair_analysis/ECLAIR/action_pull_request.sh | 2 +- automation/scripts/eclair | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) mode change 100644 => 100755 automation/eclair_analysis/ECLAIR/action_pull_request.sh diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh b/automation/eclair_analysis/ECLAIR/action_pull_request.sh old mode 100644 new mode 100755 index 68f7e6282e..812238e07f --- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh +++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh @@ -3,7 +3,7 @@ set -eu usage() { - echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2 + echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2 exit 2 } diff --git a/automation/scripts/eclair b/automation/scripts/eclair index ebcaf09b54..3ec760bab8 100755 --- a/automation/scripts/eclair +++ b/automation/scripts/eclair @@ -21,5 +21,16 @@ ex=0 # Fail in case of new reports for clean guidelines "${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || ex=$? -"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" +case "${CI_PIPELINE_SOURCE}" in +merge_request_event) + "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" + ;; +push | pipeline | web | schedule) + "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" + ;; +*) + echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2 + ex=1 + ;; +esac [ "${ex}" = 0 ] || exit "${ex}"
On 2024-08-06 20:25, Stefano Stabellini wrote: > On Tue, 6 Aug 2024, Simone Ballarin wrote: >> On 2024-08-06 03:03, Stefano Stabellini wrote: >> > On Sat, 3 Aug 2024, Nicola Vetrini wrote: >> > > On 2024-08-02 00:06, Stefano Stabellini wrote: >> > > > The ECLAIR jobs part of the Gitlab CI pipeline fail reliably when the >> > > > pipeline is started from a merge request. This is the error: >> > > > >> > > > Unexpected event pull_request >> > > > >> > > > The error is a consequence of action.settings setting event=pull_request >> > > > for merge_request_event. Given that we don't need any special behavior >> > > > from ECLAIR for merge requests, just run the regular scan, change >> > > > action.settings to set event=push for merge_request_event (same as for >> > > > pipeline triggered by git push). >> > > > >> > > >> > > According to my analysis, the error stems from the fact that >> > > automation/scripts/eclair unconditionally calls action_push.sh, which is >> > > not >> > > designed to handle merge requests (that would be action_pull_request.sh). >> > > One >> > > approach, that needs to be tested, could be to execute that second script >> > > based on the value of ${CI_PIPELINE_SOURCE}. >> > > >> > > The main difference the approach taken in this patch is that the analysis >> > > results will be relative to the nearest merge point with the staging tree. >> > > If >> > > that's not something that is desired, then this approach looks good to me. >> > >> > You are right. I tested the below and it works as expected, see: >> > https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines/1401863307 >> > >> > >> >> Hi Stefano, >> >> the patch looks ok. Don't know whether is should be submitted again. >> Only one >> minor nit: >> >> > --- >> > From dee036081cb367862daba264e1eb84ca2505f678 Mon Sep 17 00:00:00 2001 >> > From: Stefano Stabellini <stefano.stabellini@amd.com> >> > Date: Mon, 5 Aug 2024 14:24:23 -0700 >> > Subject: [PATCH] automation: fix eclair gitlab jobs for merge requests >> > >> > The "eclair" script calls action_push.sh even for merge request, while >> > instead action_pull_request.sh should be called, resulting in a job >> > failure with this error: >> > >> > Unexpected event pull_request >> > >> > Fix the script to call action_pull_request.sh appropriately. >> > >> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> >> > --- >> > automation/eclair_analysis/ECLAIR/action_pull_request.sh | 2 +- >> > automation/scripts/eclair | 9 ++++++++- >> > 2 files changed, 9 insertions(+), 2 deletions(-) >> > mode change 100644 => 100755 >> > automation/eclair_analysis/ECLAIR/action_pull_request.sh >> > >> > diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh >> > b/automation/eclair_analysis/ECLAIR/action_pull_request.sh >> > old mode 100644 >> > new mode 100755 >> > index 68f7e6282e..812238e07f >> > --- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh >> > +++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh >> > @@ -3,7 +3,7 @@ >> > set -eu >> > >> > usage() { >> > - echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2 >> > + echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2 >> > exit 2 >> > } >> > >> > diff --git a/automation/scripts/eclair b/automation/scripts/eclair >> > index ebcaf09b54..97d743ab53 100755 >> > --- a/automation/scripts/eclair >> > +++ b/automation/scripts/eclair >> > @@ -21,5 +21,12 @@ ex=0 >> > # Fail in case of new reports for clean guidelines >> > "${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || >> > ex=$? >> > >> > -"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" >> > +case "${CI_PIPELINE_SOURCE}" in >> > +merge_request_event) >> > + "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" >> > "${ECLAIR_OUTPUT_DIR}" >> > + ;; >> > +push | pipeline | web | schedule) >> > + "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" >> > + ;; >> > +esac >> >> here I think it's better to give an error if the event is not handled. >> Something similar to >> >> *) >> echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2 >> ex=1 >> ;; > > Good suggestion. Here is the updated patch, please ack. > > --- > > From f49aacb3f281eca073ccdd9fd1326d79b58b7ed2 Mon Sep 17 00:00:00 2001 > From: Stefano Stabellini <stefano.stabellini@amd.com> > Date: Mon, 5 Aug 2024 14:24:23 -0700 > Subject: [PATCH v3] automation: fix eclair gitlab jobs for merge > requests > > The "eclair" script calls action_push.sh even for merge request, while > instead action_pull_request.sh should be called, resulting in a job > failure with this error: > > Unexpected event pull_request > > Fix the script to call action_pull_request.sh appropriately. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> Reviewed-by: Simone Ballarin <simone.ballarin@bugseng.com> > --- > Changes in v3: > - handle unexpected ${CI_PIPELINE_SOURCE} > --- > .../eclair_analysis/ECLAIR/action_pull_request.sh | 2 +- > automation/scripts/eclair | 13 ++++++++++++- > 2 files changed, 13 insertions(+), 2 deletions(-) > mode change 100644 => 100755 > automation/eclair_analysis/ECLAIR/action_pull_request.sh > > diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh > b/automation/eclair_analysis/ECLAIR/action_pull_request.sh > old mode 100644 > new mode 100755 > index 68f7e6282e..812238e07f > --- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh > +++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh > @@ -3,7 +3,7 @@ > set -eu > > usage() { > - echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2 > + echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2 > exit 2 > } > > diff --git a/automation/scripts/eclair b/automation/scripts/eclair > index ebcaf09b54..3ec760bab8 100755 > --- a/automation/scripts/eclair > +++ b/automation/scripts/eclair > @@ -21,5 +21,16 @@ ex=0 > # Fail in case of new reports for clean guidelines > "${ECLAIR_DIR}/action_check_clean_regressions.sh" > "${ECLAIR_OUTPUT_DIR}" || ex=$? > > -"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" > +case "${CI_PIPELINE_SOURCE}" in > +merge_request_event) > + "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" > "${ECLAIR_OUTPUT_DIR}" > + ;; > +push | pipeline | web | schedule) > + "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}" > + ;; > +*) > + echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2 > + ex=1 > + ;; > +esac > [ "${ex}" = 0 ] || exit "${ex}"
diff --git a/automation/eclair_analysis/ECLAIR/action.settings b/automation/eclair_analysis/ECLAIR/action.settings index 1577368b61..1bfb22b1c1 100644 --- a/automation/eclair_analysis/ECLAIR/action.settings +++ b/automation/eclair_analysis/ECLAIR/action.settings @@ -64,14 +64,11 @@ gitlab) case "${CI_PIPELINE_SOURCE}" in merge_request_event) - event=pull_request - pullRequestId="${CI_MERGE_REQUEST_IID}" - pullRequestHeadRef="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" - pullRequestHeadRepo="${CI_MERGE_REQUEST_SOURCE_PROJECT_PATH}" - pullRequestBaseRef="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" - pullRequestUser="${GITLAB_USER_LOGIN}" + event=push + ref_kind=branch + ref="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" headCommitId="${CI_COMMIT_SHA}" - baseCommitId="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" + pushUser="${GITLAB_USER_NAME}" ;; push | pipeline | web | schedule) event=push
The ECLAIR jobs part of the Gitlab CI pipeline fail reliably when the pipeline is started from a merge request. This is the error: Unexpected event pull_request The error is a consequence of action.settings setting event=pull_request for merge_request_event. Given that we don't need any special behavior from ECLAIR for merge requests, just run the regular scan, change action.settings to set event=push for merge_request_event (same as for pipeline triggered by git push). Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> --- Example of a failure: https://gitlab.com/xen-project/hardware/xen/-/jobs/7486162928 Example of a success with this patch applies: https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines/1397672866