we add a new web server called WEB5 and want to redeploy to WEB5 all latest deployed releases which are deployed only to “Development” environment, and have target role “Webservers” where are all WEB1-4 servers. As WEB1-4 will be deleted at one moment, this is practically migration.
Your previous post works for us, but it will redeploy latest deployments which are marked as “Development” to all target roles. And we want only to redeploy “Development” to target role “Webservers” where we include a new WEB5. In that case, we’ll have consistent environments to all web servers and then we can power off one old node (WEB1-4 servers). Trigger part won;t work as it will take a lot of time to setup trigger to each project.
Hope this is make sense, let me know if need to clarify a bit.
You can create a deployment to a specific machine via the API if you know the ID of the machine. This is not supported using Octo.exe so you would need to write some custom API script to do it. I can help if you’d like.
It sounds like you could use automatic deployment triggers that will deploy to the WebServers role in the Development environment. You could create the triggers programmatically on all of the projects with an API script, I can also help with that if you want.
If it is possible to create the trigger to all projects from one shot, then this might be useful. I didn;'t work with API in the past, this is all new to me.
How to trigger deployments to a new node with WebServer role in the Deployment environment?
Here is an example PowerShell script you could use to create project triggers for all of your projects:
The script is idempotent as long as the script name remains the same, so you can re-run this script when you add new projects or change the action and filter options and will not create duplicate triggers.
It seems it won’t put the right trigger role in the trigger. Whit this code, it creates the trigger, where environment is DEV and target roles are DEV. variable $triggerRole = "Web-server only applies in the name of the trigger. And we need target role to be Web-server.
Exception calling "FindByName" with "1" argument(s): "Unable to process response from server:
Requested value 'DailySchedule' was not found.. Response co
At C:\Users\adm-bradjur\Desktop\DeleteTriggers.ps1:11 char:1
+ $triggers = $repository.ProjectTriggers.FindByName("Automatically dep ...
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : OctopusDeserializationException
Thank you for your help!
I’ll try to figure this out and let you know for the outcome.
PS. Not sure why this error occurs, but after rebooting the server, script is working, except it only delete trigger from one project (one trigger). Each time I execute script, it delete one trigger by one.