carvel-dev / carvel-dev/vendir
Add post sync ability to rename files
- Dominant language
- Go
- Stars
- 399
- Forks
- 73
- Avg merge
- 2h 53m
- Merged PRs (30d)
- 2
Description
**Describe the problem/challenge you have**
Sometimes syncs include files that have versions in the names of the files, which may be undesirable. If I sync a `githubRelease` with `sample-v1.2.3-linux-amd64.tar.gz` and extract a file named `sample-v1.2.3`, I may want to rename this to just `sample` so my binary matches what I had previously.
**Describe the solution you'd like**
In the spec, I'd like to see an option for renaming files after they are downloaded, and use wildcards/grouping for the source
```
renamePaths:
- from: sample-v*
to: sample
```
This would take all files named `sample-v*` and rename it to `sample`. If more than one file matches, the behavior is indeterministic
**Anything else you would like to add:**
For flexibility, the `from:` should support globs and regex so the user could craft it to match what is needed. In addition, you may want to include group substitution in the `to:` so you could replace with a match in the regex.
---
Vote on this request
This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.
👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"
We are also happy to receive and review Pull Requests if you want to help working on this issue.
Contributor guide
Research direction
Start with the spec and the githubRelease sync configuration to trace where downloaded paths are finalized. Define how renamePaths should handle glob and regex matching, multiple matches, and group substitution, then add coverage for the requested sample-v* to sample behavior and confirm renaming occurs after download.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100