Skip to content

Adds a few examples as a ruleset scenario, with example names - #1462

Open
colindean wants to merge 1 commit into
go-vela:mainfrom
colindean:scenario-test
Open

Adds a few examples as a ruleset scenario, with example names#1462
colindean wants to merge 1 commit into
go-vela:mainfrom
colindean:scenario-test

Conversation

@colindean

Copy link
Copy Markdown
Contributor

I ran into a situation wherein

ruleset:
  event: [push, tag]
  branch: [main]

which expands to

ruleset:
  if:
    branch: [main]
    event: [push, tag]
    operator: and
    matcher: filepath

was behaving unexpectedly.

I expected this step to run on any tag, but it was only running when a tagged commit is on the main branch, or the tag event from GitHub indicates that the ref came from the main branch. This caused a critical step to miss when someone tried to tag for release a commit on a hotfix branch, not main, a scenario we want to allow.

This "scenario" testing pattern can show this setup to be false while producing some test-based documention of what the user shouldn't do to try to fix it.

I also added a name field to the test examples, because the number only wasn't very useful.

@colindean
colindean requested a review from a team as a code owner May 19, 2026 18:02
I ran into a situation wherein

```yaml
ruleset:
  event: [push, tag]
  branch: [main]
```

which expands to

```yaml
ruleset:
  if:
    branch: [main]
    event: [push, tag]
    operator: and
    matcher: filepath
```

was behaving unexpectedly.

I expected this step to run on _any_ tag, but it was only running when
a tagged commit is on the main branch, or the tag event from GitHub
indicates that the ref came from the main branch. This caused a critical
step to miss when someone tried to tag for release a commit on a hotfix
branch, not main, a scenario we want to allow.

This "scenario" testing pattern can show this setup to be false while
producing some test-based documention of what the user shouldn't do to
try to fix it.

I also added a name field to the test examples, because the number only
wasn't very useful.

Also, add eval scenario that passes the (event:push&&branch:main)||event:tag.

@ecrupper suggested and tested this, and the real test here confirms it!

Signed-off-by: Colin Dean <colin.dean@target.com>
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.

1 participant