sparse-spring-91820
10/08/2021, 8:13 AMpulumi/stack_init
step as it fails because of the already existing stack. Is there any way how to select stack if it exists or init new one if doesn't other than piping command's stderr to null output so that my circleci job doesn't fail?
This is my circleci job config:
jobs:
deploy-infra:
<<: *default-executor
working_directory: ~/project/infrastructure
steps:
- checkout:
path: ../
- node/install-packages
- pulumi/login
- pulumi/stack_init:
stack: 'dev'
- run:
name: Add stack config
command: |
pulumi config set aws:region us-east-1
pulumi config set bucket:name cicd-test-bucket
- pulumi/update:
stack: 'dev'
I can assign build number to stack name like it's in the orb example:
- pulumi/stack_init:
stack: 'robot-co/test-pr_${CIRCLE_BUILD_NUM}'
but I don't want to create new stack and new resources on every ci/cd trigger, I just want to have 3 stacks which are dev
, staging
and prod
.witty-candle-66007
10/08/2021, 4:04 PMpulumi/update
command will just run against the provide stack.
However, if you canโt assume that, then maybe this blog about how to ignore a failed step will work:
https://support.circleci.com/hc/en-us/articles/360057590591-Ignoring-A-Failure-In-A-Step
So you can do the stack_init and if it fails because the stack already exists, you continue.sparse-spring-91820
10/11/2021, 5:26 AM