Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certificate variables from step templates in CaC projects not being picked up within the project step #8766

Closed
Clare-Octopus opened this issue May 3, 2024 · 1 comment
Assignees
Labels
kind/bug This issue represents a verified problem we are committed to solving

Comments

@Clare-Octopus
Copy link

Clare-Octopus commented May 3, 2024

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:

image

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:

image

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.

image

My variable.ocl file values:

image

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 and write-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.

image

image

Reproduction

  1. Create a step template based on a Run a Script step with a variable parameter and an account parameter:

image

  1. Create a project and add two project variables, one using an account type, the other a certificate type:

image

  1. Add the step template to the project and note you can select an account and certificate for the drop down options within the step.

image

  1. 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.

  2. Now add a basic Run a Script step - have that write host the variable ie in my example it would be -
    Write-Host "$CertTest".

  3. 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

N/A

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.

@Clare-Octopus Clare-Octopus added the kind/bug This issue represents a verified problem we are committed to solving label May 3, 2024
@Octobob
Copy link
Member

Octobob commented May 16, 2024

🎉 The fix for this issue has been released in:

Release stream Release
2024.1 2024.1.12728
2024.2 2024.2.7747
2024.3+ all releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This issue represents a verified problem we are committed to solving
Projects
None yet
Development

No branches or pull requests

3 participants