From 7af2e16d9150869f252358a66adb2c5da1deec75 Mon Sep 17 00:00:00 2001 From: Andreea Florescu Date: Tue, 25 Oct 2022 12:27:25 +0200 Subject: [PATCH] add support for specifying the agent queue This is needed so we can have separate queues for tests that require special instances. For example, running performance tests require nothing else to run at the same time. Signed-off-by: Andreea Florescu --- .buildkite/autogenerate_pipeline.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.buildkite/autogenerate_pipeline.py b/.buildkite/autogenerate_pipeline.py index 1cb9fd3..9e43a1a 100755 --- a/.buildkite/autogenerate_pipeline.py +++ b/.buildkite/autogenerate_pipeline.py @@ -127,6 +127,11 @@ class BuildkiteStep: if timeout: self.step_config['timeout_in_minutes'] = timeout + def _set_agent_queue(self, queue): + """Set the agent queue if provided in the json input.""" + if queue: + self.step_config['agents']['queue'] = queue + def _add_docker_config(self, cfg): """ Add configuration for docker if given in the json input. """ @@ -207,6 +212,7 @@ class BuildkiteStep: docker = input.get('docker_plugin') conditional = input.get('conditional') timeout = input.get('timeout_in_minutes') + queue = input.get('queue') # Mandatory keys. assert test_name, "Step is missing test name." @@ -227,6 +233,7 @@ class BuildkiteStep: self._set_conditional(conditional) self._add_docker_config(docker) self._set_timeout_in_minutes(timeout) + self._set_agent_queue(queue) # Override/add configuration from environment variables. self._env_override_agent_tags(test_name) @@ -238,7 +245,7 @@ class BuildkiteStep: # forwarding the key, values without any change. # We need to filter for keys that have special meaning and which we # don't want to re-add. - special_keys = ['conditional', 'docker_plugin', 'platform', 'test_name'] + special_keys = ['conditional', 'docker_plugin', 'platform', 'test_name', 'queue'] additional_keys = {k: v for k, v in input.items() if not (k in self.step_config) and not(k in special_keys)} if additional_keys: