I’m trying to implement https://github.com/OctopusDeploy/Issues/issues/2984 on a step of my deployment which has multiple children steps, but I am unable to create the release from within TeamCity.
Because the UI for the setting seems to have disappeared in a more recent update (I unfortunately do not know which one), the JSON configuration for the parent step looks as follows:
{
"Id": "f2d212cb-fd05-4f88-8efb-0d2087ad6a70",
"Name": "Phase 2",
"RequiresPackagesToBeAcquired": false,
"Properties": {
"Octopus.Action.TargetRoles": "Product2",
"Octopus.Action.ConditionVariableExpression": "#{Product2-RunPhase2}"
},
"Condition": "Variable",
"StartTrigger": "StartAfterPrevious",
"Actions": [
{
.
.
.
The #{Product2-RunPhase2} is a Checkbox project variable template, defaulted to True, and ultimately controlled via tenant settings.
I have a step during our TeamCity build process to create the Octopus release and begin deploying it to our first environment. This is the output of that step:
[13:53:09] Step 14/14: Create [ProjectName] release (OctopusDeploy: Create release) (1s)
[13:53:09] Octopus Deploy (1s)
[13:53:09] Running command: octo.exe create-release --server [Address] --apikey SECRET --project [ProjectName] --enableservicemessages --channel Development --deployto Development --tenant *
[13:53:09] Creating Octopus Deploy release
[13:53:09] Octopus Deploy Command Line Tool, version 4.2.1+Branch.master.Sha.f03df48788281de4b58d6e76c607bc0beeff1369
[13:53:09]
[13:53:10] Build environment is Handshaking with Octopus server: [Address]
[13:53:10] Handshake successful. Octopus version: 3.7.16; API version: 3.0.0
[13:53:10] Authenticated as: Build User <null> (a service account)
[13:53:10] This Octopus Server supports channels
[13:53:10] Finding project: [ProjectName]
[13:53:10] Building release plan for channel 'Development'...
[13:53:10] Finding deployment process...
[13:53:10] Unable to process response from server: Error converting value "Variable" to type 'Octopus.Client.Model.DeploymentStepCondition'. Path 'Steps[1].Condition', line 74, position 29.. Response content: {
[13:53:10] "Id": "deploymentprocess-Projects-161",
[13:53:10] "ProjectId": "Projects-161",
[13:53:10] "Steps": [
[13:53:10] {
[13:53:10] "Id": "2969392c-92a8-4076-b50a-eb889dcd9e44",
[13:53:10] "Name": "Phase 1",
[13:53:10] "RequiresPackagesToBeAcquired": false,
[13:53:10] "Properties": {
[13:53:10] "Octopus.Action.TargetRoles": "Product1"
[13:53:10] },
[13:53:10] "Condition": "Success",
[13:53:10] "StartTrigger": "StartAfterPrevious",
[13:53:10] "Actions": [
[13:53:10] {
[13:53:10] "Id": "b5bf29bf-e7f2-4cb4-8fb2-05065aa99215",
[13:53:10] "Name": "Phase 1",
[13:53:10] "ActionType": "Octopus.TentaclePackage",
[13:53:10] "IsDisabled": false,
[13:53:10] "Environments": [],
[13:53:10] "ExcludedEnvironments": [],
[13:53:10] "Channels": [],
[13:53:10] "TenantTags": [],
[13:53:10] "Properties": {
[13:53:10] "Octopus.Action.EnabledFeatures": "Octopus.Features.CustomDirectory,Octopus.Features.IISWebSite,Octopus.Features.ConfigurationVariables,Octopus.Features.ConfigurationTransforms",
[13:53:10] "Octopus.Action.Package.Automaticall
[13:53:10] Error from Octopus server (HTTP 200 OK)
[13:53:10] Exit code: -7
[13:53:10] Octo.exe exit code: -7
[13:53:10] Unable to create or deploy release. Please check the build log for details on the error.
[13:53:10] Step Create RoydanAPI release (OctopusDeploy: Create release) failed
I have not tested this with a non-parent/child step, but in our case we want to prevent a block of steps from being run based on this condition, so the parent step seems to be the best place to put this.