Octopus Deploy Prompted Variable for Step Template

In one of our projects we get some configuration files using the Git - Pull (HTTPS) community step template. We would like the branch used when pulling the configuration to be entered (but with the default value master) when we run the project.

It seems that we need to use Prompted Variables, but how do we pass that into the Git - Pull step template?

Hi @extkrle,

Thanks for getting in touch!

You can configure the Git - Pull step with variables for the main configuration.
e.g.

You can then create your variable and in the editor check the Prompt for value option. You also have the choice of leaving the variable blank for users to manually complete, or you can set it to a drop down menu with a fixed list of values.
e.g.

I hope this helps, please let me know if you have any further questions.

Regards,
Paul

Hi.

I tried defining variables and using them as you suggested, but they are not replaced when run.

Any idea why?

Regards,
Kristian

Hi @extkrle,

If you add a project variable OctopusPrintEvaluatedVariables and set it to true you can then view all the variables being set in the raw deployment logs.
I’ve ran this in my test environment and can see the GitHttpsBranchName parameter being set to what I selected in the prompt dropdown.

Are you able to run the same and see what is being used for that parameter?

Regards,
Paul

Hi again.

The GitHttpsBranchName is replaced with the value configured on the task which is the name of the variable.

logging

version

Maybe is not supported in the version we are running?

Regards

Kristian

Hi Kristian,

I moved my test environment to the same version and still had no problems with the substitution. After a few hard looks at your screenshots I spotted the issue. The variable name in your process step is ${SubmoduleBranch} when it should be #{SubmoduleBranch}. Try swapping the $ to a # and give it another try and let me know how that goes.

Regards,
Paul

Hi Paul.

That did the trick. Thank you for your help.

Regards

Kristian

1 Like