Promotion Template YAML
YAML specifications for the Promotion Template defining version info and properties to promote
Codefresh provides two options for defining manifests for promotion entities: Form mode and YAML mode.
If you prefer working with YAML, create the manifest using the example Promotion Template YAML below, and the table with field descriptions.
Once configured and committed, the settings are saved as a Custom Resource Definition (CRD) within the Shared Configuration Repository in the GitOps Runtime specified as the Configuration Runtime.
Promotion Template YAML example
Here’s an example of the Promotion Template manifest. The table describes the fields in the Promotion Template manifest.
apiVersion: codefresh.io/v1beta1
kind: PromotionTemplate
metadata:
  name: base-helm                     # any valid k8s name
spec:<!
  versionSource:                      # get release version from this file 
    file: Chart.yaml
    jsonPath: $appVersion
  promotion:                         #  promote defined changes in files; leave empty to promote all changes
    Chart.yaml:
      jsonPaths:
      - $.appVersion
      - $.version
      - $.dependencies
    values.yaml:
      jsonPaths:
      - $..image
    requirements.yaml:
      jsonPaths:
      - "$.dependencies"
Promotion Template YAML field descriptions
| Field | Description | Type | Required/Optional | 
|---|---|---|---|
| metadata.name | The name of the Promotion Template, which can correspond to the name of the Product, or any other meaningful identifier. | string | Required | 
| spec.applicationSourceSelector | The label used to match the application to which to apply the Promotion Template. Application selectors conform to Kubernetes label selectors, defined as matchLabelswithkey-valuepairs,matchExpressionswithkey-operator-valuearrays, or a combination of both. The values identify all the Promotion Template manifests that match the specific application or applications within the target environment. | - | Required | 
| spec.applicationSourceSelector.matchLabels | One or more key-valuepairs, where each pair is equivalent to a condition inmatchExpressions. If there are multiplekey-valuepairs, the AND operator is used.For example: 
 | object | Optional | 
| spec.applicationSourceSelector.matchExpressions | List of expressions, each with a key, anoperator, and a set ofvalues.The operatordefines the relationship between thekeyand itsvalues, and can be one of the following:
 key: codefresh.io/productandoperator: Existsapplies the Promotion Template to any application containing the labelcodefresh.io/product. | string | Optional | 
| spec.priority | The priority of the Promotion Template, determining the order in which Promotion Templates are applied when multiple Promotion Templates match the same application. The priority is ranked in ascending order, ranging from 0 or a negative number to higher values. | integer | Optional | 
| spec.versionSource | The location of the file and the attribute in the file from which to extract the product’s application release version. This is the version displayed in the Product, Environment, and GitOps Apps dashboards. | - | Required | 
| spec.versionSource.file | The file path relative to the application’s file path from which to extract the application’s release version. For example, chart.yamlindicates that the release version should be extracted from this file. | string | Required | 
| spec.versionSource.jsonPath | The JSON path expression pointing to the location of the attribute containing the application version within the specified file.For example, $.appVersionindicates the value should be extracted from the fieldappVersioninchart.yaml. | string | Required | 
| spec.promotion | The top-level element defining the specific changes to be promoted to the target environment, through a single or a list of <filename>:jsonPaths.jsonPathscan define the path to single or multiple attributes within the same file.When omitted, all changes in all applications connected to the Product are promoted. Examples: 
 | array | Optional | 
| spec.promotion.filename | The file path relative to the application’s file path from which to select properties to promote. | string | Optional | 
| spec.promotion.jsonPath | The JSON path expression pointing to the location of the attribute with the value to be promoted within the specified filename.For example, $.appVersionindicates the value should be extracted from the fieldappVersioninchart.yaml. | string | Optional |