CircleCI-Public / CircleCI-Public/circleci-cli

orb validate rejects parameter expressions in fields with regex value-pattern validation

Open
#1,202 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
459
Forks
255
Avg merge
1d 4h
Merged PRs (30d)
59

Description

## Summary

`circleci orb validate` (CLI 0.1.34950) rejects valid orb authoring patterns that put a `<< parameters.X >>` placeholder into a string field whose schema has a `pattern:` (regex) value check. The validator runs the regex against the literal placeholder string instead of deferring it until after parameter substitution. Integer parameters work fine because their schema skips the pattern step.

## Reproducer

[orb-tools/pack failure on cypress-io/circleci-orb#577](https://app.circleci.com/pipelines/gh/cypress-io/circleci-orb/2179/workflows/ba990d9c-bf5e-4b70-a3bd-0bc5e355881d) — minimal repro is a `run` step with both keys threaded from parameters:

```yaml
parameters:
max-auto-reruns:
type: integer
default: 0
auto-rerun-delay:
type: string
default: "0s"
steps:
- run:
command: << parameters.cypress-command >>
max_auto_reruns: << parameters.max-auto-reruns >> # passes
auto_rerun_delay: << parameters.auto-rerun-delay >> # FAILS
```

## Failure

```
[#/commands/run-tests/steps/1/run/auto_rerun_delay]
string [<< parameters.auto-rerun-delay >>]
does not match pattern ^((10|[1-9])m|([1-9][0-9]*)s)$
```

The cascading errors above this line ("extraneous key [run] is not permitted", "expected type: String, found: Mapping") are the validator's confused fallback after the run-step subschema fails to match — the root cause is the single `auto_rerun_delay` regex check.

## Expected behavior

Either:
- Defer regex/pattern checks until after parameter substitution, OR
- Recognize `<< parameters.X >>` (and other [parameter expression syntax](https://circleci.com/docs/reusing-config/#using-the-parameters-declaration)) as a valid placeholder for any string field with a `pattern:` constraint.

The existing integer handling (passes `<< parameters.max-auto-reruns >>` cleanly when the field is typed `integer`) is the right precedent.

## Workaround

Drop the parameter and hardcode the value in the orb, or omit it and rely on the runtime default. This is what cypress-io/circleci-orb#577 ended up doing.

## Affects

- CircleCI CLI 0.1.34950 (latest at filing)
- Any orb author who wants to expose a parameter for a string field that has `pattern:` validation in the orb schema (`auto_rerun_delay`, possibly other recently-added timing/duration fields).

## Environment

- macOS 15.4 (Darwin 25.4.0)
- `circleci version` → `0.1.34950+8ff907b (homebrew)`

Contributor guide

Open the contributing guide

Research direction

Start at the `circleci orb validate` entry point and reproduce the YAML example with a string parameter in the `auto_rerun_delay` pattern-validated field. Trace the pattern validation and parameter-expression handling; done means valid placeholders are accepted while literal values that fail the regex remain rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ci-cd, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.