Replacing "echo -e" with Heredoc

58 Views Asked by At

My jenkinsfile contains a really long one-line shell command to create gradle.properties. For better readability I replaced it with Heredoc. It does fail now though and I am unsure why. Can you spot the error?

One-liner that does not fail is in this format:

sh("echo -e \"\nSOME_KEY=${VARIABLE_1}\nANOTHER_KEY=${VARIABLE_2}\nYET_ANOTHER_KEY=${VARIABLE_3}\" >> gradle.properties")

Failing Heredoc format:

sh("""cat << EOF >> gradle.properties
SOME_KEY=${VARIABLE_1}
ANOTHER_KEY=${VARIABLE_2}
YET_ANOTHER_KEY=${VARIABLE_3}
EOF""")
0

There are 0 best solutions below