Skip to content

Commit

Permalink
Fix get_parameter for Step (#624)
Browse files Browse the repository at this point in the history
**Description of PR**

Currently, using `get_parameter` on a step fails due to the validator as
value/value_from are mutually exclusive, e.g.
```py
            Step(
                name="do-retry",
                template=...
                when=f"{retry_step.get_parameter('retry-param')}==retry",
            )
```

This PR copies the fix for Task from #565 for Step.

Only doing a small fix as the duplicated function code should be
addressed in #595

Signed-off-by: Elliot Gunton <[email protected]>
  • Loading branch information
elliotgunton authored May 9, 2023
1 parent a1d704e commit b439863
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/hera/workflows/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,9 @@ def get_parameter(self, name: str) -> Parameter:

obj = next((output for output in parameters if output.name == name), None)
if obj is not None:
obj.value = f"{{{{steps.{self.name}.outputs.parameters.{name}}}}}"
return Parameter(
name=obj.name,
value=obj.value,
value_from=obj.value_from,
global_name=obj.global_name,
description=obj.description,
value=f"{{{{steps.{self.name}.outputs.parameters.{name}}}}}",
)
raise KeyError(f"No output parameter named `{name}` found")

Expand Down

0 comments on commit b439863

Please sign in to comment.