-
Notifications
You must be signed in to change notification settings - Fork 313
Description
Checklist
- [ X] I've searched the issue queue to verify this is not a duplicate feature request.
- [ X] I've pasted the output of
kargo version, if applicable.
kargo version -> 1.7.4
Proposed Feature
Optional Variable in promotion task
Motivation
While using the same promotion task for different environments and using variable to pass them throught setValues. in helm-template step, easy example here using a variable called variablename:
Example error:
admission webhook "promotion.kargo.akuity.io" denied the request: failed to inflate Promotion steps: inflate tasks steps for task "promote" ("promote"): missing value for variable "variablename"
vars:
- name: variablename
- uses: helm-template
config:
path: ${{ vars.srcPath }}/stages/app
buildDependencies: true
namespace: ${{ vars.appNamespace }}
valuesFiles:
- ${{ vars.srcPath }}/stages/app/values.yaml
setValues:
- key: key1.key2.key3
value: ${{ vars.variablename }}
Let's say the stage of dev passes that variable, so no error, but stg doesn't need that variable and to have the flow cleaner dont want to pass a dummy variable.
Example on how to pass variables from the stage dev that works fine :
apiVersion: kargo.akuity.io/v1alpha1
kind: Stage
metadata:
name: dev
spec:
......
vars:
- name: variablename
value: "value1"
Example on how to pass variables from the stage stg that returns an error when promoting :
apiVersion: kargo.akuity.io/v1alpha1
kind: Stage
metadata:
name: stg
spec:
......
vars:
- name: variablename
value: ""
So imagine we can put in the pomotiontask a variable for each variable that handled if the variable is required or not, example here following the previous:
vars:
- name: variablename
- uses: helm-template
config:
path: ${{ vars.srcPath }}/stages/app
buildDependencies: true
namespace: ${{ vars.appNamespace }}
valuesFiles:
- ${{ vars.srcPath }}/stages/app/values.yaml
setValues:
- key: key1.key2.key3
value: ${{ vars.variablename }}
required: false
So in that case we would not receive the error above