Hi,
we're unable to retrieve the sha256 digest when we run container push for an image. We use the digest when we create a job manifest for deployment, as part of a bazel run command for a deploy script.
See comment https://github.com/bazelbuild/rules_docker/issues/371#issuecomment-378023577 which describes how it used to work. Our deploy script was broken after upgrade to bazel 1.0 and rules_docker 0.12.0.
Our workaround is to use a stamp, but this means we get a new release for each build rather than only when the digest changes.
Any way of printing the sha256 digest to stdout in the pusher script?
Hi @gorset,
Sorry for breaking your use case. Note that the stdout of our binaries isn't part of their API and therefore I would recommend against depending on them.
For your use case, the container_push rule generates an output digest file with the sha256 digest of the image it will push when run with bazel run. So if you have a container_push target:
container_push(
name = "push_image",
...
)
If you do bazel build //path/to:push_image.digest, it will produce a file with the sha256 digest of the image. I suggest depending on this file in downstream rules or print its contents using
bazel build //path/to:push_image.digest
cat bazel-bin/path/to/push_image.digest
That works. Thanks!
Rather than hard-code the output path or write complicated starlark just to get the digest, one can do this:
IMAGE_SHA256=$(bazel run --run_under "cat" //my/pkg1:push1.digest)
Most helpful comment
Hi @gorset,
Sorry for breaking your use case. Note that the stdout of our binaries isn't part of their API and therefore I would recommend against depending on them.
For your use case, the
container_pushrule generates an output digest file with the sha256 digest of the image it will push when run withbazel run. So if you have acontainer_pushtarget:If you do
bazel build //path/to:push_image.digest, it will produce a file with the sha256 digest of the image. I suggest depending on this file in downstream rules or print its contents using