Hi.
I need the last successful deployment release number so I can cleanup during the new deployment, how do I get it? I know there is an Id for this, but that won’t suit my needs, for the cleanup, I need the release number.
Is there a way I can get it?
If not, can I use the API from within a step to fetch it using the Id ? How?
Thanks
Hi Ricardo,
Thanks for reaching out. This API script should work: https://github.com/OctopusDeploy/OctopusDeploy-Api/blob/master/REST/PowerShell/Releases/GetLastSuccessfulForProjectAndEnvironment.ps1
Let me know how that goes.
Regards,
Dalmiro
Hi Dalmiro.
From within a Step I still need to provide the URL and API Key or is there a way I can skip that?
Thanks.
Hi Ricardo,
For the URL you can use this Octopus variable:
$OctopusURL = $OctopusParameters[‘Octopus.Web.BaseUrl’] #Octopus URL
For the API Key the best you can do is create a Sensitive Variable and use it on the script. This will at least keep the API key from showing in clear text on the logs.
Regards,
Dalmiro
thanks Dalmiro, appreciate it!