Is there a way to have a docker tag default if not...
# general
b
Is there a way to have a docker tag default if not satisfied from an env var?
I my img tagged
latest
but only if
TAG
isn't defined
I'm not sure this is possible 😭 I've also tried playing tricks in a plugin, or seeing if I could inject ENV vars into Pants' execution ina rule. No Dice
s
we do this in a shell script that we’ve set up
./pants
to `source`:
Copy code
export DOCKER_TAG=${DOCKER_TAG:-latest}
b
Hmmmmmmmm
I like that idea, although I'm realizing my desire for the docker plugin goes even further. For goals like
run
(and maybe
package
, idk) I want the tag and registry to be some hardcoded value, so that the built image doesn't have a long docker tag:
watson_orders/serviceA:latest
vs
<http://superr-log.amazon.ecs.url.com/serviceA:latest|superr-log.amazon.ecs.url.com/serviceA:latest>
And then only for
publish
do we do the actual registry tagging.
I guess thats secondary to the TAG issue though 🤔 I'll try the editing-
./pants
-thing 🙌
Oh actually, this is really easy and nice 🙈 Don't need the TAG hackery (although can still use it)
Used the
export DOCKER_TAG
trick, also wrote my own
run
rule for docker images. Last hurdle is https://github.com/pantsbuild/pants/issues/16353 but things are shaping up nicely