Checking if a build is a private build in one of the build steps

Hi,

 

I'm trying to add a build step to rename the build artifacts for private builds.

My build configuration is defined in Kotlin DSL.

I added a powershell step that checks if the system.build.is.personal parameter is true and then outputs a service message to set the build artifact name.

However, adding this step adds an implicit requirement to the build for system.build.is.personal to exist.

But in normal builds this parameter is not defined (instead of just false).

So normal builds are stuck in the queue  with a message that no compatible build agents exist.

 

Is there another way to set a different artifact name for private builds?

 

Thanks,

Tidhar

0
3 comments

Hi,

 

Thank you for bringing this issue to our attention. We had a bug entry in our tracker, and you can follow its progress at YouTrack: https://youtrack.jetbrains.com/issue/TW-20249/system.build.is.personal-parameter-is-not-available-if-build-is-not-personal 

As a temporary workaround, you can utilize the REST API to retrieve the system.build.is.personal value. Here's a sample PowerShell script:

$apiToken = "xxxx"
$apiUrl = "%teamcity.serverUrl%/app/rest/builds/id:%teamcity.build.id%/personal"
$headers = @{
    Authorization = "Bearer $apiToken"
}
$response = Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method Get
$isPersonal = $($response | ConvertTo-Json -Depth 5)

if ($isPersonal -ne $true){
    # Your code for non-personal build scenario...
}
else {
    # Your code for personal build scenario...
}
0

Thanks, that worked.

It's sad to see that a bug from 12 years ago is still present and people are bumping into it every few years.

I would think it's very simple to fix this bug.

0
Hi,

I'm glad to hear that it worked for you!

It's indeed disheartening to see it persist. While I'm not directly involved in the development process, I'll make sure to relay your observation to our team. Hopefully, we can expedite the resolution of this longstanding issue. Thank you for bringing it to our attention.
0

Please sign in to leave a comment.