-1

In my scripted pipeline, I have a shell script that performs helm upgrade and I have also set some environment variables like below:

sh """helm upgrade --install ${someVar} chart-hub/java-${javaVersion} \
...
--set env.vars[1] .name=some_name_here \
--set env.vars[1] .value="123abcdefhgj3457u" \
--set env.vars[2] .name=some_other_name_here \
--set env.vars[2] .value="true" 
...

Things were working well until I added --set env.vars[2] .name=some_other_name_here \ and --set env.vars[2] .value="true" to my pipeline script . I am getting the error ...ReadString: expects " or n but found t, error found in #10 byte of ...|, "value":true}], ...

I have tried enclosing the value like: 'true', "'true'" and even storing true in a variable and then assigning the variable to --set env.vars[2] .value="${myVar}" but the error persists.

Any idea what I'm doing wrong, or solutions I could try? Thanks in advance

Omo
  • 23
  • 1
  • 8
  • 1
    This sounds like the type casting from Groovy to shell to Golang between the interpreters is recasting the string to a boolean. I would heavily suspect the shell interpreter is recasting the type. You could write the values with the `writeYaml` method and provide that file as an argument for the values to `helm upgrade`. Would that be ok for your environment? – Matthew Schuchard Sep 23 '21 at 20:14
  • Worth a short. I am at my wits end lol but if there is an alternative to storing the value in a separate file, I will be open to that as well. Thanks so much. – Omo Sep 23 '21 at 20:29
  • The file would only exist in the job workspace, so it would just be an alternative interface and pipeline code. – Matthew Schuchard Sep 23 '21 at 21:03
  • Thanks. Would you mind writing it out as an answer? – Omo Sep 23 '21 at 21:09

1 Answers1

1

To remove the error ReadString: expects " or n but found t, error found in #10 byte of ...|, "value":true}], ...

Enclosing the true value like '"true"' worked for me.

Omo
  • 23
  • 1
  • 8