Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

teamcity - How to get duration of each build steps

Here is a build configuration with 24 steps. With API, I can get the total build time duration. How can I get each duration of 24 steps? https://[server]/app/rest/builds/id:[123]/

<startDate>20210122T123050+0000</startDate>
<finishDate>20210122T123115+0000</finishDate>
question from:https://stackoverflow.com/questions/65845820/how-to-get-duration-of-each-build-steps

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you can use https://[tc_server]/app/rest/builds/id:[id]/statistics api

curl -u user:password https://myserver.com/app/rest/builds/id:123/statistics -H accept:application/json

{"count":18,"property":[{"name":"ArtifactsSize","value":"28734525"},{"name":"BuildDuration","value":"2860858"},{"name":"BuildDurationNetTime","value":"2852922"},{"name":"buildStageDuration:artifactsPublishing","value":"3976"},{"name":"buildStageDuration:buildFinishing","value":"221"},{"name":"buildStageDuration:buildStepRUNNER_1","value":"26715"},{"name":"buildStageDuration:buildStepRUNNER_4","value":"1517192"},{"name":"buildStageDuration:buildStepRUNNER_5","value":"1233555"},{"name":"buildStageDuration:buildStepRUNNER_6","value":"75460"},{"name":"buildStageDuration:firstStepPreparation","value":"2"},{"name":"buildStageDuration:sourcesUpdate","value":"3408"},{"name":"buildStageDuration:toolsUpdating","value":"1"},{"name":"BuildTestStatus","value":"1"},{"name":"queueWaitReason:Checking_for_changes_is_in_progress","value":"810"},{"name":"serverSideBuildFinishing","value":"92"},{"name":"SuccessRate","value":"1"},{"name":"TimeSpentInQueue","value":"1057"},{"name":"VisibleArtifactsSize","value":"18049068"}]}

in response there are durations for build steps {"name":"buildStageDuration:buildStepRUNNER_1","value":"26715"}, {"name":"buildStageDuration:buildStepRUNNER_4","value":"1517192"}, {"name":"buildStageDuration:buildStepRUNNER_5","value":"1233555"}, {"name":"buildStageDuration:buildStepRUNNER_6","value":"75460"}

ps there are not all build steps in response (no 2 and 3). it means they were skipped or probably duration was < 1s


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...