-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: Fix sentry source maps #2186
Conversation
following basic structure of Glides' approach in mbta/glides#936
This will prevent duplication of the new sentry logic across each deploy action. Based on Glides' deploy actions https://github.com/mbta/glides/tree/main/.github/workflows
0376392
to
764c9ec
Compare
Coverage of commit
|
Coverage of commit
|
concurrency: | ||
group: dev-blue | ||
cancel-in-progress: true | ||
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'deploy-to-dev-blue') }} |
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.
In copying Glides' approach to splitting deploy actions, this also adds support for deploying a PR with the deploy-to-[env]
label. That is not directly related to the task at hand though and can be removed if desired. I did find it helpful for the purposes of testing this PR!
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 like this refactor, thank you!
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.
Another thing I like about this: using labels for dev envs might mean we don't need to ask if a dev env is open, because we could filter PR's by labels, and any open PR's with these label's would be "occupying" the environment.
- uses: mbta/actions/build-push-ecr@v1 | ||
id: build-push | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
docker-repo: ${{ secrets.DOCKER_REPO }} | ||
docker-additional-args: --build-arg SENTRY_RELEASE=${{steps.version-ids.outputs.sentry-release}} |
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.
Glides also adds the source maps as part of using this release action. I opted to continue uploading the source maps as part of the upload_assets
step for simplicity of using the exiting Skate source map upload script.
SENTRY_RELEASE=$(npx @sentry/[email protected] releases propose-version) | ||
npx @sentry/[email protected] releases files "$SENTRY_RELEASE" upload-sourcemaps "$STATIC_DIR/js" | ||
SENTRY_RELEASE=${2-$(npx @sentry/[email protected] releases propose-version)} | ||
npx @sentry/[email protected] releases files "$SENTRY_RELEASE" upload-sourcemaps "$STATIC_DIR/js" --url-prefix "~/${APP}/js" |
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.
The --url-prefix
was needed here because the abs_path
of the error points to the hosted static files, so the path of the uploaded sourcemaps needs to match the path of those hosted static files.
- name: Get version ids | ||
id: version-ids | ||
run: | | ||
echo "sentry-release=${{github.ref}}_${{github.sha}}" | tr / - >> "$GITHUB_OUTPUT" |
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.
Glides uses the tag as the sentry version when deploying from prod. Since we typically don't do prod deploys from tags, opting to use the ref + sha for all deploys.
with: | ||
environment: ${{ inputs.env }} | ||
version: ${{steps.version-ids.outputs.sentry-release}} | ||
set_commits: "skip" |
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.
If we enable the sentry => github integration for Skate, then set_commits
can be set to "auto". This can be done if desired as part of this PR, opted to "skip" for simplicity for now!
Coverage of commit
|
Not sure if there will be unintended consequences of this change, and it is out of scope for solving the immediate issue at hand
Coverage of commit
|
Coverage of commit
|
This reverts commit c4b4f43.
Coverage of commit
|
ticket: https://app.asana.com/0/1152340551558956/1205212771706510/f
This is largely based on Glides' setup of releases https://github.com/mbta/glides/pull/936. There are some differences in this approach in order to limit the scope of this PR based on Skate's existing setup, but I'll call those out with specific comments.
Note: It seems that Sentry may be moving towards "Artifact Bundles" using debug IDs (see What are Artifact Bundles, debug ID as mandatory and releases as optional in Uploading Source Maps). I attempted to take that approach in kb-sentry-stack-fix but was not able to get it to work:
debug_meta
was not present on the error event JSON when it is expected based on the troubleshooting docs across a few variations of attempts. In favor of fixing the problem at hand, I've opted to stop pursuing the debug ID approach in favor of the working releases approach, but we may want to revisit that approach down the line!