Skip to content

Conversation

@parkuman
Copy link
Contributor

@parkuman parkuman commented Oct 3, 2025

Jira: https://circleci.atlassian.net/browse/PIPE-5266

Description

New job types

This PR adds support for two job types:

  • lock
  • unlock

Improved schema validation

While these job types are not explicitly explained in the docs, they are the underling job types that our serial group feature uses under the hood.

This MR also also adds improved validations for other job types that we already had:

  • approval / no-op jobs don't need any additional parameters to be valid

  • lock / unlock require a key: parameter to be specified

    my-cool-lock-job:
      type: lock
    • image
  • release jobs require a plan_name: parameter to be specified

    my-cool-release-job:
      type: release
    • image

Other changes

  • adding plan_name and key to the parser, AST, and completions
  • added job types to completions in the Go code (control + space in vscode should now give you a list of job types, YMMV is seems to work intermittently)
    image
  • added some more documentation to HACKING.md to explain the difference between our schemas and when to update which one

Implementation details

To improve the experience of editing these schema.json files, I ran the default vscode JSON auto-formatter with 4 spaces on the schema and publicschema files. This makes the diff hard to read, so this commit is where I actually add the new re-usable jobDefinition with all the new validations. I re-use this jobDefinition ref inside the jobs: section and the orbs: jobs: section.

In order to add the complex JSON schema rules, I needed to use if/then/else syntax which was introduced in JSON schema draft-07. I bumped the version of schema.json.

How to validate

Following the steps in HACKING.md to run the language server extension in VScode would be the easiest way to verify it works in your editor!

@parkuman parkuman requested a review from a team October 3, 2025 21:09
@parkuman
Copy link
Contributor Author

parkuman commented Oct 3, 2025

One thing I'm not liking is how verbose the JSON schema validations are while still somehow not being useful at all. E.g.:
image

Copy link

@stig stig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the commits adding code and the tests for that code squashed together. I'm happy for the documentation and formatting changes being separate commits.

@parkuman parkuman force-pushed the add-lock-jobs-and-improve-schema branch from bc8386c to e1af8aa Compare October 6, 2025 16:31
@parkuman
Copy link
Contributor Author

parkuman commented Oct 6, 2025

I'd like to see the commits adding code and the tests for that code squashed together. I'm happy for the documentation and formatting changes being separate commits.

@stig I have squashed relevant code change commits together with their tests

@parkuman parkuman requested a review from stig October 6, 2025 17:37
@parkuman parkuman force-pushed the add-lock-jobs-and-improve-schema branch from e1af8aa to 384021d Compare October 6, 2025 18:31
@parkuman parkuman force-pushed the add-lock-jobs-and-improve-schema branch from 384021d to 1af1dc8 Compare October 6, 2025 18:34
@parkuman parkuman merged commit e42c4d3 into main Oct 6, 2025
6 checks passed
@parkuman parkuman deleted the add-lock-jobs-and-improve-schema branch October 6, 2025 20:42
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.

5 participants