Skip to content

DVPS-353: mark publish needs as optional

Dmitrii Tolstoi requested to merge dvps-353-fix-needs-optional into master

Problem

The needs added in 38889d9 broke merge request pipelines outright. GitLab rejected them with:

'publish-801-nuget' job needs 'build-801-raml' job, but 'build-801-raml' is not in any previous stage
'publish-705-nuget' job needs 'build-705-raml' job, but 'build-705-raml' is not in any previous stage

The pipeline was created with zero jobs and reported failed. Affected runs on thor/schemas/r1.raml: 967342, 967345, 967347, 967351, 967355, 967358 — every merge request pipeline since the merge.

Cause

build-801-raml and build-705-raml declare no rules, so the implicit only: [branches, tags] applies and they are absent from merge request pipelines. The publish jobs do declare rules, which cancels the implicit only, so they are present. needs pointing at a job that is not in the pipeline invalidates the whole pipeline.

The claim in 38889d9 — that the rule pairs are consistent and optional: true is therefore unnecessary — held for branch and default-branch pipelines, which is where it was verified. It does not hold for merge request pipelines, which were not checked.

Fix

optional: true on all eight needs declarations. A missing build job now drops the dependency instead of invalidating the pipeline.

  needs:
    - job: build-801-raml
      optional: true

Verification

Pipeline Context Before this fix After
967358 merge_request_event failed, 0 jobs, yaml_errors
967373 merge_request_event manual, no yaml_errors, 2 publish jobs as manual
965378 merge_request_event, pre-DVPS-353 baseline manual, 2 publish jobs as manual matches 967373

Merge request pipelines are back to their previous shape. They remain a no-op — there is no build in them and never was — but they are valid again.

Branch pipelines are unaffected: build jobs are present there, so needs still applies and the cross-line decoupling from DVPS-353 is preserved. CI lint reports valid: true for all three templates.

Follow-up worth considering separately

Merge request pipelines contain only two manual publish jobs and no build, so they verify nothing. Giving the build jobs rules that include merge_request_event would make MR pipelines actually compile the contracts. Deliberately not bundled here, to keep this change limited to restoring validity.

Refs: DVPS-353

Merge request reports