forward slash in property name causing error
nuppal-wahbe opened this issue · comments
The property name - "metadata.labels.app.kubernetes.io/component" in my YAML files is causing below error.
Error: Error: Lexical error on line 1. Unrecognized text.
...ls.app.kubernetes.io/component
-----------------------^
Is there an escape character that I can use for the forward slash in the property name?
I tried below code - based another closed issue
update service-creation.yaml files for deployment
- name: Update values.yaml
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'deployment/service-creation.yaml'
commitChange: false
changes: |
{
"metadata.labels.app": "${{ inputs.ApplicationName }}",
"$['metadata.labels.app.kubernetes.io/component']": "${{ inputs.ApplicationName }}",
"$['metadata.labels.app.kubernetes.io/instance']": "${{ inputs.ApplicationName }}",
"$['metadata.labels.app.kubernetes.io/name']": "${{ inputs.ApplicationName }}",
"metadata.name": "${{ inputs.ApplicationName }}",
"metadata.namespace": "${{ inputs.AroProjectName }}-${{ inputs.Envrn }}",
"spec.selector.deployment": "${{ inputs.ApplicationName }}"
}
The workflow didn't throw an error, but the value for three properties with / character didn't update.
I think it shoud look like:
- name: Update values.yaml
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'deployment/service-creation.yaml'
commitChange: false
changes: |
{
"metadata.labels.app": "${{ inputs.ApplicationName }}",
"metadata.labels['app.kubernetes.io/component']": "${{ inputs.ApplicationName }}",
"metadata.labels['app.kubernetes.io/instance']": "${{ inputs.ApplicationName }}",
"metadata.labels['app.kubernetes.io/name']": "${{ inputs.ApplicationName }}",
"metadata.name": "${{ inputs.ApplicationName }}",
"metadata.namespace": "${{ inputs.AroProjectName }}-${{ inputs.Envrn }}",
"spec.selector.deployment": "${{ inputs.ApplicationName }}"
}
Great, it worked.