fjogeleit / yaml-update-action

Update YAML property with dynamic values

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when PropertyPath contains hyphens

NabilCC opened this issue · comments

Hi there,

We have just started noticing an issue when the YAML update plugin throws an error when the value for propertyPath contains a hyphen (for example: services.my-service.build-no):

Error: Error: Lexical error on line 1. Unrecognized text.
$.services.my-service.build-no
--------------^

This issue seems to have been introduced recently, since our pipelines have been working up until now when using hyphens.

Many thanks in advance for any assistance you can offer!

Hey thanks for reporting, yes. This issue is caused by the switch from my custom implementation to jsonpath in v0.7.0

You can have a look into #428. The solution should be similar in your case.

propertyPath: 'services["my-service"]["build-no"]'

Hi @fjogeleit

Thank you for responding so quickly.

I can confirm that changing the property path to the following has fixed the issue:

services["${{inputs.service}}"][build-no]

Thank you for confirming and thanks for using this action. So, I close this issue - let me know if you have any other feedback or issues.

@fjogeleit In my case I have the hypened element in the beginning. Doing this causes an error:

propertyPath: '["helm-example"].image.tag'
Any tips?

Nevermind I was able to access using . in start:

propertyPath: '.["helm-example"].image.tag'