Is it possible to script the addition and removal an Environment from a Lifecycle Phase using the Octopus Client? Or should I look into doing this via the API?
Thanks for reaching out! You can do this with bout the API and the Octopus.Client (which is basically a wrapper around the API).
If you rather use the Octopus Client (which I recommend over using raw API), you basically need to
the following is mostly pseudo-c#
repository.Lifecycles.Get(lifecycleId)to get your lifecycle.
- remove/add the desired phases from the
Lifecycleobject you received in (1).
- Finally, save the modified
lifecycleobject back to the database using into
Let me know if that helps. Otherwise I can jump into my IDE and write actually working code for you.
Thanks. You have helped by pushing back my ignorance a little further. I was missing the final line to save the changes.
Glad to hear that! Cheers
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.