Pipeline scripts are a subset of groovy, so you may want to look in the direction of the available groovy AST modification methods. I am not sure how well it will work on declarative (though it should), but it's the best bet I believe.
On Wed, Oct 2, 2019 at 12:07 AM Jeff Sault <[email protected]> wrote: > Thanks but i dont think it suits in my case, i need to update a bunch of > jenkinsfiles owned by other teams. Surely theres a way to parse a > Jenkinsfile into an object, make changes and then write the updated > Jenkinsfile back out to the filesystem? > > On Tuesday, October 1, 2019 at 4:59:44 PM UTC+1, jeremy mordkoff wrote: >> >> I use a templating tool (m4) so I can build up a groovy script using >> macros. In the first stage of my Jenklinsfiie, I call a bash script that >> generates a groovy script, which I then load and execute. The loaded script >> has N stages. Note that if the ordering of your stages changes, jenkins >> will stop showing history, so I try to always add stages at the end. >> >> >> >> On Tuesday, October 1, 2019 at 11:43:25 AM UTC-4, Jeff Sault wrote: >>> >>> Does anyone know of any libraries/tools that will allow me to >>> add/remove/update sections of a Jenkinsfile programatically? I have a load >>> of different projects which I need to update to include some new mandatory >>> parameters. I'd like to go down the 'shared library' route but in this >>> instance its not really possible. Parsing the jenkinsfile is non-trivial >>> but I assume theres something in groovy/jenkins land which can already do >>> the job. >>> >>> Thanks >>> Jeff >>> >> -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/db51294d-c934-47bf-87f7-a3f113cf618d%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/db51294d-c934-47bf-87f7-a3f113cf618d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Website: http://earl-of-code.com -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfef6KVgshTrvR6DtaOwZ20hz431%3DSKC%3DWLOi0u0Fe4FQ%40mail.gmail.com.
