https://pantsbuild.org/ logo
#general
Title
# general
c

cuddly-teacher-45066

01/11/2022, 7:49 AM
This question is in line with the previous one as I am also exploring potential solutions. Currently our team often pulls docker images for testing purposes but building is done within our CI/CD pipeline. Is there a way I can prevent developers to build a docker image with
pants package ::
when they not on a specific platform, but allow building of pex files? I assume I would have to write a plugin for that, just curious how I should approach this
h

happy-kitchen-89482

01/11/2022, 8:00 AM
This is a good question. So you do want to allow building local pex files, just not allow them to be embedded in a docker image?
@curved-television-6568 It may make sense to have this as a feature of docker support - some sort of check that the platform of the binary matches the platform of the docker image
c

cuddly-teacher-45066

01/11/2022, 8:12 AM
such a check would be great as it would avoid confusion on why the docker images, which are build locally, are not running. A warning would be great already
c

curved-television-6568

01/11/2022, 8:16 AM
h

happy-kitchen-89482

01/11/2022, 8:17 AM
It is exactly that, IIUC! @cuddly-teacher-45066 your comments/vote on that issue would help prioritize it
c

cuddly-teacher-45066

01/11/2022, 8:21 AM
thanks everyone let me do this
c

curved-television-6568

01/11/2022, 8:39 AM
The OP seems to be about not building the images in the first place, so that precedes the goal of #13185. Would it make sense to have an option to first attempt to pull the image being built, and only build it if the pull failed. That way, if the images are already built and pushed by CI/CD, then the developers get to use those images transparently.. Perhaps something like this:
Copy code
./pants package --docker-prefetch-images ::
Where the
--docker-prefetch-images
is the feature toggle asking to first pull the image being built, and if it exists, avoid rebuilding it. That option could be set by default in your
pants.toml
and disabled in a
pants.ci.toml
to always build within the CI/CD pipeline.
h

happy-kitchen-89482

01/11/2022, 6:03 PM
Ah good point
That is different
c

cuddly-teacher-45066

01/12/2022, 5:13 AM
I like this idea a lot! @curved-television-6568
👍 1
5 Views