Reputation: 5418
We have a build configuration in TeamCity with 3 build steps. Is there a way to prevent step 2 from running for personal builds such that normal VCS triggers executes steps 1, 2 and 3 - but only 1 and 3 are run for personal builds?
There is a variable BUILD_IS_PERSONAL set to true for personal builds, but it isn't defined if not: http://confluence.jetbrains.com/display/TCD8/Predefined+Build+Parameters
How are you meant to use the variable as whenever I use it in a build configuration script, it asks me to define the value manually?
Upvotes: 2
Views: 1193
Reputation: 2211
BUILD_IS_PERSONAL is a usual environment variable. It is only set if build is personal. Your build step can check for presence of this variable and exit immediately if it is defined.
For unix shell something like this should work:
if [ -n "$BUILD_IS_PERSONAL" ]; then
echo "Build is personal, exiting"
exit 0
fi
Upvotes: 5
Reputation: 5418
I modified the configuration for the second step to be wrapped in this if statement:
IF "%%BUILD_IS_PERSONAL%%"=="" (
rem do stuff
)
The thing I had been missing was escaping the TeamCity variable syntax with an extra '%'.
Upvotes: 0
Reputation: 1652
You could clone your build configuration (you could leverage templates, if your build configuration is not yet based on a template), and have two build configurations: one for normal builds and another for personal builds. On the personal build configuration, you would disable step 2.
Upvotes: 0