Skip to content

Commit 0d84b5d

Browse files
committed
[NRL-762] Always return non-zero exit codes on errors. Add missing env to rollback job in pe action
1 parent e9f9d5c commit 0d84b5d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.github/workflows/persistent-environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,4 +339,4 @@ jobs:
339339
- name: Deactivate Stack
340340
run: |
341341
inactive_stack_name=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }})
342-
poetry run python ./scripts/activate-stack.py ${inactive_stack_name}
342+
poetry run python ./scripts/activate-stack.py ${inactive_stack_name} ${{ inputs.environment }}

scripts/activate_stack.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ def activate_stack(stack_name: str, env: str, session: any):
9393
environment_config = json.loads(response["SecretString"])
9494
print(f"Got environment config for {env}: {environment_config}")
9595

96+
current_active_stack = environment_config[CONFIG_ACTIVE_STACK]
97+
if current_active_stack == stack_name:
98+
print("Cannot activate stack, stack is already active", file=sys.stderr)
99+
sys.exit(1)
100+
96101
lock_state = environment_config[CONFIG_LOCK_STATE]
97102
if lock_state != "open":
98103
print(
99104
f"Unable to activate stack as lock state is not open: {lock_state}",
100105
file=sys.stderr,
101106
)
102-
return
103-
104-
current_active_stack = environment_config[CONFIG_ACTIVE_STACK]
105-
if current_active_stack == stack_name:
106-
print("Cannot activate stack, stack is already active", file=sys.stderr)
107-
return
107+
sys.exit(1)
108108

109109
_set_lock_state(
110110
STATE_LOCKED,

0 commit comments

Comments
 (0)