Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Allow overriding the stamp inputs #592

Merged
merged 3 commits into from
Jul 23, 2020
Merged
Changes from 2 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
13 changes: 11 additions & 2 deletions k8s/object.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def _impl(ctx):

# Add workspace_status_command files to the args that are pushed to the resolver and adds the
# files to the runfiles so they are available to the resolver executable.
stamp_inputs = [ctx.info_file, ctx.version_file]
if len(ctx.attr.stamp_srcs):
stamp_inputs = ctx.files.stamp_srcs
else:
stamp_inputs = [ctx.info_file, ctx.version_file]
stamp_args = " ".join(["--stamp-info-file=%s" % _runfiles(ctx, f) for f in stamp_inputs])
all_inputs.extend(stamp_inputs)

Expand Down Expand Up @@ -152,7 +155,10 @@ def _impl(ctx):
]

def _resolve(ctx, string, output):
stamps = [ctx.info_file, ctx.version_file]
if len(ctx.attr.stamp_srcs):
stamps = ctx.files.stamp_srcs
else:
stamps = [ctx.info_file, ctx.version_file]
args = ctx.actions.args()
args.add_all(stamps, format_each = "--stamp-info-file=%s")
args.add(string, format = "--format=%s")
Expand Down Expand Up @@ -280,6 +286,9 @@ _common_attrs = {
executable = True,
allow_files = True,
),
# Custom stamp input files. Default to stable-status.txt and volatile-status.txt
# emitted by the workspace_status command.
"stamp_srcs": attr.label_list(),
# Extra arguments to pass to the resolver.
"resolver_args": attr.string_list(),
"user": attr.string(),
Expand Down