https://pulumi.com logo
#gitlab
Title
# gitlab
g

gentle-exabyte-99244

06/07/2023, 3:41 PM
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
c

clever-sunset-76585

06/08/2023, 3:29 PM
@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
-c
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
-c
flag.
g

gentle-exabyte-99244

06/12/2023, 5:41 PM
Thanks @clever-sunset-76585 this is very helpful
c

clever-sunset-76585

06/12/2023, 5:43 PM
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.
p

polite-sandwich-68547

06/16/2023, 11:45 AM
use --stack org/name/stack
3 Views