Skip to content

Commit

Permalink
Update status reporting messages in Build task
Browse files Browse the repository at this point in the history
  • Loading branch information
ndebuhr committed Mar 6, 2019
1 parent e559a40 commit 64b2b07
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/resources/teamcity/Build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
queue_response = request.post(queueBuildURL, json.dumps(buildBody), contentType='application/json')

if not queue_response.isSuccessful():
error('Queuing failed for build configuration ID: ' + buildID, queue_response)
error('Queuing failed for build configuration ID ' + buildID, queue_response)
resp = json.loads(queue_response.response)
runID = resp['id']
taskID = resp['id']

# polls until the job completes
statusURL = 'httpAuth/app/rest/buildQueue/taskId:' + runID
statusURL = 'httpAuth/app/rest/buildQueue/taskId:' + str(taskID)
while True:
time.sleep(poll_interval)
status_response = request.get(statusURL, contentType='application/json')
Expand All @@ -53,16 +53,16 @@
if resp['state'] == 'finished':
# Have a build completed
if resp['status'] == 'SUCCESS':
print('Build successful with build number: ' + buildNumber)
print('Build successful - build ' + str(buildNumber))
sys.exit(0)
else:
print('Build failed for build number: ' + buildNumber)
print('Build failed - build ' + str(buildNumber))
print(status_response.getResponse())
sys.exit(1)
else:
print('Waiting for build \#' + buildNumber + ' to start/finish')
print('Waiting for build ' + str(buildNumber) + ' to start/finish')
else:
error(
'Request failed - couldn\'t poll for status of build generated by build conf ID \#' + buildID,
'Request failed - couldn\'t poll for status of build from task ID ' + str(taskID),
status_response
)

0 comments on commit 64b2b07

Please sign in to comment.