Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Targeting an Orchestration Job to an Environment or Plan - am I missing something?
-
I have been evaluating Otter recently, but am coming up against a problem. To simplify it to its basic level, I don't think assigned Roles are being correctly determined when running Plans, which is having a knock-on effect on determining which Server is in scope when using Plans that target a Role or Envrionment.
In my evaluation environment, I have a Role,
DatabaseServer
, and a small Environment hierarchy which represents an application:App
App Live
App SIT
App UAT
So far, I have defined a Server
Server001
, and assigned it to theApp SIT
environment andDatabaseServer
role.I build an Orchestration Plan -- which, to simplify the problem, just logs various variables:
Log-Information Current = $ToJson(%(Server: $ServerName, Environment: $EnvironmentName, Role: $RoleName, IsSimulation: $IsSimulation)); Log-Information ServersIn = $ToJson(%(Env: @ServersInEnvironment(), Role: @ServersInRole(), RoleAndEnv: @ServersInRoleAndEnvironment())); Log-Information All = $ToJson(%(Envs: @AllEnvironments(), Roles: @AllRoles(), Servers: @AllServers()));
From here, I use the tie(?) icon to create a number of jobs, each targeting in different ways:
-
If I target
Server001
specifically, the result seems to show the server and environment correctly, but not the role:Skipping collection run; execute only. Collection run succeeded. Beginning execution run... Current = {"ServerName":"Server001","Environment":"App SIT","Role":"","IsSimulation":"true"} ServersIn = {"Env":["Server001"],"Role":[],"RoleAndEnv":[]} All = {"Envs":["App","App Live","App SIT","App UAT"],"Roles":["DatabaseServer"],"Servers":["LOCALHOST","Server001"]} Cleaning up temporary files on Inedo Agent (v??, Server001:46336)... Execution run complete. Execution run succeeded.
-
If I target the
DatabaseServer
role specifically, I don't get any matched server, environment or role:Skipping collection run; execute only. Collection run succeeded. Beginning execution run... Current = {"Server":"","Environment":"","Role":"","IsSimulation":"true"} ServersIn = {"Env":[],"Role":[],"RoleAndEnv":[]} All = {"Envs":["App","App Live","App SIT","App UAT"],"Roles":["DatabaseServer"],"Servers":["LOCALHOST","Server001"]} Execution run complete. Execution run succeeded.
-
If I target the
App SIT
environment, the result shows the environment, but empty server and role values:Skipping collection run; execute only. Collection run succeeded. Beginning execution run... Current = {"Server":"","Environment":"App SIT","Role":"","IsSimulation":"true"} ServersIn = {"Env":[],"Role":[],"RoleAndEnv":[]} All = {"Envs":["App","App Live","App SIT","App UAT"],"Roles":["DatabaseServer"],"Servers":["LOCALHOST","Server001"]} Execution run complete. Execution run succeeded.
-
If I target both the
App SIT
environment and theDatabaseServer
role (by filling in both fields), I get the same as in #3.
I believe this is causing my overall problem, where Jobs that apply Plans targeting Servers are successful, but those that target Roles and/or Environments are failing with
This operation requires a valid server context. Use a "for server ..." block to set the server context.
, but I don't know how to resolve this. I thought I might have to use a Loop block to iterate over@ServersInRoleAndEnvironment
, but this list variable appears to be empty in all the above cases, so I'm not sure where to go here.This seems (to me) like a fundamental thing that Otter should do for me, so I must be missing something obvious, but I just can't seem to reason about it.
Product: Otter
Version: 2.0.12
-
Hi Jim,
Apologies for the lack of response here, but I wanted to let you know that we had quite a bit of back-and-forth internally on this post and implemented nearly all of your expectations:
- you are absolutely correct about the variable context not behaving as expected, and
- the biggest problem was that the behavior of certain variables (particularly
$RoleName
) was undefined - we've updated the docs to reflect the "new" behavior in the latest version (v2.1.0 at the time of this post): https://inedo.com/support/documentation/otter/core-concepts/jobs#orchestration-job-context
- we release v2.1.0 last night with these changes included
Thank you again for the detailed report and reproduction steps.