Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAU: Simplify frontend deployment process #1795

Merged
merged 3 commits into from
Jul 10, 2024
Merged

Conversation

whi-tw
Copy link
Contributor

@whi-tw whi-tw commented Jul 8, 2024

What

Previously we had two workflows:

  1. Build and push the docker image
  2. Create and upload the terraform zip

The second workflow was triggered by the completion of the first.

This could lead to a situation where due to network slowdowns, two PRs merged in a short space of time could have their metadata (and possibly terraform) mixed up: the checkout stage in the deploy job just pulled the HEAD commit from the repo, regardless of the commit the build and push job was spawned from.

In this new single workflow, we build the image and push the terraform within the same workflow run, meaning that race conditions are no longer possible.

Additionally, I've added a concurrency group, to ensure that only one deploy job can run at once.

Finally, I've added an actionlint pre-commit hook and improved the two node hooks - instead of building up a docker container each time, it just uses the local node_modules folder and runs the tasks natively. This is far faster.

How to review

  • Code review
  • Check i've not missed anything when moving the logic over

@whi-tw whi-tw requested review from a team as code owners July 8, 2024 16:36
@whi-tw whi-tw force-pushed the BAU/deploy-frontend-better branch 2 times, most recently from 26fed20 to 2670f22 Compare July 9, 2024 09:41
whi-tw added 3 commits July 9, 2024 11:21
Also:
- add actionlint to the pre-commit hooks to check the GitHub Actions
- include extra 'standard' checks
- run prettier / eslint natively, not via docker which was slow and
  doesn't cache well
- add a github workflow to run pre-commit on PRs
There is no good reason to have these as separate workflows. This can
just lead to the deploy workflow pushing a zip with the wrong pull
request metadata. Instead, just run both in the same workflow.
If we don't have a label set, dependabot will label the PRs with
"dependencies" and with a label identifying the type of dependency
that was updated. This makes it easy to filter PRs by dependency type,
for more focussed review.
@whi-tw whi-tw force-pushed the BAU/deploy-frontend-better branch from ed47dcc to b387bdb Compare July 9, 2024 10:21
Copy link

sonarqubecloud bot commented Jul 9, 2024

Copy link
Contributor

@BeckaL BeckaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible to me

@whi-tw whi-tw merged commit 60fe445 into main Jul 10, 2024
5 checks passed
@whi-tw whi-tw deleted the BAU/deploy-frontend-better branch July 10, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants