diff --git a/contrib/buildbot/server.py b/contrib/buildbot/server.py --- a/contrib/buildbot/server.py +++ b/contrib/buildbot/server.py @@ -362,14 +362,28 @@ staging_ref = phab.get_latest_diff_staging_ref(revision_PHID) # Trigger the requested builds for build in builds: + properties = [{ + 'name': 'env.ABC_BUILD_NAME', + 'value': build, + }] + + # Temporary agent pool override until we've completely migrated + # away from the lower memory build agents. + if build == 'build-tsan': + properties.append({ + 'agent': { + 'pool': { + # ABC Build Agent pool + 'id': 1, + }, + }, + }) + # FIXME the hardcoded infos here should be gathered from somewhere tc.trigger_build( "BitcoinABC_BitcoinAbcStaging", staging_ref, - properties=[{ - 'name': 'env.ABC_BUILD_NAME', - 'value': build, - }] + properties=properties, ) # If we reach this point, trigger_build did not raise an exception. diff --git a/contrib/buildbot/test/test_endpoint_triggerCI.py b/contrib/buildbot/test/test_endpoint_triggerCI.py --- a/contrib/buildbot/test/test_endpoint_triggerCI.py +++ b/contrib/buildbot/test/test_endpoint_triggerCI.py @@ -320,6 +320,42 @@ ] ) + def test_triggerCI_explicit_agent_pool(self): + def assert_teamcity_queued_builds(comments, queued_builds): + self.set_transaction_return_value(comments) + response = self.call_endpoint() + expected_calls = [ + call( + "BitcoinABC_BitcoinAbcStaging", + "refs/tags/phabricator/diff/{}".format(self.diff_id), + properties=[{ + 'name': 'env.ABC_BUILD_NAME', + 'value': build_id, + }, { + 'agent': { + 'pool': { + 'id': 1, + }, + }, + }] + ) + for build_id in queued_builds + ] + print(expected_calls) + self.teamcity.trigger_build.assert_has_calls( + expected_calls, any_order=True) + self.assertEqual(response.status_code, 200) + + # build-tsan should explicitly set the agent build pool + assert_teamcity_queued_builds( + [ + "@bot build-tsan", + ], + [ + "build-tsan", + ] + ) + if __name__ == '__main__': unittest.main()