Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support prior return values #3565

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cumulusci/core/flowrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

import copy
import logging
import re
from collections import defaultdict
from operator import attrgetter
from typing import (
Expand Down Expand Up @@ -85,6 +86,7 @@


RETURN_VALUE_OPTION_PREFIX = "^^"
RETURN_VALUE_SUBS_RE = re.compile(r"\^\^\S+")

jinja2_env = ImmutableSandboxedEnvironment()

Expand Down Expand Up @@ -508,6 +510,15 @@ def _run_step(self, step: StepSpec):
return

if step.when:

### get prior return values
prior_return_values = RETURN_VALUE_SUBS_RE.findall(step.when)
if prior_return_values is not None:
for value in prior_return_values:
path, name = value[len(RETURN_VALUE_OPTION_PREFIX) :].rsplit(".", 1)
result = self._find_result_by_path(path)
step.when = step.when.replace(value, result.return_values.get(name))

jinja2_context = {
"project_config": step.project_config,
"org_config": self.org_config,
Expand Down