tilt
tilt copied to clipboard
custom_build([...], tag=custom_tag, disable_push=True) impossible to know which exact docker image ref needs to be pushed to the cluster
When using custom_build
's options tag
and disable_push
simultaneously, it seems to be impossible to know which docker image reference needs to be pushed to the kubernetes cluster. $EXPECTED_REF is not the image reference used on the cluster as per #1615.
Hmmm...this is a good point. I'm not sure that tag
and disable_push
can ever be used together right now.
But I'm also not sure how it should behave. @jazzdan what do you think? Maybe it should just be an error if you try to use them together.
ping?
I think this should be an error, for now. Since there's no way to know what Tilt will retag your image as, there's no way you could push it manually.
However, if we implement also pushing the user tag
specified (as described in this comment) then you could know the image to push.
The risk there is, unless you're generated a unique/content-based user specified tag, Kubernetes wouldn't update images (unless you set it to always pull) that get updated with the same tag as the previous image.
I think error is probably a safe bet for now.
this makes tilt pretty much unusable with K3s or Kind w/o using the public image registry. The only way I am able to hack the custom "image import" is this:
custom_build(
'absaoss/cert-manager-webhook-externaldns',
'docker build -f ./Dockerfile.multistage . && \
full_id=$(docker images --no-trunc -q | head -1) && \
k3d image import absaoss/cert-manager-webhook-externaldns:tilt-$(echo ${full_id:7:16})',
disable_push=True,
)
it works, but it's way too ugly. Also I have to repeat the name of the image there. Perhaps the first argument to that custom_build
function (ref
) could have been available as env var to that custom run command.