Add doc for exporting config from a groovy script (#2564)

Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
This commit is contained in:
Dave 2024-09-24 20:11:17 +01:00 committed by GitHub
parent 1f77b89f27
commit 79ac3430ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -1,7 +1,15 @@
# Exporting configurations
The plugin supports exporting existing configurations as YAML.
This is a feature available to the Jenkins administrators under the `http://[your_jenkins_url]/configuration-as-code/` URL.
This can be achieved with the following options:
* Accessing the `http://[your_jenkins_url]/configuration-as-code/` URL as a Jenkins administrators and pressing `Download Configuration`
* Running the following in a Groovy script (not recommended, uses internal APIs):
import io.jenkins.plugins.casc.ConfigurationAsCode
def stream = new ByteArrayOutputStream()
ConfigurationAsCode.get().export(stream)
println stream.toString()
Export feature is **NOT** intended to offer a directly usable jenkins.yaml configuration.
It can be used for inspiration writing your own production-ready YAML, but be aware that export can be partial,