Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand_template not re-running?. #1021

Open
Ryang20718 opened this issue Dec 26, 2024 · 0 comments
Open

expand_template not re-running?. #1021

Ryang20718 opened this issue Dec 26, 2024 · 0 comments

Comments

@Ryang20718
Copy link

I see the rule expand_template https://github.com/bazel-contrib/bazel-lib/blob/d042d563c6a91f7e11f66c42c83429199bd3d5d9/docs/expand_template.md for adding tags to oci_images has a field called stampwhich can be set to 1 to always stamp, but I’m not sure the stamp is always the most up to date?

in this simple macro, I often times change the underlying image, however, when I run push, the stamp is stale and not using the most up to date version of BUILD_DOCKER_TAG.

I’d like to avoid using --stamp since that causes the analysis cache to thrash. Is this expected or a bug?

minimal repro code snippet:

load("@rules_oci//oci:defs.bzl", _oci_image = "oci_image", _oci_push = "oci_push")

def oci_push(name, image, repository, remote_tags = None):
    """Push an oci image to a remote repository"""
    expand_template(
        name = "stamp",
        out = "_{}_stamp.txt".format(name),
        stamp_substitutions = {
            "docker-tag": "{{BUILD_DOCKER_TAG}}",
        },
        template = [
            "{}_docker-tag".format(Label(image).name),
        ],
        stamp = 1,
    )
    _oci_push(
        name = name,
        image = image,
        remote_tags = ":stamp" if (remote_tags == None) else remote_tags,
        repository = repository,
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant