I have two production environments, one deploys to my EU data centre and other to our US data centers. I’m not currently using tenants but in my project, I have steps that use worker pools and I want to use region-specific worker pools depending on which environment I’m deploying to. Is this possible?
That’s a great question!
When choosing a Worker Pool in a step, you can choose to use a Worker Pool variable instead. Using a Worker Pool variable allows you to scope each Worker Pool to different environments and, in this case, will enable steps to run on specific Worker Pools depending on the environment you’re deploying too.
I’ve created an example of how to use the Worker Pool variables below.
Firstly, you need to create two Worker Pools. In my example, I’ve created a worker pool for my EU data center and US equivalent.
Next, in our project, we need to create a new variable. In my case, I’ve called this Project.WorkerPool and we need to change the value type to Worker Pool. Add two values to the variable, one for the EU worker pool and a second the US worker pool and scope each value to your desired environments. In my case, I’m scoping EU Worker Pool to Production EU and US Worker Pool to Production US.
Now we just need to tell our steps that use worker pools to use our new variable. Edit or create your step and select Run Once on a worker than in the worker pool settings select Runs on a worker from a pool selected via variable and select the variable we created earlier.
And that’s it! When you do your deployment Octopus will use the scoped worker pool on each step depending on the environment you’re deploying too
For more information on worker pool variables, please see https://octopus.com/docs/projects/variables/worker-pool-variables.