Skip to content

feat(3486): validate that requires only reference existing stages#185

Open
yk634 wants to merge 3 commits into
masterfrom
validate-requires
Open

feat(3486): validate that requires only reference existing stages#185
yk634 wants to merge 3 commits into
masterfrom
validate-requires

Conversation

@yk634
Copy link
Copy Markdown
Contributor

@yk634 yk634 commented May 18, 2026

Context

We found that a pipeline can currently accept a workflow where requires references a stage that does not exist in the YAML. When the UI tries to render a pipeline with that invalid workflow, it can crash.

This PR was motivated by that failure mode: invalid stage references should be rejected during config parsing instead of being allowed through to later parts of the system.

Example of invalid YAML that motivated this change:

jobs:
  job1:
    image: node:18
    requires: []
    steps:
      - echo: echo job1

  job2:
    image: node:18
    requires:
      - stage@missing-stage
    steps:
      - echo: echo job2

This configurations refer to stages that are not defined in stages, but they were not previously rejected by config validation.

Objective

This PR adds validation in config-parser so that requires can only reference stages that actually exist in the pipeline definition.

The change covers both of these cases:

  • job-level requires
  • stage-level requires

It also extracts normalizeRequires into a small shared helper so requires normalization is handled consistently across the stage validation and flattening paths.

References

screwdriver-cd/screwdriver#3486

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@yk634 yk634 changed the title feat: validate that requires only reference existing stages feat(3486): validate that requires only reference existing stages May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants