I am working on a gitlab cicd pipeline and I have ...
# gitlab
I am working on a gitlab cicd pipeline and I have a question. Do you need to create the stacks before running jobs in CICD? If you run the stack init command its going to complain every time you do a deployment the stack already exists unless I write up a bash check to get it conditionally. Also I think this indicates I need to check in the Pulumi.<stack>.yaml file as well? Note I am using Azure blob storage as my state backend
@gentle-exabyte-99244 yes, the best practice is to create a stack ahead-of-time and also to check-in the
Pulumi.<stack name>.yaml
file. Especially, if you are running a bunch of
pulumi config set ...
commands to set stack config properties. For Azure, you are required to set some provider config by default for every stack, so at the very least you'll have at least one config per stack. Technically, there is a way to get around the error you are referring to. Instead of running
pulumi stack init
you could run
pulumi stack select <stack name> -c
. The
will cause the CLI to create the stack if it doesn't exist before selecting it. But as I mentioned above, you should check-in the stack config file as a best practice, unless you also intend to destroy the stack completely in your pipeline. Sort of like an ephemeral stack, in which case, you don't need to create anything ahead of time and simply use the
Thanks @clever-sunset-76585 this is very helpful
Also if you are using self-managed backends, I'd love for you to checkout my desktop app. Hopefully, it'll make things easy for you to manage.
use --stack org/name/stack