Currently I have this line in my .gitlab-ci.yml file:
if (( $coverage < $MIN_COVERAGE )) ; then echo "$coverage% of code coverage below threshold of $MIN_COVERAGE%" && exit 1 ; else exit 0 ; fi
$coverage
is the test coverage of the code, determined with pytest-cov
$MIN_COVERAGE
is a specified minimum level of test coverage which $coverage shouldn't drop below
Currently, this causes the pipeline to fail if, for instance, coverage is 70% and min_coverage is 80%. A message is also printed to the terminal: "$coverage% of code coverage below threshold of $MIN_COVERAGE%"
However, this message is only displayed in the terminal of the gitlab job, so if someone wanted to see why and by how much their pipeline failed they would need to go into the job terminal and look at the output.
Instead of having this echo to the job terminal, is there a way to get this message to output somewhere on the gitlab UI?
glab mr comment
, can you help me out? It should be in the documentation repo, right? – Tradespeople