Skip to content
Closed
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
10 changes: 10 additions & 0 deletions container/pull.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ container_import(
repository_ctx.path("image"),
]

if repository_ctx.attr.cacerts:
args += [
"--cacert",
repository_ctx.path(repository_ctx.attr.cacerts),
]

# If a digest is specified, then pull by digest. Otherwise, pull by tag.
if repository_ctx.attr.digest:
args += [
Expand Down Expand Up @@ -90,6 +96,10 @@ container_pull = repository_rule(
"repository": attr.string(mandatory = True),
"digest": attr.string(),
"tag": attr.string(default = "latest"),
"cacerts": attr.label(
allow_single_file = True,
mandatory = False,
),
"_puller": attr.label(
executable = True,
default = Label("@puller//file:downloaded"),
Expand Down
2 changes: 1 addition & 1 deletion container/push-tag.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ function guess_runfiles() {

RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"

%{container_pusher} %{format} --name=%{tag} %{stamp} %{image} "$@"
%{container_pusher} %{format} %{cacerts} --name=%{tag} %{stamp} %{image} "$@"
7 changes: 7 additions & 0 deletions container/push.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def _impl(ctx):
layer_arg,
),
"%{format}": "--oci" if ctx.attr.format == "OCI" else "",
"%{cacerts}": ( "--cacert " + ctx.file.cacerts.path ) \
if ctx.file.cacerts else "",
"%{container_pusher}": _get_runfile_path(ctx, ctx.executable._pusher),
},
output = ctx.outputs.executable,
Expand All @@ -100,6 +102,7 @@ def _impl(ctx):
image["manifest"],
] + image.get("blobsum", []) + image.get("zipped_layer", []) +
stamp_inputs + ([image["legacy"]] if image.get("legacy") else []) +
([ctx.file.cacerts] if ctx.file.cacerts else []) +
list(ctx.attr._pusher.default_runfiles.files),
)

Expand Down Expand Up @@ -146,6 +149,10 @@ container_push = rule(
default = False,
mandatory = False,
),
"cacerts": attr.label(
allow_single_file = True,
mandatory = False,
),
}.items() + _layer_tools.items()),
executable = True,
implementation = _impl,
Expand Down