Octopus variables in yaml file

#1

Hello!
I have a yaml file that I use in a kubectl cli step for my eks cluster.
I wrpte the image to be configured like that in my deployment file :
image: #{AWSAccount}.dkr.ecr.eu-west-1.amazonaws.com/#{projectName}:$OctopusParameters['Octopus.Release.Number']
It passes in Octopus, but when I check on my kubernetes dashboard, the pods didn’t spin up because they couldn’t find themselves the Octopus system variable of release.

I have tried using a variable in the yaml file, with variable substitution in Octopus:
image: #{AWSAccount}.dkr.ecr.eu-west-1.amazonaws.com/#{projectName}:#{tag}
tag = $OctopusParameters[‘Octopus.Release.Number’]`

How would you guys do that? Thanks a lot!

(Michael Richardson) #3

Hi,

The problem there is you can’t use $OctopusParameters[‘Octopus.Release.Number’] as a variable substitution; that is PowerShell syntax.

You will need to use the #{} templating syntax. e.g. #{Octopus.Release.Number}

There is a variable you can use as follows:

#{Octopus.Action.Package[Acme].Image}

(where the package reference name on your step is Acme). This will evaluate to the fully qualified image.

I hope that helps!

#4

That made the trick!

Thanks again for your fast answer :slight_smile:

(system) closed #5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.