Commit 2bb1fdfc 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 efdce52e
Pipeline #3569 passed with stage
in 3 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
......@@ -325,6 +333,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
......@@ -370,6 +379,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
......@@ -378,6 +388,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
......@@ -395,6 +406,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
......@@ -403,6 +415,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
......@@ -417,7 +430,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
......@@ -458,6 +471,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
......@@ -478,6 +492,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
......@@ -500,7 +515,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
......@@ -553,6 +568,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