Skip to content

Add script for retrieving original source location#2037

Merged
koesie10 merged 2 commits intomainfrom
koesie10/source-map-script
Feb 7, 2023
Merged

Add script for retrieving original source location#2037
koesie10 merged 2 commits intomainfrom
koesie10/source-map-script

Conversation

@koesie10
Copy link
Copy Markdown
Member

@koesie10 koesie10 commented Feb 3, 2023

This adds a script that can be used for retrieving the original source location when given a location in the released extension. It will download the source map from the Actions workflow run of the release and use the source-map library to extract the original location.

Example input:

npx ts-node scripts/source-map.ts v1.7.8 "/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:131164:13"

Output:

/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/src/cli.ts:281:12

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This adds a script that can be used for retrieving the original source
location when given a location in the released extension. It will
download the source map from the Actions workflow run of the release and
use the `source-map` library to extract the original location.
@koesie10 koesie10 requested a review from a team as a code owner February 3, 2023 11:20
Copy link
Copy Markdown
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

I think it's ok to download the artifacts from the workflow run, but it's not an ideal solution. Does anyone else have some suggestions?

Comment thread extensions/ql-vscode/scripts/source-map.ts
if (!(await pathExists(sourceMapsDirectory))) {
console.log("Downloading source maps...");

const workflowRuns = runGhJSON<WorkflowRunListItem[]>([
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, this will only work for as long as the workflow runs are still available from actions. Ideally, we can publish the source map as part of the release process and download the release artifact instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Definitely! We'd probably need to create a ZIP file and upload it as a release asset. I think we can do this in a follow-up PR.

@charisk
Copy link
Copy Markdown
Contributor

charisk commented Feb 6, 2023

I think it's ok to download the artifacts from the workflow run, but it's not an ideal solution. Does anyone else have some suggestions?

I guess the other option is to have the artifact in the release artifacts. Has this been considered?

@aeisenberg
Copy link
Copy Markdown
Contributor

aeisenberg commented Feb 6, 2023

I guess the other option is to have the artifact in the release artifacts. Has this been considered?

That was what I had in mind, but don't know if there are any downsides to this.

@charisk
Copy link
Copy Markdown
Contributor

charisk commented Feb 7, 2023

I guess the other option is to have the artifact in the release artifacts. Has this been considered?

That was what I had in mind, but don't know if there are any downsides to this.

I can't think of one. It feels like it makes sense too.

@koesie10
Copy link
Copy Markdown
Member Author

koesie10 commented Feb 7, 2023

Thanks both! I've created #2049 for uploading the sourcmaps as part of the release process. We can either merge this script as-is and update it once we have actually released a new version with the sourcemaps uploaded, or I can try to upload the sourcemaps to the existing release. In either case, I think it might still make sense to merge this as-is; I can update this to download the sourcemaps from the release assets in a follow-up PR.

Copy link
Copy Markdown
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Thanks. From my perspective this looks good. And in the future, we may move to using release artifacts for the smap.

@koesie10 koesie10 merged commit 648e674 into main Feb 7, 2023
@koesie10 koesie10 deleted the koesie10/source-map-script branch February 7, 2023 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants