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

feat: Allow uploading sources for debug files #773

Merged
merged 7 commits into from
Jun 7, 2022
Merged

Conversation

Swatinem
Copy link
Member

@Swatinem Swatinem commented Jun 1, 2022

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2022

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 80158ab

Copy link
Collaborator

@vaind vaind left a comment

Choose a reason for hiding this comment

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

Nice!

should we also add tests? We already test that the binaries are being uploaded for all supported platforms: #763

To do that we would likely need to

  1. enable the new option in the integration test project (...-update-sentry.ps1 script)
  2. maybe update the symbol-upload-server.py - if the source-code upload uses a new API
  3. update common.ps1 CheckSymbolServerOutput() with to check that the right files were uploaded.

@Swatinem
Copy link
Member Author

Swatinem commented Jun 1, 2022

I think the source bundles are the same as other debug files in that sense. I can bug @bitsandfoxes to help me set up the integration tests so I can get something up and running.

@vaind
Copy link
Collaborator

vaind commented Jun 1, 2022

I think the source bundles are the same as other debug files in that sense. I can bug @bitsandfoxes to help me set up the integration tests so I can get something up and running.

I'll give it a quick go myself, since I've done the symbol upload tests I know these pieces by heart

@vaind
Copy link
Collaborator

vaind commented Jun 1, 2022

Hmm, the sources don't seem to be easily distinguishable from binary files. Here's the diff of uploading the same directory (windows desktop build), with upload-sources enabled in one case. I deduce GameAssembly.pdb are being uploaded...

image

@Swatinem
Copy link
Member Author

Swatinem commented Jun 2, 2022

In sentry, all these files have the same name, with the same debug_id. But they have different contents, like here:

Bildschirmfoto 2022-06-02 um 11 59 47

So I think this is perfectly fine. Although I agree its confusing. We do use .src.zip in some places, although its not a valid zip file either because it has its own header prepended before the actual zip contents.

@Swatinem
Copy link
Member Author

Swatinem commented Jun 2, 2022

One thing to watch out for. Some time ago we had the problem that source bundles were being re-uploaded all the time, because they were different all the time because of unstable sorting order internally. Now we should have a stable sorting order. But it seems that at least my local sentry-cli still re-uploads these files over and over again, so that bug is not fixed yet :-(

The reason I say this is because you would probably end up with different chunk hashes, and thus wouldn’t be able to use snapshot testing for this.

@vaind
Copy link
Collaborator

vaind commented Jun 2, 2022

One thing to watch out for. Some time ago we had the problem that source bundles were being re-uploaded all the time, because they were different all the time because of unstable sorting order internally. Now we should have a stable sorting order. But it seems that at least my local sentry-cli still re-uploads these files over and over again, so that bug is not fixed yet :-(

The reason I say this is because you would probably end up with different chunk hashes, and thus wouldn’t be able to use snapshot testing for this.

So far the symbol upload tests didn't use the hash, just the content file name... not sure what to do about the source upload yet, I may need to change the test-server response so that the CLI actually uploads the content so that I know what came in. Right now the server always responds with a message indicating all chunks are already uploaded.

@Swatinem
Copy link
Member Author

Swatinem commented Jun 2, 2022

Isn’t that a bit contradictory? Using the content, but then the contents are not actually uploaded because the server says chunks already exist?

Btw, this was the issue with source bundles: getsentry/sentry-cli#831 The problem is rather timestamps -_- So maybe there is a fairly easy workaround for this in symbolic.

@vaind
Copy link
Collaborator

vaind commented Jun 2, 2022

sorry, brain lag there - I was going to say "file name" instead of "content", I've fixed the comment.

@vaind vaind force-pushed the feat/include-sources branch 17 times, most recently from 0531955 to a9fc9d8 Compare June 6, 2022 19:01
@vaind
Copy link
Collaborator

vaind commented Jun 7, 2022

I've added the tests (took way more effort than anticipated... as usual), though only based on the number of uploaded files as I couldn't (in a self-imposed time box) figure out unpacking & analyzing the content of the uploaded files. Should be still good to catch issues in the future: 21cb45b


process_upload_symbols() {{
./{SentryCli.SentryCliMacOS} --log-level=info upload-dif $BUILT_PRODUCTS_DIR 2>&1 | tee ./sentry-symbols-upload.log
./{0} --log-level=info upload-dif {1} $BUILT_PRODUCTS_DIR 2>&1 | tee ./sentry-symbols-upload.log
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a nifty way of getting some additional arguments in there!

src/Sentry.Unity.Editor/Android/DebugSymbolUpload.cs Outdated Show resolved Hide resolved
test/Scripts.Integration.Test/common.ps1 Show resolved Hide resolved
@Swatinem
Copy link
Member Author

Swatinem commented Jun 7, 2022

❤️ thanks so much for taking this over! @vaind

@@ -35,7 +35,7 @@ public Fixture()
}

public DebugSymbolUpload GetSut() => new(new UnityLogger(new SentryOptions(), LoggerInterceptor),
UnityProjectPath, GradleProjectPath, IsExporting, Application);
null, UnityProjectPath, GradleProjectPath, IsExporting, Application);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add unit tests for the path that adds --include-sources?

@@ -129,7 +129,7 @@ public void AddBuildPhaseSymbolUpload_CleanXcodeProject_BuildPhaseSymbolUploadAd
xcodeProject.ReadFromProjectFile();

var didContainUploadPhase = xcodeProject.MainTargetContainsSymbolUploadBuildPhase();
xcodeProject.AddBuildPhaseSymbolUpload(_fixture.Options.DiagnosticLogger);
xcodeProject.AddBuildPhaseSymbolUpload(_fixture.Options.DiagnosticLogger, new SentryCliOptions());
Copy link
Contributor

Choose a reason for hiding this comment

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

Since uploadSources is false by default, should we add unit tests for the path that adds --include-sources?

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

Other than missing tests LGTM

Co-authored-by: Stefan Jandl <stefan.jandl@sentry.io>
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
@vaind
Copy link
Collaborator

vaind commented Jun 7, 2022

merging as is to get the changes for #785 , I'll add unit tests & update CI to run alternatively with/without sources in a follow up PR

@vaind vaind merged commit 318529d into main Jun 7, 2022
@vaind vaind deleted the feat/include-sources branch June 7, 2022 18:23
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.

None yet

4 participants