Performing a change-set in one job and executing it in another

We are using AWS SAM and Gitlab CI/CD. I was wondering how to perform a change-set in one job and execute it in another one.

What problem are you running into?

I don’t know how to execute the change-set created in job A, in job B

I first want to see the changes

Doing that in another job would result in rebuilding the lambdas (using cache), regenerate the package.yml file etc

When you create the change set, it emits a change set id, then you call execute_change_set against that stack and change set id

I do the same thing in GH Action

You grab the change set id via regex ?

Changeset created successfully. arn:aws:cloudformation:eu-central-1:****:changeSet/samcli-deploy1641481030/a4957719-f1a7-4e49-b5b4-9f2dd6d12996

Oh I’m sorry I missed the SAM part of your question

I could use SAM to build and CF cli to create the changeset

Yeah, that’s what I do

SAM does have a “confirm” option in deploy, but it’s designed for the console

Could create a slack notification with manual step and all but a bit overkilled

How do you pass the change set id? In Gitlab, it doesn’t seem easy

I found all the existing tools very weak in this specific area (being able to post a change set and wait for approval before continuing), so I wrote my own github custom action which is basically just a thin wrapper around create/execute_change set

Though in theory you could do it even with cli

The reason I went for a tool was managing different parameters for environments

Thanks for your input!

No problem, good luck