Tag Archives: teamcity

Croatia islands

Jan 2020 reading list


Spotify Engineering culture : https://medium.com/productmanagement101/spotify-squad-framework-part-i-8f74bcfcd761

QUIC : https://quicwg.org/base-drafts/draft-ietf-quic-http.html

Teamcity REST API : https://confluence.jetbrains.com/display/TCD10/REST+API

Object-Oriented Programming — The Trillion Dollar Disaster https://medium.com/better-programming/object-oriented-programming-the-trillion-dollar-disaster-92a4b666c7c7

Stop using classes in JS : https://medium.com/javascript-in-plain-english/please-stop-using-classes-in-javascript-and-become-a-better-developer-a185c9fbede1

Interesting read about latency and how 99% Quantile may not be enough : https://bravenewgeek.com/everything-you-know-about-latency-is-wrong/


TeamCity : pin and tag a build using the REST API from inside the script

We use Teamcity for most of automation in building/testing/deploying golang microservices to prod and during test phase I wanted to be able to notice easily if an integration/benchmark test crashed a microservice. Pinning the build and tagging it with the word “panic” seemed to be a good idea, from inside the buildconf script :

# txt are are the microservice logfiles, substitute as neeeded
grep panic.go *.txt
if [ $retVal -eq 0 ]; then
   # grep found panic in some file, tag with panic
   nohup sh -c 'sleep 10 ; curl --header "Origin: https://<your_tc_server>" --header "Authorization: Bearer <yourbearertoken>" --request POST "%teamcity.serverUrl%/app/rest/builds/id:%teamcity.build.id%/tags/" --data panic --header "Content-type: text/plain"' &
   nohup sh -c 'sleep 10 ; curl --header "Origin: https://<your_tc_server>" --header "Authorization: Bearer <yourbearertoken>" --request PUT "%teamcity.serverUrl%/app/rest/builds/id:%teamcity.build.id%/pin/"' &

Took more than expected to figure out this : some examples would be helpful. Note that the build needs to be finished to be able to pin it/tag it so we have to put this ugly sleep to postpone operations on the rest api when the build is finished.