camunda / camunda-docs

Camunda 8 Documentation, including all components and features
https://docs.camunda.io/
Other
51 stars 166 forks source link

chore(preview-envs): Add preview env workflows to camunda docs repo #3960

Closed andromaqui closed 6 days ago

andromaqui commented 2 weeks ago

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:

preview-env-teardown.yml

Testing

Test1: Teardown workflow gets triggered when closing pr

PR https://github.com/camunda/camunda-docs/pull/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 bucket pr-3960 before pushing the built changes again https://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:

Screenshot 2024-06-20 at 10 50 46

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: https://github.com/camunda/camunda-docs/pull/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: https://github.com/camunda/camunda-docs/pull/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):

Screenshot 2024-06-24 at 14 41 22

An explanation as to why the deployment has not been removed can be found in this comment https://github.com/camunda/camunda-docs/pull/3960#discussion_r1648617453

When should this change go live?

PR Checklist

andromaqui commented 1 week ago

@pepopowitz Thank you for having a look at this pr and glad you are pleased with the current result. I just wanted to say that the pr has not gone through infra review yet so a merge is not possible. Tagging @akeller as well on this message :)

akeller commented 1 week ago

@akeller I'm assigning this PR to you to review/merge when it is convenient for you, since I will be out of office after tomorrow and unavailable to support if anything happens. If you'd rather wait until I'm back in a few weeks, feel free to reassign to me.

I reworked this so I'm not the assignee. I didn't do any work here 😉 and @andromaqui deserves all the credit!

Adding this to my list of things to review tomorrow.

github-actions[bot] commented 1 week ago
Your preview env has been torn down.
andromaqui commented 1 week ago

@akeller This pr is now ready for devex review as well :)

akeller commented 1 week ago

@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 NoSuchKey error: image

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).

https://github.com/camunda/camunda-docs/assets/1051363/ded5c860-7c87-42d0-816c-c49b1714732f

andromaqui commented 1 week ago

@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