Branch Push Workflow
Let’s take a look at Branch Push Workflow. This is what happens when a push is made to the any other branch except for
main. Here’s the relevant section.
- image: cimg/ruby:3.1.0
- run: .circleci/bin/install
- run: terraspace plan demo
# use different dev_plan and dev_up workflows so it shows up on the CircleCI dashboard
not: << pipeline.parameters.manual >>
After the install script, it calls the
terraspace plan demo
terraspace plan automatically runs for dev infrastructure for every push to any branch that is not
main. This gives a preview of what changes will happen to the dev infrastructure before the branch is merged into
Create Branch and PR
git checkout feature
git add .
git commit -m "change code"
git push -u origin feature
To create a Pull Request, you can either go to the url printed out from
Or go to the branch on GitHub and click “New Pull Request”. Click “Create pull request”.
Now here’s the CircleCI quirk we noted in the previous Push Workflow. The PR event does not fire when the PR is initially opened. There needs to an additional git push after the PR has been opened for CircleCI to set
CIRCLE_PULL_REQUEST for that build.
This is important because we are also using
terraspace_vcs_github in the
Gemfile so Terraspace can post PR comments with a summary of the changes.
Let’s make another change and push again.
git add .
git commit -m "another code change"
We’ll see another build.
Pull Request Comment
You’ll also see PR comment with a preview of changes and a Terraspace Cloud link.
Click on Details to see the Pipeline Logging output.
You can also see the output on Terraspace Cloud:
plan was run and provided a preview of what would happen. Any additional
git push to the PR branch will provide updated previews.
If you merge the PR, the Push Workflow that we covered earlier will automatically apply the preview.
Next, we’ll cover the Manual Workflow pipeline.