In the Octopus Deploy API (Github project), I see that there are scripts for creating a lifecycle and setting retention policies, but none that impacts phases or environments. Is there something that I can use to specifically add an environment to a phase of an existing lifecycle?
If not, could you please provide some hints as to how I could leverage these functionalities? Say, scripts that do similar operations perhaps?
Thanks for getting in touch! Unfortunately I haven’t yet had adequate time to dedicate in writing a custom script to accomplish this, but checking the API calls via the browser’s dev tools that are made when adding an environment to a phase via the UI might help you get going. You’d have to GET the lifecycle, update the OptionalDeploymentTargets parameter (or AutomaticDeploymentTargets if you want it to auto-deploy to this new environment when it hits that phase) in the given phase and then POST it back.
I hope this helps! Let me know how you go or if you have any further questions moving forward.