"Nuances" of using TeamCity

Picture







Hello everyone.







The article is written in the simple style of "DevOps for Housewives" from the same housewives. It will describe what surprises you may encounter when setting up a project in TeamCity. I will also give recommendations on how these problems can be circumvented.







The following is based on my two years of experience setting up TeamCity builds, reading bug reports and exchanging opinions with colleagues on the shop floor. I do not pretend to be the ultimate truth, since the SDD (Stackoverflow Driven Development) approach was mainly used in the work.







A little help:







  • TeamCity — CI (Continous Integration) . "" Gitlab CI, Github Actions .
  • (Project) — , . TeamCity ->-> .
  • (Build) — . " ", " ", " ". .
  • (Build step) — " " "runner type". Bash , Docker .


TeamCity :







  • ~30 , Bash, Ansible Python.
  • Android , Web , Docker, k8s . , , .
  • , Kotlin DSL ( ).


, . "".







1



( ). : , git , cron . .







: . 2008 .







, : . . 1 , 1 . , . .







, build chain ( ). , .







2 Build chain or not —



( + ) build chain. , . , ?







: ( ). . , ( ). , .







, ? , . — . , , , . , "" , ( , ), .







, "" , , : . . : , .







3



: , build chain. , . "" : ? .







3*N , . , , . "", . N , . , , . , , .







, , YAML Developer'.







4



Kotlin DSL ( , ). , : , ?







: " ". : ( ).







- , . — Kotlin DSL.







: / , . , - ID , .







5 TeamCity API



"" 4 DevOps. TeamCity , ("Deployment Frequency" "Lead Time for Changes").







API , . , - , , . , "Assign investigation", . .







, API — build chain - "" . . Python . .







6 Bash



, :







./command_1.sh # always fail

ls # always success
      
      





. :







./command_1.sh # always fail

if [ $? -ne 0 ]; then
  echo "##teamcity[buildProblem description='Build failed']"
fi

ls # always success
      
      





, ( "Execute step"). , Bash .







7



TeamCity -, API . , *



. : . echo



— . :







cat > constants.json <<- EOM
{
    "key": "%value%"
}
EOM
      
      





, , . Python , , JSON. ? , : JSON, , TeamCity. , : JSON. JSON TeamCity . JSON , .







8



. ( Kotlin DSL + TeamCity API), . . ( Firefox Network).









    • load: 9.87 s
    • DOMContentLoaded: 4.92 s
    • Finish: 34.39 s
    • Size/transferred size of all requests: 10.69 MB / 2.42 MB
    • Requests: 345


    • load: 4.59 s
    • DOMContentLoaded: 1.27 s
    • Finish: 27.42 s
    • Size/transferred size of all requests: 11.53 MB / 2.23 MB
    • Requests: 120


Finish — . . , ?







9



. Overview. . 99% . ( -) — ", stderr



", ", stderr



". Ansible - "WARNING: Deprecation setting...". TeamCity. .







10



, (Build agents). TeamCity master , , . (), TeamCity .







— . - , , . , - JAVA_HOME



. . . - , . ( TeamCity "").







— , . , "". , . . " !" — . : build chain? , , , . , "Run build on the same agent". , ?







— . (, root



, ). - , . 90% — print("Hello, World!")



.







( ). , . " — ".








All Articles