Skip to content

fix(craft): use regex pattern for binary artifact matching#230

Merged
BYK merged 1 commit intomainfrom
fix/craft-artifact-pattern
Feb 11, 2026
Merged

fix(craft): use regex pattern for binary artifact matching#230
BYK merged 1 commit intomainfrom
fix/craft-artifact-pattern

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 11, 2026

Summary

Fixes the broken curl install (curl https://cli.sentry.dev/install | bash) which 404s because 0.9.0 shipped without platform binaries.

Root Cause

Craft's patternToRegexp() treats plain strings as exact matches, escaping * to \*. The pattern 'sentry-*' in .craft.yml became /^sentry\-\*$/ — matching only the literal string "sentry-*", not actual artifact names like sentry-linux-x64.

Only gh-pages and npm-package (exact name matches) were downloaded and uploaded to the GitHub release. All 5 platform binaries were silently skipped.

Fix

Use Craft's regex syntax ('/^sentry-.*$/' with enclosing slashes) so the pattern is parsed as an actual regex.

This was introduced in #215 when migrating from requireNames (which used proper regex /^sentry-.+$/) to the new artifactProvider config.

Craft's patternToRegexp() treats plain strings as exact matches, escaping
special characters like *. The pattern 'sentry-*' was being converted to
/^sentry\-\*$/ which only matches the literal string 'sentry-*', not
artifact names like 'sentry-linux-x64' or 'sentry-darwin-arm64'.

This caused the 0.9.0 release to ship without any platform binaries —
only gh-pages and npm-package (exact name matches) were uploaded.

Use Craft's regex syntax ('/^sentry-.*$/') so the pattern is parsed as
an actual regex that matches all sentry-prefixed artifacts.
@github-actions
Copy link
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Cli

  • Add setup command for shell integration by BYK in #213
  • Add plural command aliases for list commands by betegon in #209

Other

  • (formatters) Display span duration in span tree by betegon in #219
  • (log) Add view command to display log entry details by betegon in #212
  • (repo) Add repo list command by betegon in #222
  • (setup) Auto-install Claude Code agent skill during setup by BYK in #216
  • (trace) Add trace list and view commands by betegon in #218

Bug Fixes 🐛

Upgrade

  • Handle EPERM in isProcessRunning for cross-user locks by BYK in #211
  • Replace curl pipe with direct binary download by BYK in #208

Other

  • (craft) Use regex pattern for binary artifact matching by BYK in #230
  • (deps) Move runtime dependencies to devDependencies by BYK in #225

Documentation 📚

  • (log) Add documentation for sentry log view command by betegon in #214
  • Add documentation for log command by betegon in #210

Internal Changes 🔧

Ci

  • Auto-commit SKILL.md when stale by betegon in #224
  • Remove merge-artifacts job with Craft 2.21.1 by BYK in #215

Other

  • (project) Replace --org flag with org/project positional by betegon in #223
  • (setup) Unify binary placement via setup --install by BYK in #217
  • Rename CI workflow to Build and fix artifact filter by BYK in #229
  • Handle fork PRs in SKILL.md auto-commit by BYK in #227
  • Enable minify for standalone binaries by BYK in #220

Other


🤖 This preview updates automatically when you update the PR.

@BYK BYK merged commit 41bd46a into main Feb 11, 2026
18 checks passed
@BYK BYK deleted the fix/craft-artifact-pattern branch February 11, 2026 00:34
BYK added a commit to getsentry/craft that referenced this pull request Feb 11, 2026
…terns match

patternToRegexp() silently escaped glob characters (* and ?), treating
"sentry-*" as an exact match for the literal string "sentry-*" instead
of matching "sentry-linux-x64" etc. This caused getsentry/cli#230 where
a release shipped without platform binaries.

Add first-class glob support: * maps to .* and ? maps to . in regex.
Plain strings and /regex/ syntax remain unchanged.

Add validation in doListArtifactsWithFilters() that every configured
workflow pattern matched at least one workflow run, and every artifact
pattern matched at least one artifact. This catches misconfigurations
early with clear error messages listing available names, instead of
letting them surface as confusing per-target failures.

Add a belt-and-suspenders check in publishMain() that errors when
artifact filters are configured but zero artifacts are found.
BYK added a commit to getsentry/craft that referenced this pull request Feb 11, 2026
…terns match (#748)

## Summary

Fixes a class of silent misconfiguration bugs in artifact pattern
matching, motivated by
[getsentry/cli#230](getsentry/cli#230) where
`'sentry-*'` in `.craft.yml` was silently treated as an exact match for
the literal string `"sentry-*"` instead of matching `"sentry-linux-x64"`
etc.

### Changes

**Glob pattern support** (`src/utils/filters.ts`):
- `patternToRegexp()` now supports glob wildcards: `*` maps to `.*`, `?`
maps to `.` in regex
- Plain strings and `/regex/` syntax remain unchanged
- New `globToRegex()` helper function

**All-patterns-must-match validation**
(`src/artifact_providers/github.ts`):
- New `validateAllPatternsMatched()` method ensures every configured
workflow pattern matched at least one workflow run, and every artifact
pattern matched at least one artifact
- Runs after the existing retry/polling loop succeeds — "wait for CI"
behavior is preserved
- Error messages include available workflow/artifact names for easy
debugging
- Reports all mismatches at once

**Publish-level safeguard** (`src/commands/publish.ts`):
- When `artifactProvider.config.artifacts` is set but zero artifacts are
found, `reportError()` stops the publish early instead of proceeding to
targets that will individually fail with confusing messages

### Backward Compatibility

- Plain strings without `*` or `?`: behavior unchanged (exact match)
- `/regex/` syntax: behavior unchanged
- Strings with `*` or `?`: previously silently wrong (escaped the
chars), now correctly treated as globs — this is a bugfix
- Legacy SHA-based artifact lookup: completely unaffected

Refs: getsentry/cli#230
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