Certificate variables from step templates in CaC projects not being picked up within the project step #8766
Labels
kind/bug
This issue represents a verified problem we are committed to solving
Severity
Blocking customers from using certificate variables within their step templates if using Configuration as Code.
Version
2024.1.11997, 2024.2.6366
Latest Version
I could reproduce the problem in the latest build
What happened?
If using a step template in a project which has certificate variable parameters, the step will pickup the project variables when attempting to select a certificate in the step, this is intended behaviour:
However, as soon as you convert the project to Configuration as Code (CaC) the step template will no longer find the project certificate variable value:
If you also include an account variable parameter in the step template, when converting the project to CaC it does find the account variable and will let you select an option in the step, so we know the step is looking at the
variables.ocl
file for the variables.My
variable.ocl
file values:This looks to be related specifically to certificate variables via step templates in CaC projects.
If you create a normal
Run a Script
step in a CaC project andwrite-host
the certificate variable in the script it will output the correct variable value so this does just seem to be related to step templates.Reproduction
Run a Script
step with a variable parameter and an account parameter:Convert that project to configuration as code. Note you can no longer select a variable value for the certificate but you can for an account. Also note in your CaC repo you will have a
variables.ocl
file which will contain the correct variables and values.Now add a basic
Run a Script
step - have that write host the variable ie in my example it would be -Write-Host "$CertTest"
.Disable the previous step we created based on the step template and deploy the release to an environment. Note the correct certificate value will be printed in the deployment which proves Octopus is looking at the
variables.ocl
file for normal steps, just not when using step templates.Error and Stacktrace
More Information
Initial user who raised the ticket (internal) - https://octopus.zendesk.com/agent/tickets/184239
Internal slack conversation - https://octopusdeploy.slack.com/archives/CNHBHV2BX/p1714729870926349
Workaround
Do not use a step template if you want to reference a certificate variable in a CaC project. You can use the steps provided rather than a step template. Hopefully that will allow you to reference the project variables within your scripts which should be picked up during a deployment, based on my testing.
The text was updated successfully, but these errors were encountered: