Is their any option or plugin which can copy whole pipeline VSM for another environment

5 views
Skip to first unread message

Nayan Makwana

unread,
Jul 27, 2022, 5:29:41 AM7/27/22
to go-cd
I have more than 30 deployment server environment and I don't want to create each & every pipeline for all the environment. I tried templating option but it it not work in my scenario. so is there any plugin or api available to copy whole pipeline because  all environment have same resource and functionality ?

Thanks in Advance
Nayan MAkwana

Ketan Padegaonkar

unread,
Jul 27, 2022, 7:16:10 AM7/27/22
to go...@googlegroups.com
You can do a trigger with options on a pipeline — but that will almost certainly not provide any mechanism to visualize the state of your different environments.

You might possibly want to look at the groovy DSL plugin to basically create several pipelines for each environment using a simple for loop. See this for an example: https://github.com/gocd-contrib/gocd-groovy-dsl-config-plugin/blob/master/example/src/main/groovy/build_multiple_branches/build.gocd.groovy.

I believe it is possible to export an existing pipeline into groovy code, and then tweak with some looping mechanism to suit your needs. See screenshot below

- Ketan

Screenshot 2022-07-27 at 4.45.10 PM.png


--
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/ca38034d-f661-4c99-802c-05394986b010n%40googlegroups.com.

Ashwanth Kumar

unread,
Jul 27, 2022, 7:17:04 AM7/27/22
to go...@googlegroups.com
A few suggestions:
  1. By environment. if you're referring to Environments in GoCD, then you should be able to clone the pipeline and assign the environments accordingly after the clone. It's a few extra clicks but the easiest way.
  2. If you can convert the pipeline to YAML/JSON then you can use any of the pipeline as code libraries to write the plugins. This is the next best way to do that, and it also has benefits like easy maintenance and review into what changed directly as part of your code. This is the recommended approach if you already have pipelines as code or want to invest in it to decouple the whole process from GoCD.
  3. Another way is to copy the <pipeline>...</pipeline> parts of the (cruise-config) XML, change whatever that's needed and paste it (with a different value for the 'name="..."') so it becomes a new pipeline. Then update the <pipelines>...</pipelines> inside the <environment>...</environment> XML tags to associate them to the right environment. You might want to do this only with a maintenance window, so there aren't any external writes during that time to avoid missing changes.
As always, please always take a backup before attempting to play with the config XML so you can restore back in case of any issues. 

--
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/ca38034d-f661-4c99-802c-05394986b010n%40googlegroups.com.


--

Ashwanth Kumar / ashwanthkumar.in

Reply all
Reply to author
Forward
0 new messages