DataDog / datadog-ci

Use Datadog from your CI.
https://datadoghq.com
Apache License 2.0
129 stars 55 forks source link

`flutter-symbols upload` doesn't support glob patterns for `android-mapping-location` #1413

Open feinstein opened 3 months ago

feinstein commented 3 months ago

Bug description

If I try to run

datadog-ci flutter-symbols upload \
  --service-name my_service \
  --android-mapping \
  --dart-symbols-location "$OBFUSCATION_OUTPUT_DIR" \
  --android-mapping-location build/**/outputs/**/mapping.txt \
  --version "$APP_VERSION+$APP_BUILD_NUMBER"

I get this error:

❌ Error: Could not locate Android Mapping file at build//outputs//mapping.txt.

But if I specify the full path for the mapping.txt it works fine.

I think the bug is in here: https://github.com/DataDog/datadog-ci/blob/master/src/commands/flutter-symbols/upload.ts#L512, and this code already imports glob, so it should be an easy fix.

Describe what you expected

I expected to be able to provide globs in the android mapping location, as it can change depending on the flavor or artifact type (apk or appbundle) we are building.

Steps to reproduce the issue

No response

Additional context

No response

Command

flutter-symbols

fuzzybinary commented 3 months ago

Hi @feinstein

The reason this is not supported is because it could result in resolving to multiple mapping files, which would not be valid. We could perform the glob lookup and warn you if you resolve to multiple mapping files, but that would be a feature request, not a bug.

Additionally, if you are uploading mapping files for different flavors under the same version, you must specify the flavor both to datadog-ci and during setup of Datadog in your Flutter app. Otherwise deobfuscation will not be able to determine the proper mapping file to use (and the second upload would be ignored).

Let me know if that makes sense and if you want to request that we still support globs in this way.

feinstein commented 3 months ago

Hi @fuzzybinary, yes I think it makes sense.

I think I declared the flavor in the app, but how do I do it in the CI?

fuzzybinary commented 3 months ago

For datadog-ci there's a parameter --flavor, which would be the same parameter you're specifying to flutter build (if that's how you're specifying flavor in the application at build time).