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:
parent
1f77b89f27
commit
79ac3430ff
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue