Skip to content

Commit

Permalink
Issue #2557 - Add doc for exporting config from a groovy script
Browse files Browse the repository at this point in the history
  • Loading branch information
its-dave committed Sep 20, 2024
1 parent 505fa84 commit c01fc05
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/features/configExport.md
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit c01fc05

Please sign in to comment.