Skip to content

Commit

Permalink
COMPINFRA-2938: Support security-check in parallel steps
Browse files Browse the repository at this point in the history
  • Loading branch information
jfongatyelp committed Jul 28, 2023
1 parent d4686fc commit 57ac049
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
9 changes: 8 additions & 1 deletion paasta_tools/cli/cmds/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ def deploy_check(service_path):

def deploy_has_security_check(service, soa_dir):
pipeline = get_pipeline_config(service=service, soa_dir=soa_dir)
steps = [step["step"] for step in pipeline]
steps = [step["step"] for step in pipeline if not step.get("parallel")]
steps += [
substep["step"]
for step in pipeline
if step.get("parallel")
for substep in step.get("parallel")
]
print(steps)
if "security-check" in steps:
print(PaastaCheckMessages.DEPLOY_SECURITY_FOUND)
return True
Expand Down
18 changes: 18 additions & 0 deletions tests/cli/test_cmds_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,24 @@ def test_deploy_has_security_check_true(mock_pipeline_config, capfd):
assert actual is True


@patch("paasta_tools.cli.cmds.check.get_pipeline_config", autospec=True)
def test_deploy_has_parallel_security_check_true(mock_pipeline_config, capfd):
mock_pipeline_config.return_value = [
{
"step": "initial",
"parallel": [
{"step": "test"},
{"step": "security-check"},
],
},
{"step": "push-to-registry"},
{"step": "hab.canary", "trigger_next_step_manually": True},
{"step": "hab.main"},
]
actual = deploy_has_security_check(service="fake_service", soa_dir="/fake/path")
assert actual is True


@patch("paasta_tools.cli.cmds.check.get_instance_config", autospec=True)
@patch("paasta_tools.cli.cmds.check.list_clusters", autospec=True)
@patch("paasta_tools.cli.cmds.check.get_service_instance_list", autospec=True)
Expand Down

0 comments on commit 57ac049

Please sign in to comment.