automation: Add ECLAIR pipelines

Add two pipelines that analyze an ARM64 and a X86_64 build with the
ECLAIR static analyzer on the guidelines contained in Set1.

The analysis configuration is stored in automation/eclair_analysis.

All commits on the xen-project/xen:staging branch will be analyzed
and their artifacts will be stored indefinitely; the integration will
report differential information with respect to the previous analysis.

All commits on other branches or repositories will be analyzed and
only the last ten artifacts will be kept; the integration will report
differential information with respect to the analysis done on the common
ancestor with xen-project/xen:staging (if available).

Currently the pipeline variable ENABLE_ECLAIR_BOT is set to "n".
Doing so disables the generation of comments with the analysis summary
on the commit threads. The variable can be set to "y" if the a masked
variable named ECLAIR_BOT_TOKEN is set with the impersonation token of
an account with enough privileges to write on all repositories.

Additionaly any repository should be able to read a masked variable
named WTOKEN with the token provided by BUGSENG.

The analysis fails if it contains violations of guidelines tagged as
clean:added. The list of clean guidelines are maintained in
automation/eclair_analysis/ECLAIR/tagging.ecl.

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Simone Ballarin authored and Stefano Stabellini committed 2023-07-26 15:11:55 -07:00
1 parent 5b251cbca0
commit 9336df4a3e
4 files changed
+75

No files matched your search

+2
View File
@@ -1,7 +1,9 @@
stages: stages:
- analyze
- build - build
- test - test
include: include:
- 'automation/gitlab-ci/analyze.yaml'
- 'automation/gitlab-ci/build.yaml' - 'automation/gitlab-ci/build.yaml'
- 'automation/gitlab-ci/test.yaml' - 'automation/gitlab-ci/test.yaml'
+38
View File
@@ -0,0 +1,38 @@
.eclair-analysis:
stage: analyze
tags:
- eclair-analysis
variables:
ECLAIR_OUTPUT_DIR: "ECLAIR_out"
ANALYSIS_KIND: "normal"
ENABLE_ECLAIR_BOT: "n"
AUTO_PR_BRANCH: "staging"
AUTO_PR_REPOSITORY: "xen-project/xen"
artifacts:
when: always
paths:
- "${ECLAIR_OUTPUT_DIR}/*.log"
- "${ECLAIR_OUTPUT_DIR}/*.txt"
- '*.log'
reports:
codequality: gl-code-quality-report.json
eclair-x86_64:
extends: .eclair-analysis
variables:
LOGFILE: "eclair-x86_64.log"
VARIANT: "X86_64"
RULESET: "Set1"
script:
- ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
allow_failure: true
eclair-ARM64:
extends: .eclair-analysis
variables:
LOGFILE: "eclair-ARM64.log"
VARIANT: "ARM64"
RULESET: "Set1"
script:
- ./automation/scripts/eclair 2>&1 | tee "${LOGFILE}"
allow_failure: true
+1
View File
@@ -11,6 +11,7 @@
- '*.log' - '*.log'
- '*/*.log' - '*/*.log'
when: always when: always
needs: []
except: except:
- master - master
- smoke - smoke
+34
View File
@@ -0,0 +1,34 @@
#!/bin/sh -eu
ECLAIR_ANALYSIS_DIR=automation/eclair_analysis
ECLAIR_DIR="${ECLAIR_ANALYSIS_DIR}/ECLAIR"
ECLAIR_OUTPUT_DIR=$(realpath "${ECLAIR_OUTPUT_DIR}")
if [ -z "${WTOKEN:-}" ]; then
echo "Failure: the WTOKEN variable is not defined." >&2
exit 1
fi
"${ECLAIR_ANALYSIS_DIR}/prepare.sh" "${VARIANT}"
ex=0
"${ECLAIR_DIR}/analyze.sh" "${VARIANT}" "${RULESET}" || ex=$?
"${ECLAIR_DIR}/action_log.sh" ANALYSIS_LOG \
"ECLAIR analysis log" \
"${ECLAIR_OUTPUT_DIR}/ANALYSIS.log" \
"${ex}"
"${ECLAIR_DIR}/action_log.sh" REPORT_LOG \
"ECLAIR report log" \
"${ECLAIR_OUTPUT_DIR}/REPORT.log" \
"${ex}"
[ "${ex}" = 0 ] || exit "${ex}"
# Fail in case of new reports
"${ECLAIR_DIR}/action_clean_added.sh" "${ECLAIR_OUTPUT_DIR}" || ex=$?
"${ECLAIR_DIR}/action_log.sh" DIFF_CHECK_LOG \
"ECLAIR diff check" \
"${ECLAIR_OUTPUT_DIR}/clean_added.log" \
"${ex}"
"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
[ "${ex}" = 0 ] || exit "${ex}"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.