-
Notifications
You must be signed in to change notification settings - Fork 63
Deploy production frontend on release & correctly time staging deployment #1556
Deploy production frontend on release & correctly time staging deployment #1556
Conversation
Storybook and Tailwind configuration previews: Ready Storybook: https://wordpress.github.io/openverse-frontend/1556 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try it! Regarding rollbacks, how were we going to handle those? Was it manual runs of the GitHub workflow with a tag
input field?
Right! I forgot about that. I'll create a new "rollback production" workflow that can be dispatched with a |
5e8041c
to
0cd5b3f
Compare
0cd5b3f
to
5366fee
Compare
ae178e5
to
c0117e4
Compare
c0117e4
to
879b576
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exciting and fun automation! 🚀 I left some questions but nothing blocking.
deploy-staging: | ||
name: Deploy staging frontend | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this deploy to staging on each push in a pull request (to main)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because the push event is scoped to the main branch.
You can confirm this is true by seeing that this workflow step was skipped in this PR: https://github.com/WordPress/openverse-frontend/runs/7283335174?check_suite_focus=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, makes sense! Though then is the on: -> pull_request: ...
scope doing something in this workflow? 🤔
I remember we used to publish an image for each PR but seems that has been lost at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do still publish the image for each step. You can see that happening on this PR 🙂 The pull_request
trigger does just that.
We just skip deploying for anything that isn't a push to main (for staging) or a release.
I wanted to test the version route locally after building the dockerfile with something like |
Ah, this is a known issue that we decided to accept. It has to do with some permissions issue with the COPY commands, IIRC. I've pushed an update to change the |
I'm going to merge this as it's working in CI and for me locally, the worst case scenario is that it still doesn't build on an M1, but I think it should fix it. If not we can open another issue if we still wish to address this. |
Fixes
Fixes #1557 by @sarayourfriend
Description
Deploys https://search-production.openverse.engineering whenever a release is cut in this repository. At least hopefully! We'll need to see if the GHCR configuration actually works for releases and if it will successfully trigger the "deploy-production" workflow to completion with the release tag. Unfortunately I'm not aware of any way to test this functionality other than by merging it and see if it works with a test release.
I also noticed that the staging deployment and the GHCR push to the
main
tag have a race condition. I've fixed that in this PR by only running the staging deployment after the GHCR image is uploaded after a push to themain
branch.Also: I've removed the old push_prod and push_staging workflows that were used to push images to ECR. We no longer use ECR, so those workflows will fail until they're removed.
Also: this adds the
version.json
requested by the Nginx sidecar issue. I think we can safely close that issue for now and in the future look into whether we want to use Nginx to serve static files. We don't currently do that, and the version.json endpoint isn't worth the extra complexity for now.Testing Instructions
I think just merge and see how it goes. Note that the existing GHCR push should still work for this branch. You can see I did a bunch of test commits to get the action changes verified as working, in particular the tag extraction for the RELEASE build arg.
To test the build arg, checkout this branch and run:
Run the generated image and verify that you can reach the
/version.json
endpoint athttp://localhost:8443/version.json
:Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin