I've got a `docker_image` target that I would like...
# general
e
I've got a
docker_image
target that I would like to only build in CI (not locally during development). My local setup doesn't have all the resources/configurations needed to build this particular image. I could go about this by running
pants package carefully/crafted/paths/to:sources
when developing locally, but I would really love to just use
pants package ::
Is there a good way to indicate that a particular
docker_image
should be skipped by the package goal? (So I can use it with
env("IS_CI")
or similar)
f
There's
pants --filter-target-type='-docker_image' package ::
and there's having a
pants.ci.toml
, not sure you can get exactly what you are after
You could do in
pants.toml
like
Copy code
[cli.alias]
package-local = "--filter-target-type='-docker_image' package"
Then you would have
pants package-local ::
e
Unfortunately I do still want to build my other docker images, just the one in particular that I'd like to skip. I think we are on the right track or something though. Maybe using a
tag
or something we could get filter to work
f
You can use
filter-address-regex
instead and target it exactly then
Or a tag like "skip-local" or so might be a nice way to do it as well, in case you end up with more than one
For that you have
filter-tag-regex
too
if going with a tag you can just do
pants --tag='-skip_local' package ::
e
Thanks @fierce-truck-19259 Those are some great ideas
👍 1
h
You could set up a local .pants.rc that adds that dir to pants_ignore
Assuming everything in the dir can be ignored
Or you can ignore just the BUILD file, I think that should work
And if you need other targets in that BUILD file to be visible locally, you can split the BUILD file into two, and ignore just the one with that target
(pants treats multiple BUILD.whatever files in a dir as if they were all one BUILD file)
You will just have to remember that this is set, or you will find it confusing that Pants can’t see this file…