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

Add required variables for Nuxt Sentry setup #5284

Merged
merged 20 commits into from
Dec 19, 2024
Merged

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Dec 17, 2024

Fixes

Follow up on #5279

Description

This pull request updates the Docker build process to address an issue with environment variables not being properly read by Sentry during image builds. This prevented the source maps from being created and sent to Sentry. The release also wasn't set, so the source maps did not work.

In our CI pipeline, when a pull request is merged into the main branch, the process builds a Docker image that will then be deployed to production. We need to generate the source maps and release for this image, and not other builds.

To generate and upload the source maps and release, Sentry needs the auth token. This is set in CI only on the push to main (when a PR is merged) or when release is triggered manually through the Actions GUI. This way, the source maps are generated and sent to Sentry only once per PR.

Setting the release name also did not work with the env variable, only using the sentry.unstable_sentryBundlerPluginOptions properties in nuxt.config.ts did 1.

With these changes, I also removed some locales setup from the setup-env, because they are set up second time during the build of the app - so duplicated unnecessarily. Instead of removing the locale setup from setup-env, I removed it from the Dockerfile.

Testing Instructions

You can see the run that did set an auth token (because I inverted the condition for variable), and built the sourcemaps and uploaded them to Sentry: https://github.com/WordPress/openverse/actions/runs/12387322051/job/34576691827?pr=5284

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Footnotes

  1. [Nuxt] Cannot set release name used by sentry-vite-plugin

@openverse-bot openverse-bot added 🧱 stack: frontend Related to the Nuxt frontend 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Dec 17, 2024
Copy link

github-actions bot commented Dec 17, 2024

Latest k6 run output1

     ✓ status was 200

     checks.........................: 100.00% ✓ 416      ✗ 0   
     data_received..................: 97 MB   401 kB/s
     data_sent......................: 54 kB   226 B/s
     http_req_blocked...............: avg=66.81µs  min=2.2µs    med=4.55µs   max=1.38ms   p(90)=126.94µs p(95)=517.71µs
     http_req_connecting............: avg=44.68µs  min=0s       med=0s       max=1.32ms   p(90)=86.34µs  p(95)=114.19µs
     http_req_duration..............: avg=174.97ms min=29.75ms  med=139.47ms max=686.21ms p(90)=342.57ms p(95)=399.2ms 
       { expected_response:true }...: avg=174.97ms min=29.75ms  med=139.47ms max=686.21ms p(90)=342.57ms p(95)=399.2ms 
   ✓ http_req_failed................: 0.00%   ✓ 0        ✗ 416 
     http_req_receiving.............: avg=153.24µs min=47.59µs  med=129.23µs max=559.08µs p(90)=273.4µs  p(95)=314.83µs
     http_req_sending...............: avg=25.44µs  min=7.42µs   med=21.2µs   max=122.28µs p(90)=37.11µs  p(95)=69.71µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=174.79ms min=29.66ms  med=139.36ms max=685.88ms p(90)=342.28ms p(95)=398.94ms
     http_reqs......................: 416     1.725056/s
     iteration_duration.............: avg=941.04ms min=476.98ms med=1.09s    max=1.85s    p(90)=1.25s    p(95)=1.28s   
     iterations.....................: 78      0.323448/s
     vus............................: 3       min=0      max=6 
     vus_max........................: 60      min=60     max=60

Footnotes

  1. This comment will automatically update with new output each time k6 runs for this PR

Copy link

Full-stack documentation: https://docs.openverse.org/_preview/5284

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.

@obulat obulat force-pushed the fix/sentry-nuxt-setup branch 2 times, most recently from f5aa192 to 0cafbed Compare December 17, 2024 20:27
@obulat obulat added 🟨 priority: medium Not blocking but should be addressed soon 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Dec 17, 2024
@obulat obulat force-pushed the fix/sentry-nuxt-setup branch 11 times, most recently from 0752b91 to 62126de Compare December 18, 2024 05:23
@openverse-bot openverse-bot added 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: mgmt Related to repo management and automations labels Dec 18, 2024
@obulat obulat force-pushed the fix/sentry-nuxt-setup branch 2 times, most recently from 42d1620 to bb750c4 Compare December 18, 2024 07:25
@obulat obulat force-pushed the fix/sentry-nuxt-setup branch from bb750c4 to b2b3622 Compare December 18, 2024 07:43
@obulat obulat self-assigned this Dec 18, 2024
@obulat obulat marked this pull request as ready for review December 18, 2024 07:44
@obulat obulat requested review from a team as code owners December 18, 2024 07:44
@obulat obulat requested review from krysal and dhruvkb and removed request for a team December 18, 2024 07:44
Copy link
Member

@krysal krysal left a comment

Choose a reason for hiding this comment

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

I see we have new frontend releases from recent days in Sentry. Awesome!

fe_releases

@obulat obulat merged commit d694acc into main Dec 19, 2024
60 checks passed
@obulat obulat deleted the fix/sentry-nuxt-setup branch December 19, 2024 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: frontend Related to the Nuxt frontend 🧱 stack: mgmt Related to repo management and automations
Projects
Status: 🤝 Merged
Development

Successfully merging this pull request may close these issues.

3 participants