GitLab CI: Add plumbing for merge request feedback

Install the GitLb CLI in the Commit Check job and add warnings.
This commit is contained in:
Gerald Combs 2023-10-31 16:54:44 +01:00
parent 4cf6568b2e
commit fa99fe81cc
1 changed files with 35 additions and 3 deletions

View File

@ -649,12 +649,44 @@ Commit Check:
extends: .build-ubuntu
rules: !reference [.if-merge-request]
script:
- (cd /tmp ; curl -JLO https://gitlab.com/gitlab-org/cli/-/releases/v1.34.0/downloads/glab_1.34.0_Linux_x86_64.deb)
- dpkg --install /tmp/glab_1.34.0_Linux_x86_64.deb
- glab auth status
- if [[ $NUM_COMMITS > 1 ]] ; then glab mr note $CI_MERGE_REQUEST_IID --unique --message " This merge request has multiple commits." ; fi
# build-ubuntu puts us in `build`.
- cd ..
- git status
- bash ./tools/pre-commit "${CI_COMMIT_SHA}~$NUM_COMMITS"
- tools/validate-commit.py
- python3 tools/checklicenses.py
- PC_EXIT_CODE=0
- ANALYSIS_MESSAGE=$( ./tools/pre-commit "${CI_COMMIT_SHA}~$NUM_COMMITS" || PC_EXIT_CODE=1 )
- >
if [ -n "$ANALYSIS_MESSAGE" ] ; then
glab mr note $CI_MERGE_REQUEST_IID --unique --message "Pre-commit check:
~~~
$ANALYSIS_MESSAGE
~~~
"
fi
- VC_EXIT_CODE=0
- ANALYSIS_MESSAGE=$( tools/validate-commit.py || VC_EXIT_CODE=1 )
- >
if [[ $VC_EXIT_CODE != 0 ]] ; then
glab mr note $CI_MERGE_REQUEST_IID --unique --message "Commit validation:
~~~
$ANALYSIS_MESSAGE
~~~
"
fi
- LC_EXIT_CODE=0
- ANALYSIS_MESSAGE=$( python3 tools/checklicenses.py || LC_EXIT_CODE=1 )
- >
if [[ $LC_EXIT_CODE != 0 ]] ; then
glab mr note $CI_MERGE_REQUEST_IID --unique --message "License check:
~~~
$ANALYSIS_MESSAGE
~~~
"
fi
- exit $(( PC_EXIT_CODE || VC_EXIT_CODE || LC_EXIT_CODE ))
Ubuntu GCC Build:
extends: .build-ubuntu