Hi everyone. I have a "production" branch, a "stag...
# general
l
Hi everyone. I have a "production" branch, a "staging" branch and then multiple feature branches. Should I create a stack per branch in my CI?
o
Definitely. You will want a stack per branch so that the resources deployed in each are separate from one another.
l
So for each, I need to create Pulumi.[branch-name].yml with my config?
It doesn't seem very optimal because I am just going to copy paste the same config everytime
m
You might want to check out project-level configuration, which can help reduce some of this kind of duplication: https://www.pulumi.com/blog/project-config-mvp/
l
Project level conf is conf that applies to all stacks, so that is not what is appropriate in the situation?
o
It doesn't seem very optimal because I am just going to copy paste the same config everytime
Project level config will allow you to put the common configuration in Pulumi.yaml, and the unique config that is per-stack in each of the separate stack config files.
l
Yes, but what if I want to deploy my stack
feature-branch
for each of my feature branch? How could I do?
o
Use the CLI or automation API to configure your per-branch stacks. Use project config for common configuration. If you have constants that are the same across all of your stacks, you can put those in code as well, if it makes more sense.
n
You can create one Pulumi.default.yaml (for example) and on feature branches run:
pulumi up --stack ${BRANCH_NAME_SLUG} --config-file Pulumi.default.yaml
l
Thanks @narrow-guitar-10891for your solution!! That seems to be the correct way of handling my problem!
n
🔥