From 2eab2752c0469cc5400a5cee81e755f23a955101 Mon Sep 17 00:00:00 2001 From: Andreea Florescu Date: Tue, 6 Sep 2022 17:15:38 +0200 Subject: [PATCH] allow the timeout to be overwritten in input Before this patch the timeout could only be overwritten in the TIMEOUT environment variable. While that approach works and it is still needed so we can set a different timeout depending on the repository on which we run the pipeline, we also need a way to easily set a different timeout in custom tests. This comes handy when we have custom pipeline for certain crates and we want to be able to easily specify a timeout in a more human readable way. Signed-off-by: Andreea Florescu --- .buildkite/autogenerate_pipeline.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.buildkite/autogenerate_pipeline.py b/.buildkite/autogenerate_pipeline.py index 76c2fe3..bbd4d05 100755 --- a/.buildkite/autogenerate_pipeline.py +++ b/.buildkite/autogenerate_pipeline.py @@ -121,6 +121,11 @@ class BuildkiteStep: if conditional: setattr(self, 'if', conditional) + def _set_timeout_in_minutes(self, timeout): + """ Set the timeout if given in the json input. """ + if timeout: + self.timeout_in_minutes = timeout + def _add_docker_config(self, cfg): """ Add configuration for docker if given in the json input. """ @@ -200,6 +205,7 @@ class BuildkiteStep: platform = input.get('platform') docker = input.get('docker_plugin') conditional = input.get('conditional') + timeout = input.get('timeout_in_minutes') # Mandatory keys. assert test_name, "Step is missing test name." @@ -219,6 +225,7 @@ class BuildkiteStep: self._set_platform(platform) self._set_conditional(conditional) self._add_docker_config(docker) + self._set_timeout_in_minutes(timeout) # Override/add configuration from environment variables. self._env_override_agent_tags(test_name)