Hmm... playing with the docker functionality again...
# general
e
Hmm... playing with the docker functionality again (massive progress for us!) one of the arguments we were passing was
--build-arg CONTAINER_GID={os.getgid()}
. (this was for a development container so that it ran as the existing user rather than as root or some fixed user ID). It's not clear how to do this with
extra_build_args
in pants (or generally, how to pass in a variable like that). I obviously can't
import os
to call `getgid`; I could pass it in as an env variable, but I can't see how to use env variables within a
BUILD
right now. Possible or not?
🙏 1
c
Yeah, env vars are not available in BUILD files.
You can consume the env var (if it would be ok passing it in as env var, was unclear to me if you knew how, but didn’t want to, or ok with, but need to know how) 😉
Copy code
docker_image(extra_build_args=["CONTAINER_GID"])
Copy code
CONTAINER_GID=$(group_id) ./pants package ..
e
Ah! Thanks--I even saw that in the docs and forgot it
That should do the trick; thanks
💯 2
c
Cool!
@echoing-farmer-15630 oh, and while I have your attention (sort of), did you see my ping here https://github.com/pantsbuild/pants/pull/13959#issuecomment-1004275888 (in case you have any input regarding the expected stability of the calculated hash value for the image tag)
Thanks 🙂
e
I didn't, thanks--but I've been testing our repo with the current hash and the two changes (target stage and ssh) and it's worked wonderfully so far, just taking a while to migrate things and will do some benchmarks for builds shortly. I'll take a look at the hash issue!
🙌 1
👍 1