Detecting Personal Builds

I have been looking all over and cannot seem to find a way to detect if the current build is a personal build. The reson being is that we create a backup of the artifacts in a custom solution. I don't want to do that on a personal build. Also there are some other action that I wish not to be performed on a personal build. Is this possible?

7 comments
Comment actions Permalink

I found the build.is.personal property finally, but am still having issues. I have a build step that is a custom script that says: "if [ %build.is.personal% = true ]; then echo "Personal build. Not deploying to barchives"; exit; fi", but now I cant run the build because it says that a compatible agent is not found. This is because the build.is.personal variable is not defined. Defaulting it to false and launching a build did not set it to true.

Any advice?

0
Comment actions Permalink

As a workaround you can check BUILD_IS_PERSONAL environment variable in your script. It will be set only if build is personal.

0
Comment actions Permalink

I have the exact same requirement. I'm unable to use either %build.is.personal% or %BUILD_IS_PERSONAL% in my build script. Doing so causes the build to not execute due to no build agents being compatible. The build gets stuck in the queue and shows up on the queuedBuildCompatibilityTab.

 

0
Comment actions Permalink

Hi Ike,

 

This might be a bit counterintuitive, but the parameters do work. The parameters are added from the server side once a personal build is detected, but if they are defined by the user, the user values are *not* overwritten. This means that you cannot reference them from within TeamCity configuration pages, but if your build scripts are stored in the VCS, they can access the value. If you set them in TeamCity's configuration pages, included as command line scripts, TeamCity will pick them up as required and will force you to set them, but as the server doesn't override them, you won't be able to use them.

 

On the other hand, what would you be using this parameter for? We usually recommend not to use parameters to control flow, it's usually a better approach to split the build configurations (via templates) for the multiple paths instead.

0
Comment actions Permalink

The final build step in my build configurations is a step to copy the output files to a network share. I need to skip that step when the build is being run as a test / personal build.

0
Comment actions Permalink

It would then make sense to split it into two build configurations, one that runs all but the last step, then set up a final build connected via a snapshot/artifact dependency. That way, the personal builds and test builds can run just the "build" parts, and whenever you want to trigger the regular runs (via VCS Trigger or otherwise) you can trigger the "copy" build config, which will automatically pull everything else via the dependencies. Would that work for you?

0
Comment actions Permalink

I solved it by adding the following to my .BAT file that does the copy:

 

@IF DEFINED BUILD_IS_PERSONAL (@ECHO BUILD_IS_PERSONAL IS defined & @GOTO skipcopy) ELSE (@ECHO BUILD_IS_PERSONAL is NOT defined)

0

Please sign in to leave a comment.