Commit 8f5331a2 authored by Ben Avison's avatar Ben Avison
Browse files

Introduce SUPPRESS_JOBS CI variable

Sometimes, a job isn't expected to pass (most often `softload_gnu`, because
certain components don't support non-Norcroft toolchains). By defining this
variable in a `.gitlab-ci.yml` file, we can force any of the jobs to be
skipped. This only applies to submodule pipelines: it is not sensible to
skip a build phase for a superproject pipeline.
parent dc064d26
Pipeline #3923 passed with stage
in 4 seconds
......@@ -16,11 +16,18 @@ function find_project_builds(build_class) {
}
}
# Subroutine to insert rules to permit a job to be suppressed.
function check_suppress(job) {
print " rules:" >> out
print " - if: '$SUPPRESS_JOBS !~ /\\b" job "\\b/'" >> out
}
# Subroutine to write softload rules for a submodule project.
function write_softload_rules(toolchain) {
print "softload" toolchain ":" >> out
print " stage: softload" >> out
print " tags: [ cross ]" >> out
check_suppress("softload" toolchain)
if (toolchain == "_gnu") {
print " variables:" >> out
print " TOOLCHAIN: GNU" >> out
......@@ -61,6 +68,7 @@ function write_build_rules(build_class) {
print build_class "_" build ":" >> out
print " stage: " build_class >> out
print " tags: [ cross ]" >> out
check_suppress(build_class "_" build)
print " script:" >> out
print " - 'curl --location --output ~/cache/common/" build ".zip -z ~/cache/common/" build ".zip \"https://gitlab.riscosopen.org/Products/" superproject "/-/jobs/artifacts/master/download?job=latest_package_tree\"'" >> out
print " - unzip -q ~/cache/common/" build ".zip && mkdir -p " projects[project]["path"] " && rm -rf " projects[project]["path"] " && ln -s " backlink " " projects[project]["path"] >> out
......@@ -340,6 +348,7 @@ BEGIN {
print "gitattributes:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("gitattributes")
print " script:" >> out
print " - >" >> out
print " function top_dir {" >> out
......@@ -385,6 +394,7 @@ BEGIN {
print "gitignore:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("gitignore")
print " script:" >> out
print " - test -f .gitignore" >> out
print " allow_failure: true" >> out
......@@ -393,6 +403,7 @@ BEGIN {
print "license:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("license")
print " script:" >> out
print " - >" >> out
print " test -f LICENSE ||" >> out
......@@ -410,6 +421,7 @@ BEGIN {
print "versionnum:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("versionnum")
print " script:" >> out
print " - test -f VersionNum" >> out
print " allow_failure: true" >> out
......@@ -418,6 +430,7 @@ BEGIN {
print "head_log:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("head_log")
print " script:" >> out
print " - >" >> out
print " git log -1 --pretty=format:%B | awk '" >> out
......@@ -432,7 +445,7 @@ BEGIN {
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
print " rules:" >> out
print " - if: $CI_MERGE_REQUEST_ID" >> out
print " - if: '$CI_MERGE_REQUEST_ID && $SUPPRESS_JOBS !~ /\\bmerge_log\\b/'" >> out
print " script:" >> out
print " - >" >> out
print " git remote show | grep target > /dev/null && git remote remove target || true;" >> out
......@@ -473,6 +486,7 @@ BEGIN {
print "makefile:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("makefile")
print " script:" >> out
print " - >" >> out
print " for f in $(find *" >> out
......@@ -493,6 +507,7 @@ BEGIN {
print "head_whitesp:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("head_whitesp")
print " script:" >> out
print " - >" >> out
print " status=0;" >> out
......@@ -515,7 +530,7 @@ BEGIN {
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
print " rules:" >> out
print " - if: $CI_MERGE_REQUEST_ID" >> out
print " - if: '$CI_MERGE_REQUEST_ID && $SUPPRESS_JOBS !~ /\\bmerge_whitesp\\b/'" >> out
print " script:" >> out
print " - >" >> out
print " git remote show | grep target > /dev/null && git remote remove target || true;" >> out
......@@ -568,6 +583,7 @@ BEGIN {
print "cppcheck:" >> out
print " stage: static_analysis" >> out
print " tags: [ cross ]" >> out
check_suppress("cppcheck")
print " script:" >> out
print " - 'curl --location --output ~/cache/common/Disc.zip -z ~/cache/common/Disc.zip \"https://gitlab.riscosopen.org/Products/Disc/-/jobs/artifacts/master/download?job=latest_package_tree\"'" >> out
print " - unzip -q ~/cache/common/Disc.zip" >> out
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment