Skip to content

Conversation

@parkuman
Copy link
Contributor

Jira

Description

Overview

This PR adds missing validations for specifying job types both within workflows: and jobs:. It also adds tests for new validations!

Users can define the job type under the jobs: section with the following format:

jobs:
  my-job:
    type: no-op

Here are the job types allowed to be specified under the jobs: type: key:

  • no-op
  • build (this is the default if type is left unspecified
  • approval
  • release

It is also possible to specify type: under the workflows: section. However, according to this ticket, we should only allow type to be specified inline in workflow config for approval jobs. This is more for backwards-compatability; and the recommendation is to put type: approval under the jobs: section like all the other job types.

Added Hovers

Two hovers were added to publicschema.json that the Red Hat Yaml Language Server will display for the user:

type: specified under workflows:

workflows:
  build-workflow:
    jobs:
      - workflow-approval-job: 
          type: approval # <---------- hover over this

When hovering over type:, the user will see:

image

type: specified under jobs:

When hovering over type: under the jobs: section, it will link to documentation and list some examples of possible values.

image

New JSON schema validation

Modified schema.json (which is what schemastore points to) to allow users to specify type under the jobs: section.

The following two forms are now valid:

  1. a job with just a type specified (no-op for example). Before it would yell at you that you need steps
  2. a job with type specified along with steps, machine, docker, etc.
    • in this scenario you could either explicitly mark a job with type: build
    • or, it is technically valid to have a type: approval with steps defined, we just ignore the steps
      • in this scenario, I have added a warning to the LSP, more that below

Go/language server based validations

user specifies a type other than approval under workflows:

workflows:
  build-workflow:
    jobs:
      - workflow-no-op-job: 
          type: no-op 

now gives the following dynamic error:

image

Validate the allowed types under the jobs: section.

Adds an error if you try to use a type that isn't valid:

image

Throw a warning if the user tries to use steps: in a job marked as approval, no-op or release

image

How to validate

Follow the steps in HACKING.md to use the changes in VScode locally.

Other info

@parkuman parkuman requested a review from a team September 25, 2025 20:11
@parkuman parkuman changed the title PIPE-5019 Handle no-op, approval, and release job types [PIPE-5019] Handle no-op, approval, and release job types Sep 25, 2025
@parkuman parkuman changed the title [PIPE-5019] Handle no-op, approval, and release job types feat: [PIPE-5019] Handle no-op, approval, and release job types Sep 25, 2025
@parkuman parkuman force-pushed the handle-new-job-types branch from f2c8bcb to a836855 Compare September 26, 2025 13:47
@parkuman parkuman merged commit 8fdb325 into main Sep 26, 2025
6 checks passed
@parkuman parkuman deleted the handle-new-job-types branch September 26, 2025 18:21
This was referenced Sep 26, 2025
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.

4 participants