RegEx validation for Step Input

We’re currently using an input step with text inputs to gather some deployment information, and often users will enter invalid values.

It would be great to associate a RegEx to a field and have the field outline turn red when an invalid value is entered.

Our validation occurs occurs in subsequent steps, and the only way we can return validation errors is by failing the build and printing an error styled annotation. This is extremely noisy for us operationally, as we have notifications set up to notify us of build failures. We want to know when a deployment fails, but we’re currently being overwhelmed with validation failures.

This sounds like a neat idea! We’ll take a look when we can.

We’ve had a go at this, with a syntax like this:

steps:
- block: "Click me!"
  fields:
  - text: Must be hexadecimal
    key: hex
    format: "[0-9a-f]+"

format must be a regular expression which will be implicitly anchored to the beginning and end of the input, and is functionally equivalent to the HTML5 pattern attribute:

Let us know if it works for you?

(It’s still deploying, but should be available in a few minutes.)

1 Like

I can’t think you enough for landing this seemingly small change. One of the pipeline’s my team administers performs input validation on some fields. Previously, we had to do it all in Bash scripts, and validation errors would result in build failures and noisy error notifications to the team.

Thanks for helping us create better user experiences!

2 Likes