From c01fc051bcf8270346da7e1adae8cf3e303a808d Mon Sep 17 00:00:00 2001 From: Dave <18191844+its-dave@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:11:09 +0100 Subject: [PATCH] Issue #2557 - Add doc for exporting config from a groovy script --- docs/features/configExport.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/features/configExport.md b/docs/features/configExport.md index 8086413a91..4768b8fc75 100644 --- a/docs/features/configExport.md +++ b/docs/features/configExport.md @@ -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: + + 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,