it might not be a pants thing, but I've noticed I ...
# general
a
it might not be a pants thing, but I've noticed I can't push docker images using
./pants publish
to a google artifact registry, but I can with
docker push
1
Copy code
./pants publish ::
23:12:37.52 [INFO] Completed: Building docker image australia-southeast1-docker.pkg.dev/coneheads-wgtn/containers/web:latest
23:12:37.52 [INFO] Built docker image: australia-southeast1-docker.pkg.dev/coneheads-wgtn/containers/web:latest
The push refers to repository [australia-southeast1-docker.pkg.dev/coneheads-wgtn/containers/web]
6ea10f7d4ca8: Preparing 
22ada191c158: Preparing 
53db6fbe920f: Preparing 
315bbfd9d1d9: Preparing 
2c7950a1245f: Preparing 
9c1b6dd6c1e6: Waiting 
denied: Permission "artifactregistry.repositories.downloadArtifacts" denied on resource "projects/coneheads-wgtn/locations/australia-southeast1/repositories/containers" (or it may not exist)

✕ australia-southeast1-docker.pkg.dev/coneheads-wgtn/containers/web:latest failed.
Copy code
docker push australia-southeast1-docker.pkg.dev/coneheads-wgtn/containers/web:latest
The push refers to repository [australia-southeast1-docker.pkg.dev/coneheads-wgtn/containers/web]
6ea10f7d4ca8: Pushed 
22ada191c158: Pushed 
53db6fbe920f: Pushed 
315bbfd9d1d9: Pushed 
2c7950a1245f: Pushed 
9c1b6dd6c1e6: Pushed 
latest: digest: sha256:0b3ae52304c677a408ff1de287ae5138252a3a3b788279bcfe0620d946a26e6b size: 1582
c
Hi! We need to collect example configurations for how to do this. There are env variables that need to be provided, as well as populating
[docker].tools
with any required docker auth plugin scripts.
Perhaps @rapid-exabyte-76685 is able to provide some details on what is required (as I don’t have access to any cloud provider based registry), from this thread: https://pantsbuild.slack.com/archives/C046T6T9U/p1650703087221579 which I think is relevant here.
👍 1
r
There was a further thread discussing this here … https://pantsbuild.slack.com/archives/C046T6T9U/p1651122232246399
👍 1
Basically… I tried
[docker] tools = ["gcloud"]
and ultimately, there was some other tool that also needed to be on the path but it wasn’t clear what it was… and various ways of debugging this (explored in that thread) didn’t yield fruit.
At the moment I have
[docker] env_vars = [ …, "PATH" ]
and publishing to GCP Artifact Registry is working for me. However… https://pantsbuild.slack.com/archives/C046T6T9U/p1651129704640679?thread_ts=1651122232.246399&cid=C046T6T9U
c
Ah, we got stranded there.. hmm. I’ll try and investigate further.
🙏 1
As it turns out, this was a lingering bug. Fix under way…
❤️ 1
h
thanks Andreas! and thanks @ambitious-actor-36781 for the question 🙂
c
Yeah, this has come up frequently enough, so I signed up for a free gcloud account so I’ve been able to verify this to ensure it works properly now, and so that I know enough so that we can write a section in the docs about it as well.
🙌 1
PR https://github.com/pantsbuild/pants/pull/15401 I somehow completely overlooked the fact that the
publish
goal didn’t copy the behavior from the
run
goal wrgt the chroot placeholder (as the chroot is not known there, as it is not executed in the workspace). The above PR address this, and I’ve now managed to
./pants publish
a docker image to a google cloud registry, using only
[docker].tools
@hundreds-father-404 I’d love your eye on https://www.pantsbuild.org/docs/docker#docker-authentication when you get a chance. Feel free to make any changes you want to, or poke me to do them 😉
❤️ 1
h
You Got Mail! Thanks for writing the first draft
👍 1
r
Sweet, thanks for this, looking forward to the release!
Re the documentation, the bit about…
For example, a config file using GCloud might look like this:
That is usual established by running the
gcloud
tool like so…
Copy code
gcloud auth configure-docker europe-docker.pkg.dev # With a different registry name if appropriate.
…with gcloud’s authentication to the GCP project having been established previously… but you’re probably across that and its considered out of scope for the documentation?
👍 1
h
Thanks for the feedback! Do you know of a guide from their docs we could link to, perhaps? (I'm being lazy not looking myself)
r
Coming right up…
❤️ 1
h
Thanks! Updated
❤️ 1
a
@curved-television-6568 was your PR cherry picked and released already?
c
Yes, it should be in the releases announced by Eric yesterday.
Oh, or maybe even the ones before that..
a
Hum, I’m not sure where to look for that, I was looking at the github release page but last one seems to be from 11 days ago
(oups, got it, in #announce)
👍 1