diff --git a/infra/spawn_data_pipeline.py b/infra/spawn_data_pipeline.py index 3d3cb637be..a38b76fc52 100644 --- a/infra/spawn_data_pipeline.py +++ b/infra/spawn_data_pipeline.py @@ -69,6 +69,8 @@ def main(): id_mapping = {} + docker_tag = os.getenv("TAG", None) + # First pass, do the template rendering and dependencies resolution tasks = [] @@ -105,6 +107,20 @@ def main(): payload["dependencies"] = new_dependencies + # Override the Docker image tag if needed + if docker_tag: + base_image = payload["payload"]["image"] + splitted_image = base_image.rsplit(":", 1) + + if len(splitted_image) > 1: + err_msg = "Docker tag should be None or 'latest', not {!r}" + assert splitted_image[1] == "latest", err_msg.format(splitted_image[1]) + + tagless_image = splitted_image[0] + + new_image = "{}:{}".format(tagless_image, docker_tag) + payload["payload"]["image"] = new_image + tasks.append((task_id, payload)) # Now sends them