feat: store outputs for Pulumi stacks
ZeroDownTime/CloudBender/pipeline/tag This commit looks good Details
ZeroDownTime/CloudBender/pipeline/head This commit looks good Details

This commit is contained in:
Stefan Reimer 2023-12-04 16:24:55 +00:00
parent 6d3bf4767c
commit ff2de9d390
2 changed files with 13 additions and 26 deletions

View File

@ -444,37 +444,22 @@ def _provision(cb, stacks):
"""Utility function to reuse code between tasks"""
for step in sort_stacks(cb, stacks):
if step:
# Pulumi is not thread safe, so for now one by one
if _anyPulumi(step) and False:
with ThreadPoolExecutor(max_workers=len(step)) as group:
futures = []
for stack in step:
if stack.mode != "pulumi":
status = stack.get_status()
if not status:
stack.create()
futures.append(group.submit(stack.create))
else:
stack.update()
futures.append(group.submit(stack.update))
# Pulumi only needs "up"
else:
stack.create()
futures.append(group.submit(stack.create))
else:
with ThreadPoolExecutor(max_workers=len(step)) as group:
futures = []
for stack in step:
if stack.mode != "pulumi":
status = stack.get_status()
if not status:
futures.append(group.submit(stack.create))
else:
futures.append(group.submit(stack.update))
# Pulumi only needs "up"
else:
futures.append(group.submit(stack.create))
for future in as_completed(futures):
future.result()
for future in as_completed(futures):
future.result()
cli.add_command(version)

View File

@ -613,14 +613,14 @@ class Stack(object):
self.stackname,
output_file)
# If secrets replace with clear values for now, display ONLY
# If secrets replace with cleartext values for now, display ONLY
for k in self.outputs.keys():
if hasattr(
self.outputs[k],
"secret") and self.outputs[k].secret:
self.outputs[k] = self.outputs[k].value
logger.info(
logger.debug(
"{} {} Outputs:\n{}".format(
self.region,
self.stackname,
@ -815,6 +815,7 @@ class Stack(object):
if self.mode == "pulumi":
kwargs = self._set_pulumi_args()
self._get_pulumi_stack(create=True).up(**kwargs)
status = "COMPLETE"
else:
# Prepare parameters
@ -846,9 +847,10 @@ class Stack(object):
)
status = self._wait_for_completion()
self.get_outputs()
return status
self.get_outputs()
return status
@exec_hooks
def update(self):