Command: add componentversions
On this page
Usage
ocm add componentversions [<options>] [--version <version>] [<ctf archive>] {<components.yaml>}
Options
--addenv access environment for templating
-c, --create (re)create archive
--dry-run evaluate and print component specifications
-F, --file string target file/directory (default "transport-archive")
-f, --force remove existing content
-h, --help help for componentversions
-O, --output string output file for dry-run
-S, --scheme string schema version (default "v2")
-s, --settings stringArray settings file with variable settings (yaml)
--templater string templater to use (go, none, spiff, subst) (default "subst")
-t, --type string archive format (directory, tar, tgz) (default "directory")
-v, --version string default version for components
Description
Add component versions specified by a description file to a Common Transport Archive. This might be either a directory prepared to host component version content or a tar/tgz file (see option –type).
If option –create
is given, the archive is created first. An
additional option –force
will recreate an empty archive if it already exists.
The source, resource and reference list can be composed according the commands ocm add sources, ocm add resources, ocm add references, respectively.
The description file might contain:
- a single component as shown in the example
- a list of components under the key
components
- a list of yaml documents with a single component or component list
The –type
option accepts a file format for the
target archive to use. The following formats are supported:
- directory
- tar
- tgz
The default format is directory
.
If the option –scheme
is given, the specified component descriptor format is used/generated.
The following schema versions are supported:
ocm.software/v3alpha1
:v2
(default):
All yaml/json defined resources can be templated.
Variables are specified as regular arguments following the syntax <name>=<value>
.
Additionally settings can be specified by a yaml file using the –settings
option. With the option –addenv
environment variables are added to the binding.
Values are overwritten in the order environment, settings file, command line settings.
Note: Variable names are case-sensitive.
Example:
<command> <options> -- MY_VAL=test <args>
There are several templaters that can be selected by the –templater
option:
go
go templating supports complex values.key: subkey: "abc {{.MY_VAL}}"
none
do not do any substitution.spiff
spiff templating.It supports complex values. the settings are accessible using the binding
values
.key: subkey: "abc (( values.MY_VAL ))"
subst
simple value substitution with thedrone/envsubst
templater.It supports string values, only. Complex settings will be json encoded.
key: subkey: "abc ${MY_VAL}"
Examples
$ ocm add componentversions --file ctf --version 1.0 components.yaml
and a file <code>components.yaml</code>:
name: ocm.software/demo/test
version: 1.0.0
provider:
name: ocm.software
labels:
- name: city
value: Karlsruhe
labels:
- name: purpose
value: test
resources:
- name: text
type: PlainText
input:
type: file
path: testdata
- name: data
type: PlainText
input:
type: binary
data: IXN0cmluZ2RhdGE=
The resource <code>text</code> is taken from a file <code>testdata</code> located
next to the description file.
See Also
- ocm add — Add resources or sources to a component archive