Skip to content

Conversation

@DevanshMathur19
Copy link
Collaborator

@DevanshMathur19 DevanshMathur19 commented Aug 1, 2025

Enhanced PLUGIN_STRIP_PREFIX with Glob-Aware Wildcard Support

This PR enhances the PLUGIN_STRIP_PREFIX functionality by adding wildcard pattern support, allowing dynamic path stripping without relying on shell scripting.


Key Features

  • Wildcard Patterns: Supports *, **, and ? for flexible path matching

  • Backward Compatible: Existing literal path prefixes continue to work as-is

  • Robust Validation: Comprehensive checks ensure invalid patterns are rejected gracefully

  • Added Unit Tests to test the working for all types of glob paths.


🔧 Wildcard Syntax

Wildcard Description Regex Equivalent
* Matches exactly one path segment [^/]+
** Matches zero or more segments .*
? Matches exactly one character [^/]

Testing Link: url
For the above testing correct directories were created:
Screenshot 2025-08-11 at 2 22 05 PM
Screenshot 2025-08-11 at 2 22 22 PM
Screenshot 2025-08-11 at 2 22 53 PM

Copy link
Member

@Ompragash Ompragash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add tests for windows/backslash inputs with validation. add a test that mimics
    Exec() validation on windows-style patterns ensuring normalization/anchoring works as intended

  • update readme to show wildcard examples and clarify trailing / meaning

  • add a log to show what would be stripped in dryrun mode

  • also log once when no path matches the strip pattern

@Ompragash Ompragash merged commit dfb0035 into drone-plugins:master Sep 2, 2025
6 checks passed
@silverwind
Copy link

silverwind commented Sep 2, 2025

This breaks existing use with relative paths like foo/ which fail with strip_prefix must start with '/'.

@Ompragash
Copy link
Member

Thanks, @silverwind, for pointing this out! These changes have been reverted, and they'll be fixed in the next iteration.

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.

3 participants