File tree Expand file tree Collapse file tree
scripts/trigger_auto_tests/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from pathlib import Path , PosixPath
33
44from dohq_teamcity import Build , ModelProperty , Properties , TeamCity
5+ from dohq_teamcity .rest import RESTClientObject
56from github import Github , Repository , UnknownObjectException
67from pip_download import PipDownloader
78from pydantic import BaseModel
@@ -88,6 +89,7 @@ def trigger_auto_tests_build2(
8889 ]
8990 )
9091 new_build = Build (build_type_id = bt .id , branch_name = "master" , properties = properties )
92+ update_tc_csrf (tc )
9193 build = tc .build_queues .queue_new_build (body = new_build , move_to_top = True )
9294 return build .id
9395
@@ -100,6 +102,12 @@ def is_build_success(build: Build) -> bool:
100102 return build .status .lower () == "success"
101103
102104
105+ def update_tc_csrf (tc : TeamCity ):
106+ # if not do this before triggering build it fails with 403: CSRF =/
107+ # https://github.com/devopshq/teamcity/issues/24
108+ tc .rest_client = RESTClientObject (tc .configuration )
109+
110+
103111class AutoTestsInfo (BaseModel ):
104112 number : int
105113 params : dict
You can’t perform that action at this time.
0 commit comments