Ross Ellerington
Ross Ellerington

Reputation: 149

Octopus Deploy JSON Configuration Variable Feature not working

I must be missing something simple with this JSON Configuration Variable feature. I have the following JSON:

 {
  "EventProcessorFactory": "Factory"
  "HubConfiguration": [
    {
      "ArchiveStorageConnectionString": "Connection string"
      "ArchiveStorageContainerName": "containerName"
      "EventHubGroupName": "ehs-peds-dev"
    }
  ],
  "HeartBeatConfiguration": {
    "EventHubGroupName": "GroupName",
    "EventHubName": "HubName"
    "SharedAccessKey": "AccessKey"
    "SharedAccessKeyName": "EventPublishers",
    "EndPointURL": "URL"
  }
}

I want to replace the ArchiveStorageConnectionString (and other properties of HubConfiguration) but I can't figure out what the correct syntax is. HubConfiguration is an array of HubConfigurations (although in this case I only have 1).

I've tried

HubConfiguration:1:ArchiveStorageConnectionString 

But that doesn't work. I've also tried

 HubConfiguration:0:ArchiveStorageConnectionString 
 0:HubConfiguration:0:ArchiveStorageConnectionString 
 1:HubConfiguration:1:ArchiveStorageConnectionString 

but none of this seem to work. Any pointers would be greatly appreciated.

Upvotes: 1

Views: 2195

Answers (1)

Paul Stovell
Paul Stovell

Reputation: 32715

The Octopus code that matches and replaces the variables is here:

https://github.com/OctopusDeploy/Calamari/blob/949008eaaafb8865305c7760e8f8448a5eaabb1a/source/Calamari/Integration/JsonVariables/JsonConfigurationVariableReplacer.cs

Some unit tests are here:

https://github.com/OctopusDeploy/Calamari/blob/949008eaaafb8865305c7760e8f8448a5eaabb1a/source/Calamari.Tests/Fixtures/JsonVariables/JsonConfigurationVariableReplacerFixture.cs

I would have expected this to work:

HubConfiguration:0:ArchiveStorageConnectionString

There does seem to be a problem with your JSON - this line should end with a ,:

"EventProcessorFactory": "Factory"

Do you get any output in your deployment when the convention runs?

Upvotes: 3

Related Questions