Are there any gotchas with using Pants docker supp...
# general
r
Are there any gotchas with using Pants docker support to push container images to Google Cloud Artifact Registry... particularly when using CircleCI's remote docker support? I can get Pants to build and tag the container images in the CI build, but it doesn't seem to like the push step. In particular... I think I need the result of running
gcloud auth configure-docker <http://europe-docker.pkg.dev|europe-docker.pkg.dev>
(or substitute other region) to be visible within the scope used by Pants.
I think probably I could just continue to publish to the gcp Artifact Registry using the docker push command directly, since that will be properly integrated with gcloud auth, whereas it seems that maybe the Pants docker plugin doesn't support registry authentication at the moment?
Ah I see there is https://github.com/pantsbuild/pants/issues/14596 which might be related to this issue, but there would still need to be a gcloud plugin for pants docker?
c
You should be able to get it to work by forwarding relevant env vars and tools so theyre accessible on the PATH for the docker command.
Sorry for the lack of examples in this area.
r
@curved-television-6568 An example would be handy... I'm looking into this again. I've defined...
Copy code
[docker]
tools = ["/home/circleci/google-cloud-sdk/bin/gcloud"]
And in my CI environment if I manually log in and run (as the
circleci
user)
~/google-cloud-sdk/bin/gcloud
I can see that it runs, however if I run
./pants publish ::
Copy code
07:02:52.17 [ERROR] 1 Exception encountered:

  BinaryNotFoundError: Cannot find `/home/circleci/google-cloud-sdk/bin/gcloud` on `['/bin', '/home/circleci/.local/bin', '/home/circleci/.poetry/bin', '/home/circleci/.pyenv/bin', '/home/circleci/.pyenv/shims', '/home/circleci/bin', '/home/circleci/google-cloud-sdk/bin', '/sbin', '/usr/bin', '/usr/local/bin', '/usr/local/sbin', '/usr/sbin']`. Please ensure that it is installed so that Pants can use docker.
👀 1
Is this potentially a bug where it is going looking for
/home/circleci/google-cloud-sdk/bin/home/circleci/google-cloud-sdk/bin/gcloud
? Or have I given
tools
a value in the incorrect format?
gcloud
is a shell script FWIW
c
Huh, that seems to be a bug, too. Thanks for finding it, sorry for the trouble.
Ah, and now I see the confusion here. The
[docker] tools
option expects the tool name, as discoverable on PATH, not a full absolute path to the tool.
I.e. this should work:
Copy code
[docker]
tools=["gcloud"]
as the circleci/bin seems to be on your PATH already.
r
Ok thanks for that... I've moved the needle a little bit further, but now from
./pants publish
I'm getting...
Copy code
ValueError: Process has immutable_input_digests, so it cannot be converted to an InteractiveProcess by calling from_process().  Use an async InteractiveProcessRequest instead.
c
Doh. heh, you’re being my minesweeper for the day…
I recognize that message, so know what to do with it. Fix will be put up together with the one for #15251.
r
c
That is indeed the workaround needed here, yes. (as mentioned in the comments)
r
The workaround isn't clear to me from the issue and its linked issue, in terms of whether its something I can achieve by making changes to my BUILD files or pants.toml, or if it requires a patch to the downloaded pants code.
c
Ah, right. Yeah the workaround is on the source level in the pants code base, so I’ll need to patch that.
which version of Pants are you on? (will backport the fixes)
🙇 1
🙏 1
OK, fix pushed, pending review/merge and cherry picks: https://github.com/pantsbuild/pants/pull/15255
r
pants_version = "2.11.0rc0"
but if the fix lands in a more recent RC or release I'll use it
👍 1
I've looked at the commits for 15255, looks like this will land in 2.11.0rc5?
c
Yep, 2.11.0rc5 will have both docker related fixes from yesterday.