Skip to content

Latest commit

 

History

History
157 lines (103 loc) · 11.6 KB

File metadata and controls

157 lines (103 loc) · 11.6 KB

public rules

oci_image

oci_image(name, annotations, arch, base, entrypoint, env, labels, layers, os)

Creates a new image manifest and config by appending the layers to an existing image manifest and config defined by base. If base is an image index, then os and arch will be used to extract the image manifest.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
annotations OCI Annotations to add to the manifest. Dictionary: String -> String optional {}
arch Used to extract a manifest from base if base is an index String optional ""
base A base image, as defined by oci_pull or oci_image Label required
entrypoint A list of entrypoints for the image; these will be inserted into the generated OCI image config List of strings optional []
env Entries are in the format of VARNAME=VARVALUE. These values act as defaults and are merged with any specified when creating a container. List of strings optional []
labels labels that will be applied to the image configuration, as defined in the OCI config. These behave the same way as docker LABEL; in particular, labels from the base image are inherited. An empty value for a label will cause that label to be deleted. For backwards compatibility, if this is not set, then the value of annotations will be used instead. Dictionary: String -> String optional {}
layers A list of layers defined by oci_image_layer List of labels optional []
os Used to extract a manifest from base if base is an index String optional ""

oci_image_index

oci_image_index(name, annotations, manifests)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
annotations - Dictionary: String -> String optional {}
manifests - List of labels optional []

oci_push

oci_push(name, headers, manifest, registry, repository, stamp, tag, x_meta_headers)

Pushes a manifest or a list of manifests to an OCI registry.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
headers (optional) A list of key/values to to be sent to the registry as headers. Dictionary: String -> String optional {}
manifest A manifest to push to a registry. If an OCILayout index, then push all artifacts with a 'org.opencontainers.image.ref.name' annotation. Label optional None
registry A registry host to push to, if not present consult the toolchain. String optional ""
repository A repository to push to, if not present consult the toolchain. String optional ""
stamp Whether to encode build information into the output. Possible values:

- stamp = 1: Always stamp the build information into the output, even in --nostamp builds. This setting should be avoided, since it is non-deterministic. It potentially causes remote cache misses for the target and any downstream actions that depend on the result. - stamp = 0: Never stamp, instead replace build information by constant values. This gives good build result caching. - stamp = -1: Embedding of build information is controlled by the --[no]stamp flag. Stamped targets are not rebuilt unless their dependencies change.
Integer optional -1
tag (optional) A tag to include in the target reference. This will not be included on child images.

Subject to $(location) and "Make variable" substitution.

Stamping

You can use values produced by the workspace status command in your tag. To do this write a script that prints key-value pairs separated by spaces, e.g.

#!/usr/bin/env bash
echo "STABLE_KEY1 VALUE1"
echo "STABLE_KEY2 VALUE2"


You can reference these keys in tag using curly braces,

oci_push(
    name = "push",
    tag = "v1.0-{STABLE_KEY1}",
)
String optional ""
x_meta_headers (optional) A list of key/values to to be sent to the registry as headers with an X-Meta- prefix. Dictionary: String -> String optional {}

oci_image_layer

oci_image_layer(name, directory, file_map, files, symlinks, kwargs)

oci_image_layer

PARAMETERS

Name Description Default Value
name A unique name for this rule none
directory Directory in the tarball to place the files "/"
file_map Dictionary of file -> file location in tarball None
files List of files to include under directory None
symlinks Dictionary of symlink -> target entries to place in the tarball None
kwargs Additional arguments to pass to the rule, e.g. tags or visibility none

oci_image_layout

oci_image_layout(name, image_index, gzip, kwargs)

Creates targets for an OCI Image Layout directory and a tar file

See https://github.com/opencontainers/image-spec/blob/main/image-layout.md for the specification of the OCI Image Format directory.

PARAMETERS

Name Description Default Value
name A unique name for the rule none
image_index An oci_image_index label none
gzip If true, creates a tar.gz file. If false, creates a tar file True
kwargs Additional arguments to pass to the underlying rules, e.g. tags or visibility none

oci_pull

oci_pull(name, debug, digest, registry, repo_mapping, repository, scheme, shallow)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
debug Deprecated. Does nothing Boolean optional False
digest The digest or tag of the manifest file String required
registry Remote registry host to pull from, e.g. gcr.io or index.docker.io String required
repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).
Dictionary: String -> String optional
repository Image path beneath the registry, e.g. distroless/static String required
scheme scheme portion of the URL for fetching from the registry String optional "https"
shallow Deprecated. Does nothing Boolean optional False

ENVIRONMENT VARIABLES

This repository rule depends on the following environment variables:

  • DOCKER_CONFIG
  • REGISTRY_AUTH_FILE
  • XDG_RUNTIME_DIR
  • HOME
  • OCI_ENABLE_OAUTH2_SUPPORT