Skip to content

Commit

Permalink
Update docs and docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
captainreality committed Sep 18, 2024
1 parent 97ff99e commit b7826e3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
25 changes: 25 additions & 0 deletions docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,31 @@ Create a tarball and an OCI descriptor for it
| <a id="oci_image_layer-symlinks"></a>symlinks | Dictionary of symlink -> target entries to place in the tarball | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |


<a id="oci_image_layout"></a>

## oci_image_layout

<pre>
oci_image_layout(<a href="#oci_image_layout-name">name</a>, <a href="#oci_image_layout-manifest">manifest</a>)
</pre>

Writes an OCI Image Index and related blobs to an OCI Image Format
directory. See https://github.com/opencontainers/image-spec/blob/main/image-layout.md
for the specification of the OCI Image Format directory.

All blobs must be provided in the manifest's OCILayout provider, in the
files attribute. If blobs are missing, creation of the OCI Image Layout
will fail.

**ATTRIBUTES**


| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="oci_image_layout-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="oci_image_layout-manifest"></a>manifest | An OCILayout index to be written to the OCI Image Format directory. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |


<a id="oci_push"></a>

## oci_push
Expand Down
22 changes: 4 additions & 18 deletions oci/oci_image_layout.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,12 @@ oci_image_layout = rule(
doc = """
Writes an OCI Image Index and related blobs to an OCI Image Format
directory. See https://github.com/opencontainers/image-spec/blob/main/image-layout.md
for the specification of the OCI Image Format directory. Local blobs are
used where available, and if a referenced blob is not present, it is
fetched from the provided OCI repository and placed in the output.
for the specification of the OCI Image Format directory.
In order for this rule to work correctly in its current state, the
following flags must be provided to bazel:
--spawn_strategy=local
The spawn_strategy flag must be set to local because currently,
oci_image_index is only declaring the new JSON files it creates as
outputs; it's not declaring any manifests or layers from the images as
outputs. By default, Bazel only permits rules to access specifically
declared outputs of the rule's direct dependencies. In order for this
rule to access the transitive set of outputs of all dependencies, we
must disable bazel's sandboxing by setting spawn_strategy=local.
All blobs must be provided in the manifest's OCILayout provider, in the
files attribute. If blobs are missing, creation of the OCI Image Layout
will fail.
""",
# TODO(kim.mason): Fix oci_image/oci_image_index so they explicitly declare
# outputs that include everything needed to build the image.
# TODO(kim.mason): Make it so that Docker credential helpers are available
# to oci_image_layout without making the system PATH available.
implementation = _oci_image_layout_impl,
attrs = {
"manifest": attr.label(
Expand Down

0 comments on commit b7826e3

Please sign in to comment.