fix(gitlab-ci): DVPS-388: give RAML build jobs rules so MR pipelines can publish
Refs: DVPS-388
Problem
publish-801-nuget and publish-705-nuget declare rules, so they are present in merge request pipelines. build-801-raml and build-705-raml declared none, so the implicit only: [branches, tags] kept them out. An MR pipeline therefore offered a manual publish button with no build behind it, and pressing it could only fail — no out_raml2/, no report, nothing to pack.
Seen in thor/schemas/r1.raml: job 4818892 (MR 1022, pipeline 970443) failed with an empty log and exit code 1.
Fix
1. Build jobs mirror the rules of their own publish job. This is the shape the 447 line in raml-multi-target-before-cid-ci.yml already uses, and where publishing from an MR pipeline works (r1.raml MR 1023, pipeline 970562, publish job 4819285 succeeded).
2. Guard the report read with || true. The publish scripts do
expected=$(sed -n 's/^EXPECTED=//p' raml-build-report-801.txt 2>/dev/null)
and the runner executes the script under set -e. With no report present the command substitution exits non-zero and the job dies on that very line — before the WARNING: no build report found and FATAL: no .nuspec to publish branches written to explain the situation can print anything. That is the empty log in 4818892. Applied to all four publish scripts across both templates.
Verification
ci lint with dry_run against thor/schemas/r1.raml, including this branch — valid in both contexts:
| ref | build-801-raml | build-705-raml | publish-801-nuget | publish-705-nuget |
|---|---|---|---|---|
feat/UIE-483 (branch / MR) |
on_success | on_success | manual | manual |
master (default) |
on_success | on_success | on_success | on_success |
Default-branch behaviour is unchanged; the MR pipeline now has a build stage behind its publish buttons.
Guard behaviour, reproduced locally:
$ bash -c 'set -eo pipefail; expected=$(sed -n "s/^EXPECTED=//p" /nonexistent.txt 2>/dev/null); echo "unreachable"'
# no output, exit code 1 <- what job 4818892 did
$ bash -c 'set -eo pipefail; expected=$(sed -n "s/^EXPECTED=//p" /nonexistent.txt 2>/dev/null || true); echo "reached, expected=[$expected]"'
reached, expected=[] # exit code 0
Notes
-
raml-browser-ui-ci.ymlneeds no change of its own: it includes this template and inherits both build jobs, while its own 447 jobs already carryrules. Itspublish-801-npm-rc/publish-705-npm-rcare fixed by the same change. -
needs: … optional: truefrom DVPS-353 is kept — dropping it invalidated MR pipelines outright. - Trade-off: a push to a branch with an open MR now runs the build twice, once in the branch pipeline and once in the MR pipeline. The 447 line already lives with exactly that.
-
Jobs/raml-ci.ymlandJobs/raml2-ci.ymlcarry the same skew, but a code search finds no project including them — left untouched.