Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AGENT-11701] Fix TeamCity Integration #18041

Merged
merged 6 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions teamcity/changelog.d/18041.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[AGENT-11701] Fix handling of projects with no builds
dkirov-dd marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 9 additions & 5 deletions teamcity/datadog_checks/teamcity/teamcity_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,17 @@ def _collect_build_problems(self, new_build):
def _collect_new_builds(self, project_id):
last_build_id = self.bc_store.get_last_build_id(project_id, self.current_build_config)
if not last_build_id:
self._initialize()
# We want to handle the case of an unbuilt build config by checking for any last builds
self.log.debug(
'No builds for project %d and build config %d, checking again', project_id, self.current_build_config
)
ressource = "last_build"
options = {"project_id": project_id}
else:
self.log.debug('Checking for new builds...')
new_builds = get_response(
self, 'new_builds', build_conf=self.current_build_config, since_build=last_build_id
)
return new_builds
ressource = "new_builds"
options = {"since_build": last_build_id}
return get_response(self, ressource, build_conf=self.current_build_config, **options)

def _get_build_config_type(self, build_config):
if self.is_deployment:
Expand Down
Loading