firebase/fastlane-plugin-firebase_app_distribution

Whitespaces are deleted from environment variable

alejandro-oria opened this issue ยท 2 comments

Issue Description

I have a variable declared in my .env files which is the following:

FIREBASE_DISTRIBUTION_GROUPS = "iOS Team"

Once I run one of my lanes I get an error when trying to distribute the release to the testers since the distribution group doesn't exist. The thing is that the whitespaces are deleted from the variable's value.
The desired value for the groups would be "iOS Team" (like it's declared in the .env files) instead of "iOSTeam".

Configuration
firebase_app_distribution(
      app: "[...]",
      googleservice_info_plist_path: "[...]/GoogleService-Info.plist",
      groups: ENV['FIREBASE_DISTRIBUTION_GROUPS'],
      release_notes: options[:release_notes],
      ipa_path: "./builds/[...].ipa",
      debug: true
    )
Complete verbose output
[13:44:01]: ---------------------------------------
[13:44:01]: --- Step: firebase_app_distribution ---
[13:44:01]: ---------------------------------------
[13:44:01]: Warning: Debug logging enabled. Output may include sensitive information.
[13:44:01]: Authenticating with FIREBASE_TOKEN environment variable
[13:44:01]: ๐Ÿ” Authenticated successfully.
[13:44:01]: โŒ› Uploading the IPA.
D, [2022-04-06T13:44:01.905910 #19909] DEBUG -- request: POST https://firebaseappdistribution.googleapis.com/upload/v1/projects/[...]
D, [2022-04-06T13:44:22.235495 #19909] DEBUG -- response: Status 200
D, [2022-04-06T13:44:22.235588 #19909] DEBUG -- response: {
  "name": "[...]"
}

D, [2022-04-06T13:44:22.235914 #19909] DEBUG -- request: GET https://firebaseappdistribution.googleapis.com/v1/projects/[...]
D, [2022-04-06T13:44:22.614706 #19909] DEBUG -- response: Status 200
D, [2022-04-06T13:44:22.614777 #19909] DEBUG -- response: {
  "name": "[...]",
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.firebase.appdistro.v1.UploadReleaseResponse",
    "result": "RELEASE_UNMODIFIED",
    "release": {
      "name": "[...]",
      "releaseNotes": {
        "text": "[...]"
      },
      "displayVersion": "[...]",
      "buildVersion": "[...]",
      "createTime": "2022-04-06T11:23:31.410189Z"
    }
  }
}

[13:44:22]: โœ… The same IPA was found in release [...]with no changes, skipping.
D, [2022-04-06T13:44:22.615344 #19909] DEBUG -- request: PATCH https://firebaseappdistribution.googleapis.com/v1/projects/[...]
D, [2022-04-06T13:44:23.541150 #19909] DEBUG -- response: Status 200
D, [2022-04-06T13:44:23.541237 #19909] DEBUG -- response: {
  "name": "[...]",
  "releaseNotes": {
    "text": "[...]"
  },
  "displayVersion": "[...]",
  "buildVersion": "[...]",
  "createTime": "2022-04-06T11:23:31.410189Z"
}

[13:44:23]: โœ… Posted release notes.
D, [2022-04-06T13:44:23.542361 #19909] DEBUG -- request: POST https://firebaseappdistribution.googleapis.com/v1/projects/[...]
D, [2022-04-06T13:44:24.419344 #19909] DEBUG -- response: Status 404
D, [2022-04-06T13:44:24.419417 #19909] DEBUG -- response: {
  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }
}

+------------------+----------------------------+
|                 Lane Context                  |
+------------------+----------------------------+
| ENVIRONMENT      | qa                         |
| DEFAULT_PLATFORM | ios                        |
| PLATFORM_NAME    | ios                        |
| LANE_NAME        | ios [...]                  |
+------------------+----------------------------+
[13:44:24]: Could not enable access for testers. Check that the groups exist and the tester emails are formatted correctly 
Emails:  
Groups: ["iOSTeam"]

+------+---------------------------+-------------+
|                fastlane summary                |
+------+---------------------------+-------------+
| Step | Action                    | Time (in s) |
+------+---------------------------+-------------+
| 1    | default_platform          | 0           |
| ๐Ÿ’ฅ   | firebase_app_distribution | 31          |
+------+---------------------------+-------------+

[13:44:24]: fastlane finished with errors

[!] Could not enable access for testers. Check that the groups exist and the tester emails are formatted correctly 
Emails:  
Groups: ["iOSTeam"]
Environment
Library Version
fastlane 2.205.1
fastlane-plugin-firebase_app_distribution 0.3.3

Thanks for raising this @alejandro-oria.

Note that you need to specify group "aliases" instead of group names when referencing groups.

If you navigate to the Firebase console and click on the testers & groups tab then click on that group.
The alias that must be used for CLI tools can be found next to the group name.

Aliases are automatically assigned. Spaces are replaced with dashes, all characters are converted to lowercase, and some characters are simply removed (e.g. quotes and parentheses). In case of collisions, numbers might be appended to ensure unique aliases. In your case the group named "iOS Team" will most likely have the alias "ios-team".

Please look up the alias for your group and use that instead of the group name. Doing that and see if that helps solve your issue.

Closing for now. We've updated the plugin to only trim leading and trailing white spaces in groups with #267 and improved the messaging around group aliases with #268. Feel free to re-open if you continue to experience issues with groups.