New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix registry selector flag in build command and validation for the input #832
Fix registry selector flag in build command and validation for the input #832
Conversation
Codecov Report
@@ Coverage Diff @@
## main #832 +/- ##
==========================================
- Coverage 76.34% 76.23% -0.11%
==========================================
Files 86 86
Lines 4416 4429 +13
==========================================
+ Hits 3371 3376 +5
- Misses 700 704 +4
- Partials 345 349 +4
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additions! Would you be able to add tests, verifying that the regex works as expected?
build.go
Outdated
r := regexp.MustCompile(`^(https|git)(://|@)([^/:]+)[/:]([^/:]+)/(.+).git$`) | ||
if r.MatchString(registry) { | ||
return fetchedBPs, order, errors.New("registry should be only specified as named") | ||
} | ||
|
||
registryCache, err := c.getRegistry(c.logger, registry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be some confusion on the original requirements. The flag should no longer accept a URI at all and instead only support names from the config.toml
files.
This is taken from the latest PR changes:
By default, if no configuration values are defined in the
config.toml
file, buildpacks will be registered against:
https://github.com/buildpacks/registry
. In addition, user can specify their own registries. For example:[[registries]] name="elbandito" type="github" url="https://github.com/elbandito/buildpack-registry" [[registries]] name="joe" type="github" url="https://github.com/jkutner/buildpack-registry/"
When there are multiple
registries
, the user can specify a specific registry viabuildpack-registry, -R
flag.For example:
pack register-buildpack <buildpack/image> -r elbandito
A possible solution may be to change c.getRegistry
to accept a "name" and then it can then look up the URL from the config.toml
instead of it being passed in.
Hi @supra08, just checking in. Is there anything I can clarify or you need from me/us? |
Oh hi @jromero, no there is nothing as of now. I was stuck with some university formalities so the delay. It will be good to go in a couple of days. |
4819837
to
f15c425
Compare
One of the unit tests is failing, working on it. |
8a81afe
to
90469a3
Compare
Signed-off-by: Supratik Das <rick.das08@gmail.com>
Signed-off-by: Supratik Das <rick.das08@gmail.com>
Signed-off-by: Supratik Das <rick.das08@gmail.com>
Signed-off-by: Supratik Das <rick.das08@gmail.com>
5134fa2
to
053285d
Compare
✔️ AcceptedNOTE: Errors are expected since no publically accessible image is available on the registry yet.
|
NOTE: Documentation deferred until the buildpacks registry workflow is more complete. |
A huge thanks @supra08! 👏 👏 👏 Thank you for putting in the work and coordinating with us in order to be able to 🚢 this today. |
Good job getting this over the finish line @supra08! 🥳 |
Signed-off-by: Supratik Das rick.das08@gmail.com
Summary
This PR attempts to fix #747. It replaces the
-R
flag for selecting the registry inpack build
to-r
. It also puts a validation for rejecting git/https based URLs.Documentation
Related
Resolves #747