Skip to content

Commit 4c810f2

Browse files
authored
chore: rename repotags to repo_tags (#224)
1 parent b3fb94f commit 4c810f2

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

docs/tarball.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ For example, given an `:image` target, you could write
88
oci_tarball(
99
name = "tarball",
1010
image = ":image",
11-
repotags = ["my-repository:latest"],
11+
repo_tags = ["my-repository:latest"],
1212
)
1313
```
1414

@@ -26,7 +26,7 @@ docker run --rm my-repository:latest
2626
## oci_tarball
2727

2828
<pre>
29-
oci_tarball(<a href="#oci_tarball-name">name</a>, <a href="#oci_tarball-image">image</a>, <a href="#oci_tarball-repotags">repotags</a>)
29+
oci_tarball(<a href="#oci_tarball-name">name</a>, <a href="#oci_tarball-image">image</a>, <a href="#oci_tarball-repo_tags">repo_tags</a>)
3030
</pre>
3131

3232
Creates tarball from OCI layouts that can be loaded into docker daemon without needing to publish the image first.
@@ -41,6 +41,6 @@ Passing anything other than oci_image to the image attribute will lead to build
4141
| :------------- | :------------- | :------------- | :------------- | :------------- |
4242
| <a id="oci_tarball-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
4343
| <a id="oci_tarball-image"></a>image | Label of a directory containing an OCI layout, typically <code>oci_image</code> | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
44-
| <a id="oci_tarball-repotags"></a>repotags | a file containing repotags, one per line. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
44+
| <a id="oci_tarball-repo_tags"></a>repo_tags | a file containing repo_tags, one per line. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
4545

4646

e2e/crane_as_registry/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ oci_image(
2121
oci_tarball(
2222
name = "tar",
2323
image = ":image",
24-
repotags = [],
24+
repo_tags = [],
2525
)
2626

2727
container_structure_test(

e2e/smoke/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tags = [
2828
oci_tarball(
2929
name = "tar",
3030
image = ":image",
31-
repotags = tags,
31+
repo_tags = tags,
3232
)
3333

3434
container_structure_test(

e2e/wasm/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ build_test(
5252
oci_tarball(
5353
name = "tarball",
5454
image = ":image",
55-
repotags = ["gcr.io/wasm:latest"],
55+
repo_tags = ["gcr.io/wasm:latest"],
5656
)

examples/empty_base/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ container_structure_test(
2727
oci_tarball(
2828
name = "tarball",
2929
image = ":image",
30-
repotags = ["gcr.io/empty_base:latest"],
30+
repo_tags = ["gcr.io/empty_base:latest"],
3131
)

oci/defs.bzl

+7-7
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,30 @@ def oci_push(name, remote_tags = None, **kwargs):
8181
**kwargs
8282
)
8383

84-
def oci_tarball(name, repotags = None, **kwargs):
84+
def oci_tarball(name, repo_tags = None, **kwargs):
8585
"""Macro wrapper around [oci_tarball_rule](#oci_tarball_rule).
8686
87-
Allows the repotags attribute to be a list of strings in addition to a text file.
87+
Allows the repo_tags attribute to be a list of strings in addition to a text file.
8888
8989
Args:
9090
name: name of resulting oci_tarball_rule
91-
repotags: a list of repository:tag to specify when loading the image,
91+
repo_tags: a list of repository:tag to specify when loading the image,
9292
or a label of a file containing tags one-per-line.
9393
See [stamped_tags](https://github.com/bazel-contrib/rules_oci/blob/main/examples/push/stamp_tags.bzl)
9494
as one example of a way to produce such a file.
9595
**kwargs: other named arguments to [oci_tarball_rule](#oci_tarball_rule).
9696
"""
97-
if types.is_list(repotags):
97+
if types.is_list(repo_tags):
9898
tags_label = "_{}_write_tags".format(name)
9999
write_file(
100100
name = tags_label,
101101
out = "_{}.tags.txt".format(name),
102-
content = repotags,
102+
content = repo_tags,
103103
)
104-
repotags = tags_label
104+
repo_tags = tags_label
105105

106106
oci_tarball_rule(
107107
name = name,
108-
repotags = repotags,
108+
repo_tags = repo_tags,
109109
**kwargs
110110
)

oci/private/tarball.bzl

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ For example, given an `:image` target, you could write
66
oci_tarball(
77
name = "tarball",
88
image = ":image",
9-
repotags = ["my-repository:latest"],
9+
repo_tags = ["my-repository:latest"],
1010
)
1111
```
1212
@@ -26,9 +26,9 @@ Passing anything other than oci_image to the image attribute will lead to build
2626

2727
attrs = {
2828
"image": attr.label(mandatory = True, allow_single_file = True, doc = "Label of a directory containing an OCI layout, typically `oci_image`"),
29-
"repotags": attr.label(
29+
"repo_tags": attr.label(
3030
doc = """\
31-
a file containing repotags, one per line.
31+
a file containing repo_tags, one per line.
3232
""",
3333
allow_single_file = [".txt"],
3434
),
@@ -47,8 +47,8 @@ def _tarball_impl(ctx):
4747
"{{tarball_path}}": tarball.path,
4848
}
4949

50-
if ctx.attr.repotags:
51-
substitutions["{{tags}}"] = ctx.file.repotags.path
50+
if ctx.attr.repo_tags:
51+
substitutions["{{tags}}"] = ctx.file.repo_tags.path
5252

5353
ctx.actions.expand_template(
5454
template = ctx.file._tarball_sh,
@@ -59,7 +59,7 @@ def _tarball_impl(ctx):
5959

6060
ctx.actions.run(
6161
executable = executable,
62-
inputs = [image, ctx.file.repotags],
62+
inputs = [image, ctx.file.repo_tags],
6363
outputs = [tarball],
6464
tools = [yq_bin],
6565
mnemonic = "OCITarball",

oci/private/tarball.sh.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ done
2828
# TODO: https://github.com/bazel-contrib/rules_oci/issues/212
2929
# we can't use \n due to https://github.com/mikefarah/yq/issues/1430 and
3030
# we can't update YQ at the moment because structure_test depends on a specific version
31-
repotags="${REPOTAGS/$'\n'/%}" \
31+
repo_tags="${REPOTAGS/$'\n'/%}" \
3232
config="blobs/${CONFIG_DIGEST}" \
3333
layers="${LAYERS}" \
3434
"${YQ}" eval \
35-
--null-input '.[0] = {"Config": env(config), "RepoTags": "${repotags}" | envsubst | split("%"), "Layers": env(layers) | map( "blobs/" + . + ".tar.gz") }' \
35+
--null-input '.[0] = {"Config": env(config), "RepoTags": "${repo_tags}" | envsubst | split("%"), "Layers": env(layers) | map( "blobs/" + . + ".tar.gz") }' \
3636
--output-format json > "${STAGING_DIR}/manifest.json"
3737

3838
# TODO: https://github.com/bazel-contrib/rules_oci/issues/217

0 commit comments

Comments
 (0)