I’m continuing to work on scripting adding a new environment, a channel to an existing project, a new lifecycle and then create a copy of the variables (both in local variables and variable sets) assigned to the previous environment and scope them to the new environment.
I’m doing this via powershell. Two things I’m stuck on (I haven’t gotten to the variables yet).
I’m looking at Lifecycles and retention policies. I’ve found this example: https://github.com/OctopusDeploy/OctopusDeploy-Api/blob/master/Octopus.Client/PowerShell/Lifecycles/CreateLifecycleWithPhase.ps1, however when I use the syntax there, it can not (with 3.3.6) find “new” and so that it fails. I’ve looked at LifeCycle.ReleaseRetentionPolicy and it expects a Octopus.Client.Model.RetentionPeriod, so it appears that either I’m stuck creating one manually, or finding one to borrow from, or I’m missing something.
I’m trying to do a find on Channels so I can rerun the script and not error out with a duplicate channel. In trying to do a repository.Channels.findByName(“Blah”) I’m getting a message Exception calling “FindByName” with “1” argument(s): “” except that when I look at autocomplete in Powershell, that is exactly what it is looking for. Knowing that channels are also project specific, I’m also not completely clear on whether I’m supposed to be passing in the string for the projectName or channelName. It would seem both would be necessary, but if there isn’t a method… I also did try “findOne” using the ChannelResource I use to create the channel, however that also did not find the channel and then fails because it exists.
Preventice Services, LLC and Preventice Technologies, Inc. are part of the Preventice Solutions Group of companies and are independent, wholly owned subsidiaries of Preventice Solutions, Inc.
This message contains confidential information and is intended only for the sole use of the addressed recipient(s). If you are not one of these recipients you should not disseminate, distribute or copy this e-mail. Please notify the designated recipients immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmissions cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender, therefore, does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.