Password properties in meta-runners do not work
If a password property is used inside a meta-runner, when a build configuration that uses the meta-runner runs, the value of the property is the name of the secure property and not its actual value.
If a parameter is manually added to the build configuration with the same properties as the one inside the meta-runner, the value of the property when the build configuration runs is correct.
I would expect if a meta-runner has defined a default value for a parameter, that it would work when used in a build configuration. The same scenario is successful when the parameter is the text type, instead of the password type.
The following configuration will replicate the issue
This meta-runner uses a text property, the example build configuration below executes this meta-runner and "example text" is echoed to STDOUT
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="MR Echo Property">
<description>Regular text param</description>
<settings>
<parameters>
<param name="message" value="example text" />
</parameters>
<build-runners>
<runner name="" type="simpleRunner">
<parameters>
<param name="script.content" value="echo %message%" />
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
</runner>
</build-runners>
<requirements />
</settings>
</meta-runner>
This meta-runner uses a password property, however in this case I try to use the property like a regular text property (the TeamCity UI recommends using a different form for the variable, which is used in the next meta-runner), the example build configuration below executes this meta-runner and "teamcity.password.message" is echoed to STDOUT.
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="MR Echo Property 2">
<description>Secure text param</description>
<settings>
<parameters>
<param name="message" value="zxx5218ae07c8cce876289bbd8d8dbedd1f" spec="password display='normal'" />
</parameters>
<build-runners>
<runner name="" type="simpleRunner">
<parameters>
<param name="script.content" value="echo %message%" />
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
</runner>
</build-runners>
<requirements />
</settings>
</meta-runner>
This meta-runner uses a password property and the recommended way to access the property, the example build configuration below executes this meta-runner and "teamcity.password.message" is echoed to STDOUT. This is the same result as the second meta-runner
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="MR Echo Property 3">
<description>Secure text param, using the recommended % variable</description>
<settings>
<parameters>
<param name="message" value="zxx5218ae07c8cce876289bbd8d8dbedd1f" spec="password display='normal'" />
</parameters>
<build-runners>
<runner name="" type="simpleRunner">
<parameters>
<param name="script.content" value="echo %secure:teamcity.password.message%" />
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
</runner>
</build-runners>
<requirements />
</settings>
</meta-runner>
This build configuration leverages the 3 meta-runners defined above
<?xml version="1.0" encoding="UTF-8"?>
<build-type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uuid="0a953484-c6e8-4625-97c0-9b860c5c8134" xsi:noNamespaceSchemaLocation="http://www.jetbrains.com/teamcity/schemas/10.0/project-config.xsd">
<name>BC Echo Property</name>
<description />
<settings>
<parameters />
<build-runners>
<runner id="RUNNER_72" name="" type="Sandbox_MrEchoProperty">
<parameters>
<param name="message" value="example text" />
<param name="teamcity.step.mode" value="default" />
</parameters>
</runner>
<runner id="RUNNER_73" name="" type="Sandbox_MrEchoProperty2">
<parameters>
<param name="message" value="zxx52467cdee324aa9768b065e3e10cc85e2cca34bb02a162e93de1d953ee6eab806f239e345a072819" />
<param name="teamcity.step.mode" value="default" />
</parameters>
</runner>
<runner id="RUNNER_74" name="" type="Sandbox_MrEchoProperty3">
<parameters>
<param name="message" value="zxx52467cdee324aa9768b065e3e10cc85e2cca34bb02a162e93de1d953ee6eab806f239e345a072819" />
<param name="teamcity.step.mode" value="default" />
</parameters>
</runner>
</build-runners>
<vcs-settings />
<build-triggers />
<cleanup />
</settings>
</build-type>
Please sign in to leave a comment.
As I submitted this, I noticed that the values of the parameters specified in the runners of the build configuration were longer than the values stored in the meta-runner. When adding the meta-runner as a build step it provides the opportunity to enter values like step name and an override to the message parameter. It appears that TeamCity may override the default value set in the meta-runner with the name of the parameter at this screen, causing "teamcity.password.message" to be the stored value of the parameter on the build configuration.
If this is the case, it is less than ideal and not obvious.
If I edit the build steps of the build configuration, and over-write the default value stored in the message parameter, it will print to STDOUT and TeamCity will replace its text with ***'s as expected. This works for the second meta-runner, which accesses the password property as %message%, however the third meta-runner which accesses the password property via the recommendation in the UI (%secure:teamcity.password.message%) still returns the value "teamcity.password.message"
Edit: Regarding the third meta-runner, it's possible I am mis-understanding the use of %secure:teamcity.password.message% as the default value in the UI. I read that as the value I should use to reference the value of the parameter, where in reality that may just be something TeamCity uses in order for it to read the value. If the later is the case, it would be beneficial if the UI explained that point and the appropriate way to reference the value of the password property.
To ensure there is an actionable question:
How can I set a default value of a password property in a meta-runner, and have it pass through to the build-configuration without re-setting or overriding that parameter?
Can this please be addressed? It's not clear at all how a password parameter with a default value can be used with a metarunner.
Hi Jared, and Jesse,
sorry, I missed the initial message. I must say that I'm not sure where are you saying that "the UI recommends using %secure:teamcity.password.message%". I can definitely confirm that using %message% will work just fine, but I'm not sure about which message you mean, so if you could detail what steps did you take in order to get that warning, it might be useful.
The focus should not be on the UI messaging, which I believe has been changed since 10.x as I can't replicate that UI message on 2018.x, it's been over a year since the original post.
The request I made is still relevant, and still does not work as expected in TeamCity 2018.1 (build 58245)
How can I set a default value of a password property in a meta-runner, and have it pass through to the build-configuration without re-setting or overriding that parameter?
I posted all the necessary XML to reproduce the issue, however here are the steps to re-produce the issue, with modifications from the original raw XML to help demonstrate the issue:
In my opinion, if you set a default value for a password property in a meta-runner, you should not have to re-set it to the same value when using it
Hi Jesse,
thanks for the detailed description. I've managed to replicate the issue although I'm not fully sure what the actual issue behind it is. I've opened an issue in the tracker so that we can figure it out better, please watch and vote for it: https://youtrack.jetbrains.com/issue/TW-56188