From b8fdeca7f9ae5dd77a5a896febb48cd42d9e6afc Mon Sep 17 00:00:00 2001 From: Michal Kuffa Date: Wed, 2 Dec 2020 12:57:34 +0100 Subject: [PATCH] feat(pipeline): Pipeline steps can specify target environment --- freight/providers/pipeline.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freight/providers/pipeline.py b/freight/providers/pipeline.py index c8346e84..f3975ea2 100644 --- a/freight/providers/pipeline.py +++ b/freight/providers/pipeline.py @@ -157,6 +157,13 @@ def execute_deploy(self, workspace, deploy, task) -> None: ).raise_for_status() for i, step in enumerate(config["steps"]): + step_environments = step.get("environments") + if step_environments and deploy.environment not in step_environments: + workspace.log.info( + f"Skipping Step {i+1} ({step['kind']})." + f" Configured for environments {step_environments} this is deploy environment is {deploy.environment}" + ) + continue workspace.log.info(f"Running Step {i+1} ({step['kind']})") run_step(step, context) workspace.log.info(f"Finished Step {i+1}")