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 <fandree@amazon.com>
This commit is contained in:
Andreea Florescu
2022-09-06 17:15:38 +02:00
committed by Andreea Florescu
parent 1401badaaf
commit 2eab2752c0

View File

@@ -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)