publish Trait
Attributes
name |
required? |
default |
type |
explanation |
---|---|---|---|---|
dockerimages |
no |
{}
|
Dict[str, PublishDockerImageDescriptor] |
specifies the container images to be built |
oci-builder |
no |
|
OciBuilder |
specifies the container image builder to use |
no-buildkit |
no |
False |
bool |
if using |
platforms |
no |
None |
List[str] |
if defined, all image-builds will be done for each of the specified platforms, which
may result in cross-platform builds. Only supported if using As an implementation detail that may change in the future, multiarch/quemu-user-static
(see) is used. As the underlying
CICD nodes use
The resulting images will receive tags derived from the default tag (single-image case) with a suffix containing the platform. The default tag will be published as multi-arch image, referencing all platform-variants. This will also hold true if only one platform is specified. Note if specifying a list of platforms, _all_ platforms (including the default platform) must be explicitly specified. |
helmcharts |
no |
() |
List[HelmchartCfg] |
dockerimages.<user-chosen> (PublishDockerImageDescriptor) Attributes
name |
required? |
default |
type |
explanation |
---|---|---|---|---|
registry |
no |
None |
str |
name of the registry config to use when pushing the image. |
image |
no |
None |
str |
image reference to publish the created container image to. required if on |
extra_push_targets |
no |
[]
|
List[str] |
additional targets to publish built images to. Entries _may_ contain a tag (which is
honoured, if present). Entries without a tag will use the same tag as the “main” image
(defined by |
inputs |
no |
repos: null
steps: {}
|
dict |
configures the inputs that are made available to image build |
prebuild_hook |
no |
None |
str |
if configured, a callback is executed prior to running image-build. the value is interpreted as relative path to main-repository root directory, and must be an executable file. It can be used, for example, to preprocess the “Dockerfile” to use, or to prepare contents within the build directory. The following environment variables are passed (all paths are absolute): - BUILD_DIR # path to build directory - DOCKERFILE # path to dockerfile Only supported for oci-builder docker or docker-buildx. dockerd will be available and running (docker excecutable accessible from PATH). |
tag_as_latest |
no |
False |
bool |
whether or not published container images should also be labeled as latest |
tag_template |
no |
${EFFECTIVE_VERSION} |
str |
the template to use for the image-tag (only variable: EFFECTIVE_VERSION) |
dockerfile |
no |
Dockerfile |
str |
the file to use for building the container image |
dir |
no |
None |
str |
the relative path to the container image build file |
target |
no |
None |
str |
only for multistage builds: the target up to which to build.
must not be used if |
targets |
no |
None |
List[TargetSpec] |
if set, the given targets are built in the given order in the same build environment.
This is useful to reduce resource consumption for multiple builds sharing common
prerequisite build steps.
Only supported if oci-builder is set to |
resource_labels |
no |
[]
|
List[Label] |
labels to add to the resource declaration for this image in base-component-descriptor |
build_args |
no |
{}
|
Dict[str, str] |
build-time arguments to pass to docker-build |
platforms |
no |
None |
List[str] |
If see toplevel documentation for |
dockerimages.<user-chosen>.targets[] (TargetSpec) Attributes
name |
required? |
default |
type |
explanation |
---|---|---|---|---|
target |
yes |
None |
str |
|
image |
yes |
None |
str |
|
name |
no |
None |
str | None |
dockerimages.<user-chosen>.resource_labels[] (Label) Attributes
name |
required? |
default |
type |
explanation |
---|---|---|---|---|
name |
yes |
None |
str |
|
value |
yes |
None |
str | int | float | bool | dict | list |
oci-builder Enumeration Values
docker
docker-buildx
helmcharts[] (HelmchartCfg) Attributes
name |
required? |
default |
type |
explanation |
---|---|---|---|---|
name |
yes |
None |
str |
|
registry |
yes |
None |
str |
|
dir |
yes |
None |
str |
|
mappings |
yes |
None |
List[HelmchartValueMapping] |
helmcharts[].mappings (HelmchartValueMapping) Attributes
name |
required? |
default |
type |
explanation |
---|---|---|---|---|
ref |
yes |
None |
str |
|
attribute |
yes |
None |
str |
Dependencies
This trait requires the following traits to be declared:
Used to build and publish container images in the declaring build jobs. An arbitrary amount of container images may be specified (at least one).
The effective version is used as image tag. Optionally, created images may be tagged as ‘latest’.
Each container image build is run in a directory with definable contents (see inputs
attribute)
using the specified Dockerfile
.
inputs
Attribute
By default, the main repository’s work tree is copied into the build directory. This behaviour
may be changed by defining different logical repository names for inputs.repos
.
To consume (build) results created by other build steps, those outputs are specified with the
inputs.steps
attribute.
Build steps that are specified as inputs may declare the optional output_dir
attribute. They
are expected to place their outputs into a directory indicated by an environment variable named
<OUTPUT_DIR>_PATH
(defaults to BINARY_PATH
).
implicitly injected build steps
Defining this trait
will implicitly add two build steps, named prepare
, publish
. Thus,
those step names are not allowed to be used in job definitions with this trait.
The publish
step is guaranteed to always run _after_ the prepare
step.
By default, both publish
and prepare
steps are run _after_ all other steps, with the
notable exception of the release
step (from the release
trait).
Example
steps:
build:
output_dir: 'build_result' # 'build' must cp to ${BUILD_RESULT_PATH}
traits:
publish:
dockerimages:
first_image: # logical image name
image: 'eu.grc.io/gardener-project/example/image'
dockerfile: 'Dockerfile'
tag_as_latest: True
inputs:
repos:
source: ~ # this is the default (--> use main repository)
steps:
build: ~ # copy results of step 'build' over source tree
second_image:
image: 'eu.gcr.io/gardener-project/example/second_image
dockerfile: 'AnotherDockerfile'