-
Notifications
You must be signed in to change notification settings - Fork 190
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
chore(preview-envs): Add preview env workflows to camunda docs repo #3960
Conversation
68dd78d
to
27b5e24
Compare
b0d90b9
to
e01c55d
Compare
4e934e4
to
8e111aa
Compare
e307558
to
a7ab636
Compare
e7d6e58
to
03c91b1
Compare
03c91b1
to
68ab9c4
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.
A last minor comment regarding two duplicated steps.
The rest is awesome, very good job 🎉
Your preview env has been torn down. |
@akeller This pr is now ready for devex review as well :) |
@andromaqui this is super cool! I know our PMs will be very excited to have previews available for docs PR reviews 🚀 The implementation looks clean and is easy to follow. No concerns with that. I'm looking into each of the open PRs associated with this work and noticed I occasionally see a Initially, I thought this happened on the first load, but it happened again. It happens if I am on any page and hit the refresh button in my browser. The error continues until I navigate to the docs homepage and refresh. Given that this is better than our current state, I will accept this as a bug if this is a complex issue (either to debug or fix). Screen.Recording.2024-06-25.at.2.45.37.PM.mov |
@akeller Thank you for catching this error, I didnt think of refreshing tbh. I had al look into the issue and that seems to be a common problem with bucket hosted javascript applications (example thread on stack overflow). I am not yet 100% certain but I think the change will involve modifying some settings on the bucket side so this pr here probably doesnt have influence in this topic. If the current solution is acceptable to you, could we consider merging this? Today I am working on another urgent task but I will priorise fixing this issue with the preview environments right after |
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.
Based on the conversation in the PR, I'm good to merge this 👍
Description
This pr adds two workflows which aim to assist in deploying the
camunda-docs
preview environments as well as tearing the environments down:preview-env-deploy.yml:
Deployment Trigger:
Activates on labeled pull requests.Build:
Installs dependencies, builds the projectDeployment
: Syncs the content of the path in the bucket to the local folderbuild
. I did a test and using the gsutil command with thersync -d -r
option does the following:a. Files which don’t exist in the bucket but exist locally in the build folder will get uploaded
b. Files which exist in the bucket but not in the local folder will get deleted from the bucket
c. File which exist in both the local directory and the bucket but they have different content will be synced (the content of the local files will override the content of the files in the bucket)
Comment Handling:
Updates or creates comments on the pull request about deployment statusa. If no comments exist then a comment indicating the deployment url will be shown
b. If a comment is found which indicates that the environment was previously teared down, it will be replaced by a comment indicating the preview env url.
c. If there is subsequent deployments then the comment indicating that the preview env has been deployed will remain intact
Deployment status
: The deployment status will start showing in the pr just before the build step. Once the deployment has been concluded the url will be shown at the statuspreview-env-teardown.yml
Deployment Trigger:
Runs on pull request unlabeled or closed events if the 'deploy' label is present or was present.Deletes Bucket Files:
Removes files from the Google Cloud Storage bucket associated with the pull request.Updates Comment:
Finds and updates a specific comment on the pull request to indicate the preview environment has been torn down.Testing
Test1: Teardown workflow gets triggered when closing pr
PR #3961
Run triggered: https://github.com/camunda/camunda-docs/actions/runs/9576897550/job/26404161568
Test 2: When pushing multiple times in the same pr: the deploy comment won’t get posted multiple times and the preview environment will be build from scratch
An example of this can be found in this pr as the deploy label is active and there are multiple pushes which have happened. The latest run of the
deploy-preview-env
workflow wiped out all files from the bucketpr-3960
before pushing the built changes againhttps://github.com/camunda/camunda-docs/actions/runs/9577037637/job/26404564930?pr=3960
Test 3: Adding and removing the deploy label multiple times results in only one comment in the pr indicating the current status of the preview env.
You can have a look at the history of this pr. The label has been removed and added multiple times and there is one comment which constantly get updated. The comment gets created/updated in the following ways:
After env was torn down:
Test 4: The url in the posted comment leads to a working preview environment
Following this comment on this pr
the url posted there should prompt us to a working preview environment. The link is https://preview.docs.camunda.cloud/pr-3960/index.html.
Test 5: Test concurency in deploy preview env workflow
PR: #3965
Initial run triggered: https://github.com/camunda/camunda-docs/actions/runs/9595842471/job/26461440032?pr=3965
Second run triggered: https://github.com/camunda/camunda-docs/actions/runs/9595856162/job/26461487867?pr=3965
The initial run got cancelled after the first run got triggered
Test 6: Preview env has been torn down
PR: #3972
I deployed the preview env and then removed the label to tear it down.
Since the deployment is only deactivated and not removed, this is how it is deployment after the environment has been torn down (notice the url not been apparent anymore):
An explanation as to why the deployment has not been removed can be found in this comment #3960 (comment)
When should this change go live?
hold
label or convert to draft PR)PR Checklist
/versioned_docs
directory./docs
directory (aka/next/
).