From TeamCity to Octopus project variable

Dear team,

By following steps described in articles below:

I could not find a way how to pass arguments to Octopus from TeamCity
Here what I have



Additional command line arguments: --variable "COMMIT_AUTHOR:%env.COMMIT_AUTHOR%" --variable "Cat:Dog" --variable AUTHOR:%env.COMMIT_AUTHOR%

Neither COMMIT_AUTHOR nor Cat variables are not set


Am I doing something wrong?

Hi @talgat.aitchanov,

Thanks for reaching out. I’m looking at your configuration and “COMMIT_AUTHOR” seems to be set up correctly. The ‘Cat’ variable will not work unless it’s changed to prompted.

Would you try setting “COMMIT_AUTHOR” to something that doesn’t need to evaluate? I know TeamCity has some unusual rules when it comes to evaluating it’s own variables and I want to rule out all of the potential simple issue, before we dig a bit deeper.

So perhaps:
`–variable “COMMIT_AUTHOR:Authored”

Can you also make sure “COMMIT_AUTHOR” is a single line Text Box of Variable Type “Text”.
Have you also tried setting the Label on the variable to “COMMIT_AUTHOR”?

Let me know how that goes.

Regards,

Dane

Hi @dane.falvo

Thank you for response

Made changes in accordance with your remarks, however the issue remains

Here is the settings
Additional command line arguments: --variable "COMMIT_AUTHOR:Authored" --variable "Cat:Dog" --variable AUTHOR:%env.COMMIT_AUTHOR%




Hey @talgat.aitchanov,

Just jumping in for Dane.

Looking at your setup, I believe the problem is prompted variables will only get passed to the deployment, not the release. For this to work the way you have it set up, when you use create-release(or the create release step in TeamCity), you will also need to use the deployto parameter. This will cause the release to be deployed to the selected environment immediately, though. I’m not sure if that’s something you want to do manually later. You can also get the same functionality by having an extra Octopus Step for Deploy Release and pass the parameters there as well.

Parameter needed if using create-release:

--deployTo=VALUE       [Optional] Name or ID of the environment to
                             automatically deploy to, e.g., 'Production' or
                             'Environments-1'; specify this argument multiple
                             times to deploy to multiple environments.

You can see this same behavior when you go through the process in the portal. Creating the release itself never asks you for the values for prompted variables; you only get asked for the values when you actually go to deploy it.

Please let me know if that helps or if you have any other questions or concerns.

Best,
Jeremy

Hi @jeremy.miller

Thank you for taking over

It did work. I added --deployTo=VALUE, where in my case VALUE is QA

Working version:
Additional command line arguments: --deployTo="QA" --variable "COMMIT_AUTHOR:Authored" --variable "Cat:Dog" --variable "AUTHOR:%env.COMMIT_AUTHOR%"

%env.COMMIT_AUTHOR% was passed as expected, actual value was received

Thank you very much!

1 Like

Hi @talgat.aitchanov,

You’re very welcome! Thanks for letting me know you’re in a good state.

We’re always here if you have more questions. I hope you have a great rest of your week.

Best,
Jeremy

1 Like

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