0

Our TeamCity project has components for triggered build and unit tests on commits, nightly functional tests, and manual deployment. Currently, the deployment job can be run even when the functional tests have failed. To prevent this, I'd like to enable a pre-condition whereby a deployment can't be run or will fail if the nightly functional tests have failed.

I'm not sure if this should be done with a build step or a dependency. There aren't actual snapshot or artifact dependencies involved, just a job status.

1 Answer 1

0

I found a way to do this in a Powershell build step with the TeamCity REST API and guest authentication.

$url = "nytc:7070/guestAuth/app/rest/buildTypes/id:CharlesRiver_MainFunctionalTest/builds/canceled:false/status"
if ($url -ne "SUCCESS")
{
  "Can't run deploy if tests have failed."
  "##teamcity[buildStatus status='FAILURE' text='Deploy cannot run because function tests have failed']"
  exit 1
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.