Skip to content

ocm add cv Root Command #491

@jakobmoellerdev

Description

@jakobmoellerdev

Description

In OCM, we interface with component construction through the ocm add componentversion command. This command is able to interpret a special file format called the component-constructor.yaml with a dedicated scheme that supports a special specification attribute for resources and sources called input. This input is a specification that declares how resources are newly added / "input" to a component version.

ocm add componentversions — Add Component Version(S) To A (New) Transport Archive

Synopsis:
  ocm add componentversions [<options>] [--version <version>] [<ctf archive>] {<component-constructor.yaml>}

Aliases:
  componentversions, componentversion, cv, components, component, comps, comp, c

Options:
      --addenv                    access environment for templating
  -C, --complete                  include all referenced component version
  -L, --copy-local-resources      transfer referenced local resources by-value
  -V, --copy-resources            transfer referenced resources by-value
  -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
      --lookup stringArray        repository name or spec for closure lookup fallback
  -O, --output string             output file for dry-run
  -P, --preserve-signature        preserve existing signatures
  -R, --replace                   replace existing elements
  -S, --scheme string             schema version (default "v2")
  -s, --settings stringArray      settings file with variable settings (yaml)
      --skip-digest-generation    skip digest creation
      --templater string          templater to use (go, none, spiff, subst) (default "subst")
  -t, --type string               archive format (directory, tar, tgz) (default "directory")
      --uploader <name>=<value>   repository uploader (<name>[:<artifact type>[:<media type>[:<priority>]]]=<JSON target config>) (default [])
  -v, --version string            default version for components

Description:

  Add component versions specified by a constructor file to a Common Transport
  Archive. The archive 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.

  If option «--complete» is given all component versions referenced by
  the added one, will be added, also. Therefore, the «--lookup» is required
  to specify an OCM repository to lookup the missing component versions. If 
  additionally the «-V» is given, the resources of those additional
  components will be added by value.

  The «--replace» option allows users to specify whether adding an
  element with the same name and extra identity but different version as an 
  existing element, append (false) or replace (true) the existing element.

  The «--preserve-signature» option prohibits changes of signature 
  relevant elements.

  The source, resource and reference list can be composed according to 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 optional field «meta.configuredSchemaVersion» for a component
  entry can be used to specify a dedicated serialization format to use for the
  component descriptor. If given it overrides the «--schema» option
  of the command. By default, v2 is used.

  Various elements support to add arbitrary information by using labels
  (see «ocm ocm-labels»).

  The «--type» option accepts a file format for the
  target archive to use. It is only evaluated if the target 
  archive does not exist yet. The following formats are supported:
  - directory
  - tar
  - tgz
  The default format is «directory».

The targeted set of support criteria are:

  • NO templating support (separate story) and no --addenv
  • --copy-resources flag support, default false
  • --copy-local-resources flag support will be OMITTED
  • --create will be OMITTED and defaulted to true always
  • --dry-run support will be omitted because resources MUST be uploaded to preserve signatures and it cannot be known how the descriptor looks without uploading, making dry-run inaccurate. Instead, replace with --upload-cv that dictates if the final component version will be uploaded or not. similarly, --output will be renamed to --cv-output
  • --file support as before
  • --force as before, overwriting a component version if it already exists
  • --lookup will be OMITTED in favor of .ocmconfig style configurations only
  • --preserve-signature will be OMITTED, because there will not be preexisting signatures in a yet to be created component version
  • --replace will be OMITTED because of its conflicting nature with behavior to force. Instead only whole component versions can be wholly replaced in the future
  • --scheme only with v2 support
  • --settings will be OMITTED due to lack of templating engine necessity
  • --skip-digest-generation with default false will be replaced with --generate-digests with default true
  • --templater should be OMITTED (see above, separate story)
  • --type will be renamed to --archive-type to make it clear it applies only for CTFs. Since uploading to OCI repositories will also be possible, this flag should error when directly uploading to OCI.
  • --uploader will be omitted (uploader concept made obsolete through our plugin system)

Done Criteria

  • Code has been reviewed by other team members
  • Analysis of existing tests (Unit and Integration)
  • Unit Tests created for new code or existing Unit Tests updated
  • Integration Test Suite updated (includes deletion of existing unnecessary Integration Test and/or creation of new ones if required)
  • Enduser Documentation updated (if applicable)
  • Internal technical Documentation created/updated (if applicable)
  • Successful demonstration in Review

Metadata

Metadata

Labels

area/ipceiImportant Project of Common European Interestkind/tasksmall task, normally part of feature or epic

Type

No fields configured for Task.

Projects

Status
🍺 Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions