File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ container_import(
5656 repository_ctx .path ("image" ),
5757 ]
5858
59+ if repository_ctx .attr .cacerts :
60+ args += [
61+ "--cacert" ,
62+ repository_ctx .path (repository_ctx .attr .cacerts ),
63+ ]
64+
5965 # If a digest is specified, then pull by digest. Otherwise, pull by tag.
6066 if repository_ctx .attr .digest :
6167 args += [
@@ -90,6 +96,10 @@ container_pull = repository_rule(
9096 "repository" : attr .string (mandatory = True ),
9197 "digest" : attr .string (),
9298 "tag" : attr .string (default = "latest" ),
99+ "cacerts" : attr .label (
100+ allow_single_file = True ,
101+ mandatory = False ,
102+ ),
93103 "_puller" : attr .label (
94104 executable = True ,
95105 default = Label ("@puller//file:downloaded" ),
Original file line number Diff line number Diff line change @@ -28,4 +28,4 @@ function guess_runfiles() {
2828
2929RUNFILES=" ${PYTHON_RUNFILES:- $(guess_runfiles)} "
3030
31- %{container_pusher} %{format} --name=%{tag} %{stamp} %{image} " $@ "
31+ %{container_pusher} %{format} %{cacerts} --name=%{tag} %{stamp} %{image} " $@ "
Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ def _impl(ctx):
8787 layer_arg ,
8888 ),
8989 "%{format}" : "--oci" if ctx .attr .format == "OCI" else "" ,
90+ "%{cacerts}" : ( "--cacert " + ctx .file .cacerts .path ) \
91+ if ctx .file .cacerts else "" ,
9092 "%{container_pusher}" : _get_runfile_path (ctx , ctx .executable ._pusher ),
9193 },
9294 output = ctx .outputs .executable ,
@@ -100,6 +102,7 @@ def _impl(ctx):
100102 image ["manifest" ],
101103 ] + image .get ("blobsum" , []) + image .get ("zipped_layer" , []) +
102104 stamp_inputs + ([image ["legacy" ]] if image .get ("legacy" ) else []) +
105+ ([ctx .file .cacerts ] if ctx .file .cacerts else []) +
103106 list (ctx .attr ._pusher .default_runfiles .files ),
104107 )
105108
@@ -146,6 +149,10 @@ container_push = rule(
146149 default = False ,
147150 mandatory = False ,
148151 ),
152+ "cacerts" : attr .label (
153+ allow_single_file = True ,
154+ mandatory = False ,
155+ ),
149156 }.items () + _layer_tools .items ()),
150157 executable = True ,
151158 implementation = _impl ,
You can’t perform that action at this time.
0 commit comments