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

Document exporting configuration from a groovy script #2557

Open
its-dave opened this issue Sep 5, 2024 · 0 comments
Open

Document exporting configuration from a groovy script #2557

its-dave opened this issue Sep 5, 2024 · 0 comments

Comments

@its-dave
Copy link
Contributor

its-dave commented Sep 5, 2024

What feature do you want to see added?

There are use cases for being able to export the JCasC config programmatically (for instance identifying changes that have been made in the Jenkins UI), however the docs do not mention how to do so (whereas the reload docs do). There are also other issues (#1373 and #2175) requesting this functionality.

It appears to be possible to export the config from a groovy script using this code:

import io.jenkins.plugins.casc.ConfigurationAsCode
def stream = new ByteArrayOutputStream()
ConfigurationAsCode.get().export(stream)
stream.toString()

The export method is annotated with @Restricted(NoExternalUse.class) which implies this is not intended to be available, however the process appears to work without issue.

Is there any reason not to officially document this process?

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