Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaping variables is not documented #2517

Open
sodul opened this issue Jun 21, 2024 · 2 comments
Open

Escaping variables is not documented #2517

sodul opened this issue Jun 21, 2024 · 2 comments

Comments

@sodul
Copy link

sodul commented Jun 21, 2024

Describe your use-case which is not covered by existing documentation.

We have a Tools script that we install through CasC. Somehow after upgrading from configuration-as-code:1775.v810dc950b_514 to configuration-as-code:1810.v9b_c30a_249a_4c all of our ${var} entries got replaced with empty values, even though the embedded scripts look fine under ~/casc_configs.

After fixing the scripts and dumping them from the CasC config page we noticed that these ${var} entries are escaped with ^${var}.

We did find a bug from 2020 which mention this is well documented but we could not find any reference to this in the documentation.

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

https://plugins.jenkins.io/configuration-as-code/

#1429

@sodul sodul added the documentation A PR that adds to documentation - used by Release Drafter label Jun 21, 2024
@timja
Copy link
Member

timja commented Jun 22, 2024

As mentioned in the linked comment its documented in the secrets documentation as its the secrets engine that replaces the placeholders: https://github.com/jenkinsci/configuration-as-code-plugin/blob/ebadef8587127ae274940c118763b738a7251152/docs/features/secrets.adoc#passing-secrets-through-variables

if you'd like to propose an enhancement that would we welcome

@sodul
Copy link
Author

sodul commented Jun 24, 2024

In our case we are not passing secrets in CasC, but a shell script to be used under the Tools configuration. The odd thing is that we did not change our CasC for the tools in several month but after upgrading to the latest LTS and plugins, the Tools Scripts got all the ${blah} entries swallowed. So something has changed in recent weeks, but it looks like the variables should have been escaped.

It is good to see that the docs for passing secrets does mention "^${some_var}" but it should probably be mentioned on the main page of the plugin since this is not something specific to secrets but to any variable that might be used in CasC.

@timja timja removed the documentation A PR that adds to documentation - used by Release Drafter label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants