Closed kostas-theo closed 3 years ago
Hey @roachmd ! So sorry for dropping the ball here. I really appreciate the PR, but I don't think we want to actually go with this approach.
First, there are several reasons why pulumi stack init
could fail. And so running pulumi stack select
on any non-zero exit code doesn't seem right. But more importantly, I think the right approach when using Pulumi in CI would be to use the pulumi stack select --create
gesture.
I don't recall exactly when this feature was added, but you can run pulumi stack select
with a --create
flag that will create the stack if it doesn't already exist. That way, things will "just work" even if it is the first time referencing that particular stack name.
https://www.pulumi.com/docs/reference/cli/pulumi_stack_select/
Unfortunately we don't have a pulumi/stack_select
orb yet. I'll file an issue so we can track adding that, which would be generally useful for other scenarios as well.
Small addition of the
pulumi stack select
command into thepulumi/stack_init
orb.Currently, if you add
pulumi/stack_init
into your circleci pipeline, you will have to remove that command in the very next run, as this command is only intended to be run once, and will fail after the first run with:This change adds the
pulumi stack select
afterwards if the above error occurs, resulting in a consistent pipeline for new and existing projects.