Pipeline templates as Code

47 views
Skip to first unread message

Helge Walter

unread,
Jul 13, 2020, 6:52:14 AM7/13/20
to go-cd
Hello,

is it possible to define pipeline templates via Config Repository?

Regards
Helge

Joel Sdc

unread,
Jul 13, 2020, 12:30:49 PM7/13/20
to go...@googlegroups.com
Hi Helge, 


There are some pros/cons when moving to config repos, so make sure your setup doesn't break when you migrate.

Joel.

--
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 go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/49a139e5-23c8-4211-a5f9-56b75da1baa0o%40googlegroups.com.

Helge Walter

unread,
Jul 14, 2020, 3:10:09 AM7/14/20
to go-cd
Hello Joel,

thanks for the reply.
I know that managing pipelines using config repositories is possible but how about pipeline templates?
This is not mentioned in the docs and there is also no possibility to export a pipeline template on the GUI.

Sure, it would be possible to store the templates as JSON in a repository for development and setup some cron job on the GoCD server to replicate them into the system using the API, but this is a somehow humble approach if you know the config repository approach.

Regards
Helge

kritik...@thoughtworks.com

unread,
Jul 14, 2020, 3:17:20 AM7/14/20
to go-cd
Hi,

There is a conversation on this issue: https://github.com/gocd/gocd/issues/5175 regarding support of templates in config-repo. Take a look at this comment: https://github.com/gocd/gocd/issues/5175#issuecomment-422883413

Please feel free to add your views/opinions

Thanks
Kritika

Helge Walter

unread,
Jul 14, 2020, 11:30:16 AM7/14/20
to go-cd
Hello Kritika, thank you for the link to the discussion (which is closed).

I see that managing of the templates can be a little more complicated as I thought. I only had my usecase in mind which implied that referencing pipelines will always use the current implementation of the template and not some fixed version of the template from the past. But the current implementation of templates in GoCD doesn't support this either.
If you think the mentioned versioning concept of pipeline templates a little bit further you will come to the conclusion, that you need this for pipelines too. You have some upstream / downstream pipeline dependencies which might only work with some fixed pipeline version, e.g. the artifacts may change in an upstream pipeline and then the downstream pipeline will stop working.

For me it would be totally valid to resemble the current behaviour of GoCD in a "Pipeline Templates as Code" scenario.

PS: Versioning of templates could be easy too ... If you introduce a breaking change then create a new template and put a "V2" at the end of the name ;)

Regards
Helge


Aravind SV

unread,
Jul 16, 2020, 8:17:59 AM7/16/20
to Helge Walter, go-cd

Hello Helge,

Yes, there has been a lot of discussion around templates in config repos. I’ll link to some more conversations below.

Unfortunately, there is no plan to incorporate GoCD’s templates into config repos. Tomasz, the author of configuration repositories, has mentioned a few times that he thinks that the GoCD templates are not flexible enough and he believes that it’s better to have a separate templating mechanism.

Some relevant conversations are here:

The one that is closest to templates and a work in progress that is coming along well is: https://github.com/gocd/gocd/issues/6123 – This is about branch support, but it considers templating as a way to get to it.

Another approach for templating might be to look into the Groovy DSL plugin.

Cheers,
Aravind

PS: Apologies for the link spam. :)

Reply all
Reply to author
Forward
0 new messages