Message ID | c07f1474bc4a46fbc969b02bbd1b95f88a872acc.1690881495.git.simone.ballarin@bugseng.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | automation/eclair: improvements to the ECLAIR integration | expand |
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 >
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 ;; *)
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(-)