Skip to content

Eliminate using `allowed_when` and `allow_keys`

Summary

I came across this when working on workflow:rules:auto_cancel (#436467 - closed).

Problem: Entry::Rules is shared between the Workflow and Processable entries.

Normally, we support only the if, changes, exists, when, and variables keys in workflow:rules. Yet, we accidentally allow start_in, allow_failure, and needs. And there may be some CI configs using this. Even though they don't affect the pipeline in any way, we would break the CI configs if we start disallowing these keys.

Run this and you'll see it works;

workflow:
  rules:
    - if: $xyz != 'abc'
      allow_failure: true # This is a job-only keyword. We shouldn't accept this here.
      when: always

test:
  stage: test
  script: exit 0

Proposal

As we use a different class for the Include entry (Entry::Include::Rules), we can also create a new one for Workflow (Entry::Workflow::Rules).

  • Eliminate using allowed_when and allow_keys.
Edited by Laura Montemayor