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

Add tag to PushInfo provider #2262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions container/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ PushInfo = provider(fields = [
"registry",
"repository",
"digest",
"tag",
])

# A provider containing information exposed by filter_layer rules
Expand Down
5 changes: 5 additions & 0 deletions container/push.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def _impl(ctx):
# If a tag file is provided, override <tag> with tag value
if ctx.file.tag_file:
tag = "$(cat {})".format(_get_runfile_path(ctx, ctx.file.tag_file))
tag_file = ctx.file.tag_file
pusher_input.append(ctx.file.tag_file)
else:
tag_file = ctx.actions.declare_file(ctx.label.name + "_tag")
ctx.actions.write(tag_file, "latest")

stamp = ctx.attr.stamp[StampSettingInfo].value
stamp_inputs = [ctx.info_file, ctx.version_file] if stamp else []
Expand Down Expand Up @@ -137,6 +141,7 @@ def _impl(ctx):
registry = registry,
repository = repository,
digest = ctx.outputs.digest,
tag = tag_file,
),
]

Expand Down