Reputation: 648
Is it possible to append some value to existing TeamCity configuration parameter from custom build script using service message?
I tried these options:
Step 1 (Command Line - Custom script - external):
echo "##teamcity[setParameter name='par' value='%par% added']"
Step 2 (Command Line - Custom script - inline):
echo "%par%" # %par%
Step 1 (Command Line - Custom script - external):
echo "##teamcity[setParameter name='par' value='par added']"
Step 2 (Command Line - Custom script - inline):
echo "%par%" # par added
Step 1 (Command Line - Custom script - external):
echo "##teamcity[setParameter name='par' value='{par} added']"
This works for buildStatus, but not here
Step 2 (Command Line - Custom script - inline):
echo "%par%" # {par} added
Is there some way to do this as one-liner, or do I need to workaround it with some other parameter that will be referenced like par = value_that_shall_be_always_here %helper%
and initialized later in the build script with setParameter name='helper' value='added'
?
Upvotes: 1
Views: 1971
Reputation: 3081
You can't reference configuration parameters like that via an external script; they are intended to share settings within a build configuration. Environment variables are passed into the spawned build process; i.e. such that external scripts can reference them.
Taken directly from the docs
By the way, if you in-lined the statements from your first attempt into a build configuration, they would work with a configuration parameter.
Set configuration parameter - par = 'Initial value'
Step 1 (custom script) - echo "##teamcity[setParameter name='par' value='%par% added']"
Step 2 (custom script) - echo "%par%"
Output - "Initial value added"
Upvotes: 2