Groovy is a generic JVM-based scripting language. In the GoCD case, a groovy-based DSL has been modelled by the plugin that maps to GoCD's internal config repo API required to drive pipeline config from source control.
Since it's a generic scripting language, you can express things not possible within something like YAML or JSON (re-usable entire groups of pipelines or parts of pipelines, loops, arbitrary parameterisation, loops, ability to get some code completion inside a groovy-aware IDE). The groovy plugin specifically has some downsides related to security since plugins are not sandboxed within GoCD, and since it is an arbitrary scripting language - as well as the downsides to the Groovy language itself, or needing to learn another language. There are a number of examples to give you an idea of what might be possible, e.g one which generates a single pipeline with 'n' jobs: https://github.com/gocd-contrib/gocd-groovy-dsl-config-plugin/blob/master/example/src/main/groovy/build_matrix/build.gocd.groovy So essentially a plugin like the groovy config repo plugin allows an approach to generating pipelines programmatically with - a more manageable, decentralised model than generating GoCDs internal XML format programmatically with better support for validation of the generated pipelines before GoCD ingests the config - avoiding needing to make GoCD API calls to update pipeline or GoCD configuration XML (as was a common approach for some folks earlier that wanted to programmatically generate/manage pipelines) -Chad On Thu, Dec 26, 2024 at 3:55 PM Joshua Franta <[email protected]> wrote: > > yes, whatever im missing about artifacts is very in the weeds. > irrespective of the audience, for oss i usually write posts as if no one > will ever respond. > > i have written few posts here but i get a response more than i would > generally expect fwiw. > > i looked at groovy briefly but i'm not sure i understand, it's a different > syntax that is more compact? > and can it then autogenerate the existing gocd configuration? so then you > don't need templates? > > if i just generated a config file programmatically, would this also solve > the same problems (and probably quite a few others)?? > is groovy is a dsl for gocd configs? > > > > > > > > On Thu, Dec 26, 2024 at 1:38 AM Chad Wilson <[email protected]> > wrote: > >> I haven't gone through the thread as it became a bit difficult/time >> consuming for me to digest, however if I understand the general "gist" of >> your challenge it's fair to say that the philosophy of GoCD was moving >> increasingly towards pipelines-as-code for a number of years, rather than >> templates (which were always going to have limitations). >> >> There's a related discussion at https://github.com/gocd/gocd/issues/5675 >> which goes into some of why templates-inside-config-repos are not supported >> - in a sense the pipelines-as-code philosophy via config repo plugins was >> intended to support much more sophisticated approaches to templating and be >> the "native" approach that allows necessary flexibility. >> >> This was manifested along the lines of the groovy plugin >> <https://github.com/gocd-contrib/gocd-groovy-dsl-config-plugin> earlier >> mentioned, or the jsonnet plugin >> <https://github.com/getsentry/gocd-jsonnet-config-plugin> (note, I have >> never used the latter, and do not know of its pros/cons other than from a >> theoretical perspective). The main design goal was to move people away from >> click-opsing pipelines or groups-of-pipelines/VSMs entirely, which >> templates implied. >> >> Defining ones own custom templating approach (like gocd >> templates/parameters) is inherently always going to be more limited than a >> general purpose templating/scripting language which allows assembling the >> "pieces" (GoCD domain concepts) in a variety of ways, and allows modelling >> the "shared/common components" of pipelines or sets-of-pipelines >> dynamically. >> >> -Chad >> >> On Thu, Dec 26, 2024 at 3:01 PM Joshua Franta <[email protected]> >> wrote: >> >>> thanks again for your efforts jason >>> >>> TL;DR >>> >>> for those interested, all the stuff about resources i referenced should >>> be in the forum search >>> >>> i really do like/love gocd. bc of templates and pipelines tho, i think >>> being able to do fetches for multiple upstreams/downstreams via parameters >>> should be more "native" >>> my .02 ymmv (my PR is in the mail, the actual mail not the forum mail ;) >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "go-cd" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion visit >>> https://groups.google.com/d/msgid/go-cd/CABr%2BOtrDdOS_d7iiFebgypAQL5%2BW%3DtsHcb1oKhUAqT%2B_%2B7EYAA%40mail.gmail.com >>> <https://groups.google.com/d/msgid/go-cd/CABr%2BOtrDdOS_d7iiFebgypAQL5%2BW%3DtsHcb1oKhUAqT%2B_%2B7EYAA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "go-cd" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/go-cd/7HMOd1Z_3oM/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion visit >> https://groups.google.com/d/msgid/go-cd/CAA1RwH_d4c9bEL7bXMvP_FAGFv8Abe%2B6h%3D4D2AFyU8%3DeJotmPA%40mail.gmail.com >> <https://groups.google.com/d/msgid/go-cd/CAA1RwH_d4c9bEL7bXMvP_FAGFv8Abe%2B6h%3D4D2AFyU8%3DeJotmPA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "go-cd" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/go-cd/CABr%2BOtrqvsY%3DaJAhc__6O57Q8mawt7LcEQS5GBTidbv6esis0A%40mail.gmail.com > <https://groups.google.com/d/msgid/go-cd/CABr%2BOtrqvsY%3DaJAhc__6O57Q8mawt7LcEQS5GBTidbv6esis0A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "go-cd" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/go-cd/CAA1RwH-x6HT-0%3D8Gb1LM%2BQG7CCxF4P1Zt%2BZhq6tvgcce_Eppcg%40mail.gmail.com.
