-
Notifications
You must be signed in to change notification settings - Fork 302
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
Feature Request: Google Cloud Artifact Registry #1987
Comments
Thanks for the suggestion, it'd be nice to support this! Reading this page, it seems Artifact Registry supports both password-based authentication, and authentication based on their credential helper. Password-based should work already. Would it work for you? See this page for how to pass credentials to the coursier command-line. This should also work from sbt I think, and sbt also accepts those its own way. About credential helper based authentication, it seems it relies on custom URL schemes (like
(This uses |
Great I will take a look at this during the weekend. It does not look to hard to implement. Thanks for the pointers. Also, how does this feature land in sbt? I know there is this project: https://github.com/coursier/sbt-coursier |
Yup the method with credentials works fine for fetching artifacts, thanks for the pointer, we will use this until we have the proper authentication. I will see if I can implement the real deal now :). For publishing artifacts, I still need https://github.com/suprafii/sbt-google-artifact-registry, since sbt does not do preemptive checks, but that's outside of the scope of Coursier. |
I was able to get coursier to resolve the dependency with the method you suggested. Thanks a lot! Now I'm a bit stuck with integrating this into my build. Two questions: A) How do I add the library I created to my classpath? Is it only a B) How do I configure the resolver with this new protocol? csrConfiguration := {
val csr = csrConfiguration.value
csr.withResolvers(csr.resolvers ++ Vector(
???
))
} |
It ought to work with If ever it doesn't, maybe try also adding your class as |
It shouldn't be necessary to change |
Hum ok I will take a look adding:
result in:
This means it couldn't load the If I do: new coursier.cache.protocol.ArtifactregistryHandler
// class loaded
// ^ I added this println in the initializer
// res4: coursier.cache.protocol.ArtifactregistryHandler = coursier.cache.protocol.ArtifactregistryHandler@b3de1 There is probably something funny with the classloader that make this not working:
|
I built a local version of sbt/coursier/coursier shaded and I was able to add more debug logs. You are correct about the shading, it's trying to load: I changed the package name and still no luck. It looks like it's not in the classloader. I'm continuing my investigation 🕵🏻♂️ |
There is indeed something fishy with the classloader/dependency shading. As a sanity check, I added Added:
and I re-published coursier and sbt-lm-coursier. Then end result was Edit: Hum maybe because it's a java file? Edit2: Yup I only look for Scala files. This looks like a rabbit hole, I would need to shade all the dependencies. But at least I validated that there is indeed something weird with the classpath. |
I found a way to make it work. If I build the sbt launcher with my dependency, it's available in the classpath and you can download:
However, it fails at:
It's because it's trying to create a new URL without
Like we say in Quebecois: |
Almost there, I found the solution for the issue above when creating an URL with a custom protocol. The only issue pending is to figure out why I can't get the classloader to expose my |
Hey, finally, I propose what they did in scalafix where they have: https://github.com/scalacenter/sbt-scalafix/blob/1eeafe2df0c86a3cf4d90137cc3d2c00adb8b407/src/main/scala/scalafix/sbt/ScalafixPlugin.scala#L75
What do you think? Edit: Here is my game plan:
|
This can be used to add custom url handlers to coursier, so scala-steward could for example reach s3 buckets, google cloud storage or artifactregistry. See https://get-coursier.io/docs/extra.html#extra-protocols and coursier/coursier#1987
This can be used to add custom url handlers to coursier, so scala-steward could for example reach s3 buckets, google cloud storage or artifactregistry. See https://get-coursier.io/docs/extra.html#extra-protocols and coursier/coursier#1987
This can be used to add custom url handlers to coursier, so scala-steward could for example reach s3 buckets, google cloud storage or artifactregistry. See https://get-coursier.io/docs/extra.html#extra-protocols and coursier/coursier#1987
@MasseGuillaume |
To answer my own question. I just found and tested another plugin, |
Yup the crux of this plugin is here: https://github.com/abdolence/sbt-gcs-resolver/blob/master/sbt-gcs-plugin/src/main/scala/org/latestbit/sbt/gcs/GcsUrlHandlerFactory.scala#L52 It globally set a URL handler. At the time I wrote all those PR, I was unaware it was possible to solve it this way, I was trying to pass a URL handler until it reaches coursier URL resolver. It's still doable, but the global URL handler has the advantage of being available for all coursiers/sbt versions. |
More on Coursier's missing support:
It doesn't seem too difficult to update the credential parsing to support passing a configuration like the following:
Followups:
|
This can be used to add custom url handlers to coursier, so scala-steward could for example reach s3 buckets, google cloud storage or artifactregistry. See https://get-coursier.io/docs/extra.html#extra-protocols and coursier/coursier#1987
I'm moving to https://cloud.google.com/artifact-registry
There is currently a plugin that works with the Ivy resolver:
https://github.com/suprafii/sbt-google-artifact-registry
I will take a look if I'm able to implement this. Any pointers would be appreciated.
The text was updated successfully, but these errors were encountered: