screwdriver icon indicating copy to clipboard operation
screwdriver copied to clipboard

Bug that allows builds to be started on non-existent stages

Open yakanechi opened this issue 11 months ago • 1 comments

What happened: There is no error, e.g. with validator, even if there is a job with a non-existent stage specified as requires.

Therefore, the build can be started. However, no jobs are displayed in the UI.

Image

What you expected to happen: Errors occur in jobs where a non-existent stage is specified in validator (config-parser).

How to reproduce it: https://cd.screwdriver.cd/pipelines/15710/events/830613

jobs:
  ci-deploy:
    requires: []
  ci-test:
    requires: [ci-deploy]
  ci-certify:
    requires: [ci-test]
  triggered-by-stage:
    requires: [~stage@integration2] # <- Caused by

stages:
  integration:
    requires: [~commit]
    jobs: [ci-deploy, ci-test, ci-certify]
    description: "This stage will deploy the latest application to the CI environment and certify it after the tests have passed."

yakanechi avatar May 12 '25 06:05 yakanechi

@yakanechi It looks like the validator does not validate that any of the requires jobs exist:

jobs:
    foo:
        requires: [bar]

For remote join jobs, I think it is ok not validating that those jobs exist; however, the validator should be updated to verify that any local jobs/stages referenced within the configuration exist. You should be able to use the existing code that the pipeline stages uses for validating the jobs array configuration.

minghay avatar May 21 '25 00:05 minghay