Pipeline with stage job having stage itself in 'requires' redirects the user to 404 page
What happened:
When a stage job has stage itself in the requires, the workflow graph is generated and persisted that contains an invalid node.
When user visits the pipeline landing page, endpoints to get pipeline (/v4/pipelines/14178) and recent events (v4/pipelines/14178/events?count=5&page=1) returns http error 500. UI redirects the user to 404 page.
P.S.
Even after the screwdriver.yaml has been fixed, the endpoint to fetch events continue to return error 500 as long as the event with invalid node is part of the response.
Sample pipeline --> https://cd.screwdriver.cd/pipelines/14178 has below invalid node in the worflowgraph
{
"name": "triggering-stage"
}
What you expected to happen:
Config parser should validate the config and capture the error. API should never persist the workflow graph with invalid node in pipelines or events table in DB.
How to reproduce it: Sample pipeline --> https://cd.screwdriver.cd/pipelines/14178
screwdriver.yaml
shared:
image: node:20
steps:
- init: echo 'init'
jobs:
triggering-stage:
requires: [~pr, ~commit]
ci-deploy:
requires: [ ~stage@integration ]
ci-test:
requires: [ ci-deploy ]
ci-certify:
requires: [ ci-test-batch-1, ci-test-batch-2 ]
triggered-by-stage:
requires: [ ~stage@integration ]
stages:
integration:
requires: [triggering-stage]
jobs: [ci-deploy, ci-test, ci-certify]
description: "This stage will deploy the latest application to CI environment and certifies it after the tests are passed."