Skip to content

Step without commands passes validation, but fails API upload #68

@toothbrush

Description

@toothbrush

I ran into an issue when my build pipeline accidentally included a named step that lacked a command or other body. I whittled it down to this MWE:

# .buildkite/pipeline.yml
---
steps:
  - name: foo

I use buildkite-signed-pipeline, and what it shows me is the following:

~~~ Running commands
$ trap 'kill -- $$' INT TERM QUIT; buildkite-signed-pipeline upload
2023/10/31 02:19:03 Using secret from AWS SM arn:aws:secretsmanager:us-east-2:123:secret:/buildkite-agent/non-production/signed_pipeline-xyz
2023/10/31 02:19:03 $ buildkite-agent pipeline upload --dry-run
2023-10-31 02:19:03 INFO   Searching for pipeline config...
2023-10-31 02:19:03 INFO   Found config file ".buildkite/pipeline.yml"
2023-10-31 02:19:03 INFO   Updating BUILDKITE_COMMIT to "d34db33f"
2023-10-31 02:19:03 INFO   Reading pipeline config from STDIN
2023-10-31 02:19:04 ERROR  Unrecoverable error, skipping retries
2023-10-31 02:19:04 FATAL  Failed to upload and process pipeline: Pipeline upload rejected: Step is missing a type `{"name":"foo"}`
2023/10/31 02:19:04 exit status 1

I thought i'd be clever and introduce a JSON schema validation step using the jv tool, however it seems that your JSON schema doesn't prohibit the situation i describe:

$ jv -output detailed https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json ./.buildkite/pipeline.yml
{
  "valid": true
}

Is this behaviour expected? I would think the JSON schema should reject a pipeline the API will reject.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions