Skip to content

Upload only necessary build files #270

Closed
@vaind

Description

@vaind

With the inclusion of sentry-native for Windows builds (getsentry/sentry-dart#2286) the plugin exhibits an issue.

When run, the CLI is trying to upload everything in the current directory but there are some intentionally broken debug files inside one of the sentry-native dependencies' test files so the upload fails with "Invalid checksum" (and no details because CLI logs are not piped...)

This is what it looks like:

entry CLI downloaded successfully.

retrieving config from pubspec.yaml
☑ reading config values                                                             
☑ validating config values                                                             
[❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚] 18% uploading debug symbols..                                
INFO    2024-10-15 20:06:18.197891599 +02:00 sentry-cli was invoked with the following command line: "/home/ivan/dev/sentry-dart/flutter/example/.dart_tool/pub/bin/sentry_dart_plugin/sentry-cli" "--log-level" "info" "debug-files" "upload" "--org" "sentry-sdks" "--project" "sentry-flutter" "--include-sources" "/home/ivan/dev/sentry-dart/flutter/example" "--wait"
  INFO    2024-10-15 20:06:18.197961939 +02:00 Issuing a command for Organization: sentry-sdks Project: sentry-flutter

error: Invalid checksum

exitCode: 1

while when you launch sentry-cli manually, you can see the context:

  DEBUG   2024-10-15 22:02:55.368911765 +02:00 finished zip archive /home/ivan/dev/sentry-dart/flutter/example/linux/flutter/ephemeral/.plugin_symlinks/sentry_flutter/example/build/linux/x64/release/_deps/sentry-native-src/external/crashpad/third_party/zlib/zlib/google/test/data/test_nocompress.zip
  DEBUG   2024-10-15 22:02:55.368959756 +02:00 searching zip archive /home/ivan/dev/sentry-dart/flutter/example/linux/flutter/ephemeral/.plugin_symlinks/sentry_flutter/example/build/linux/x64/release/_deps/sentry-native-src/external/crashpad/third_party/zlib/zlib/google/test/data/Wrong CRC.zip
error: Invalid checksum

Proposed solution

Uploading everything in the current directory is not really necessary - we only need to upload debug files for the recent build. The problem is that we don't have a sure way to know what was built (see #94). Instead, we can look for the build output files based on the path & name - we know they're named a certain way for each platform build and we can search the current directory recursively until we find the right structure and upload only what's necessary. If we can't locate the build according to the rules in the plugin, we can fall back to the current behaviour of uploading eveything.

Benefits

  • faster debug symbol uploads (unnecessary files are not uploaded)
  • less space occupied on Sentry
  • avoid potential issues with broken files

Problems

  • we may miss some of the debug files if the logic that locates them is incomplete

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions