How do I use set parameters from within a build.

Answered

I'm trying set a version parameter with the following command line build step:

#!/bin/bash
VERSION=$(./mvnw exec:exec -Dexec.executable=echo '-Dexec.args=${project.version}' -q --non-recursive)
echo "##teamcity[setParameter name='env.PROJECT_VERSION' VALUE ='$VERSION']"

I'm then trying to read it in a following command line build step:

#!/bin/bash
version='%env.PROJECT_VERSION%'
echo "Calculating RPM Version and Release numbers from Maven Version : $version"

However the version is always an empty string.

I also noticed that adding the 2nd build step created an implicit agent requirement that env.PROJECT_VERSION was set. To get around this I set env.PROJECT_VERSION to 'A' in the build parameters.

What am I doing wrong here?

1 comment

The problem was the capital VALUE. Thanks for looking. =)

0

Please sign in to leave a comment.