average-optician-67817
03/25/2025, 3:52 AMthankful-flower-8175
03/25/2025, 4:02 AMthankful-flower-8175
03/25/2025, 4:02 AMlittle-cartoon-10569
03/25/2025, 4:29 AMhelpful-memory-29399
03/25/2025, 12:04 PMbored-dream-52149
03/25/2025, 12:40 PMaverage-optician-67817
03/25/2025, 7:18 PMlittle-cartoon-10569
03/25/2025, 7:25 PMcd
into the appropriate workspace and run pulumi up
.little-cartoon-10569
03/25/2025, 7:26 PMaverage-optician-67817
03/25/2025, 7:26 PMaverage-optician-67817
03/25/2025, 7:26 PMlittle-cartoon-10569
03/25/2025, 7:27 PMaverage-optician-67817
03/25/2025, 7:30 PMlittle-cartoon-10569
03/25/2025, 7:39 PMlittle-cartoon-10569
03/25/2025, 7:41 PMaverage-optician-67817
03/26/2025, 2:50 AMaverage-optician-67817
03/26/2025, 2:50 AMmicroscopic-furniture-52860
04/02/2025, 10:44 AMaverage-optician-67817
04/02/2025, 12:55 PMmicroscopic-furniture-52860
04/02/2025, 1:52 PMdeploy-dev
and deploy-prod
, as we found not all projects used the same conventions and we need to know ahead of time which env/secrets to set up before running the command.
For preview/up we have targets defined like so:
"ci-up": {
"executor": "nx:run-commands",
"options": {
"command": "pulumi up --yes --skip-preview -s {args.stack}",
"cwd": "{workspaceRoot}/dist/{projectRoot}/net8.0/publish"
},
"dependsOn": ["publish"]
},
dependsOn: publish
is required due to the way Pulumi and .net interact, and we want to benefit from caching rather than just have Pulumi build the project + dependencies itself.
We run this as nx run ${{ inputs.project }}:ci-up --stack ${{ inputs.stack }} --output-style static
For running commands against an entire env we have <task>-env
commands, e.g. preview-env
. This is really useful for checking all projects against a single environment.
"preview-env": {
"executor": "nx:run-commands",
"options": {
"command": "pnpm tsx scripts/ci/pulumi-preview.ts --env={args.env}",
}
},
pulumi-preview.ts
does the magic of running nx affected + working out which stacks map to a given env, and then previewing all of them.
So our overall CI pseudocode workflow is:
nx affected lint build publish test
foreach env:
- nx affected -t preview-env --env=env ... -> previews all affected projects/stacks that match the given env
if PR:
set status check OK
if main:
foreach affected project:
- gh workflow dispatch deploy project/stack -> calls a new GH action running ci-preview/ci-up with approval steps
It’s quite new and will likely evolve some more, and the stack -> env mapping is awkward, but overall has really simplified our GH Actions and meant we benefit from nx affected + caching