fastlane / fastlane

🚀 The easiest way to automate building and releasing your iOS and Android apps
https://fastlane.tools
MIT License
39.67k stars 5.72k forks source link

[Regression] Updating TestFlight build `whats_new` results in NameError: `build_id' is a required parameter #14560

Closed jeffremer closed 5 years ago

jeffremer commented 5 years ago

New Issue Checklist

Issue Description

Spaceship::TestFlight::Build - NameError: `build_id' is a required parameter

When interacting with an instance of Spaceship::TestFlight::Build in our Fastfile and trying to update the build information with the whats_new parameter, or in fact calling almost any method on the build, it reports an error: NameError: `build_id' is a required parameter.

This looks most similar to #12110 which has since been closed. In that issue the original reporter was trying to interact with a build that was still processing, however our build is done processing and continues to report this error. I'm aware of #14521 and updating to version 2.120.0 solved the issue where we couldn't fetch the latest TestFlight build, but trying to interact with the build at all doesn't work.

Command executed

The relevant portion of our Fastfile looks like this…

app = Spaceship::Tunes::Application.find(BASE_BUNDLE_ID)
build = Spaceship::TestFlight::Build.latest(app_id: app.apple_id, platform: 'ios')
begin
  build.update_build_information!(whats_new: what_to_test)
  UI.success("Successfully set the changelog for build")
rescue => ex
  UI.user_error!("Could not set changelog: #{ex}")
end

Where BASE_BUNDLE_ID is our app's bundle ID and what_to_test is a helper function that simply formats a changelog.

Complete output when running fastlane, including the stack trace and command used
[12:02:56]: --------------------------------------------
[12:02:56]: --- Step: latest_testflight_build_number ---
[12:02:56]: --------------------------------------------
[12:02:56]: To not be asked about this value, you can specify it using 'username'
[12:02:56]: Your Apple ID Username: REDACTED
[12:03:16]: Login to App Store Connect (REDACTED)
[12:03:16]: Login successful
[12:03:18]: Fetching the latest build number for version 94.0.0
[12:03:19]: Latest upload for version 94.0.0 is build: 16408
[12:03:19]: ------------------------------
[12:03:19]: --- Step: get_build_number ---
[12:03:19]: ------------------------------
[12:03:19]: $ cd /Users/jeff/Strava/iPhone && agvtool what-version -terse
[12:03:20]: ▸ 16408
Cloning into '/tmp/i18n'...
remote: Enumerating objects: 855, done.
remote: Counting objects: 100% (855/855), done.
remote: Compressing objects: 100% (546/546), done.
remote: Total 855 (delta 259), reused 400 (delta 98), pack-reused 0
Receiving objects: 100% (855/855), 5.70 MiB | 4.85 MiB/s, done.
Resolving deltas: 100% (259/259), done.
[12:03:41]: --------------------------------
[12:03:41]: --- Step: get_version_number ---
[12:03:41]: --------------------------------
+--------------------------------+---------------------+
|                     Lane Context                     |
+--------------------------------+---------------------+
| DEFAULT_PLATFORM               | ios                 |
| PLATFORM_NAME                  | ios                 |
| LANE_NAME                      | ios distribute_beta |
| VERSION_NUMBER                 | 94.0.0              |
| LATEST_BUILD_NUMBER            | 16408               |
| LATEST_TESTFLIGHT_BUILD_NUMBER | 16408               |
| BUILD_NUMBER                   | 16408               |
+--------------------------------+---------------------+

+------+--------------------------------+-------------+
|                  fastlane summary                   |
+------+--------------------------------+-------------+
| Step | Action                         | Time (in s) |
+------+--------------------------------+-------------+
| 1    | opt_out_usage                  | 0           |
| 2    | Verifying fastlane version     | 0           |
| 3    | default_platform               | 0           |
| 4    | get_version_number             | 0           |
| 5    | latest_testflight_build_number | 22          |
| 6    | get_build_number               | 0           |
| 7    | get_version_number             | 0           |
+------+--------------------------------+-------------+

[12:03:42]: fastlane finished with errors

Looking for related GitHub issues on fastlane/fastlane...

➡️  [App Store Connect unification] Spaceship::UnexpectedResponse: [!] Apple provided the following error info: Access Unavailable - You currently don't have access to this membership resource
    https://github.com/fastlane/fastlane/issues/14228 [closed] 26 💬
    3 weeks ago

➡️  Could not set changelog: `build_id` is a required parameter
    https://github.com/fastlane/fastlane/issues/12110 [closed] 7 💬
    24 Jul 2018

➡️  'build_id' is a required parameter on download_dsyms process
    https://github.com/fastlane/fastlane/issues/11435 [closed] 12 💬
    22 Jun 2018

and 4 more at: https://github.com/fastlane/fastlane/search?q=%60build_id%27%20is%20a%20required%20parameter&type=Issues&utf8=✓

🔗  You can ⌘ + double-click on links to open them directly in your browser.
/Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/client.rb:342:in `block in assert_required_params': [!] `build_id' is a required parameter (NameError)
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/client.rb:340:in `each'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/client.rb:340:in `assert_required_params'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/client.rb:47:in `get_build'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/build.rb:105:in `find'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/build.rb:141:in `reload'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/build.rb:195:in `test_info'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/spaceship/lib/spaceship/test_flight/build.rb:212:in `update_build_information!'
    from Fastfile:209:in `block (2 levels) in parsing_binding'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/lane.rb:33:in `call'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/commands_generator.rb:333:in `run'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
    from /Users/jeff/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-2.120.0/bin/fastlane:23:in `'
    from /Users/jeff/.rbenv/versions/2.3.1/bin/fastlane:23:in `load'
    from /Users/jeff/.rbenv/versions/2.3.1/bin/fastlane:23:in `
'

Environment

✅ fastlane environment ✅ ### Stack | Key | Value | | --------------------------- | ------------------------------------------- | | OS | 10.14.4 | | Ruby | 2.3.1 | | Bundler? | false | | Git | git version 2.17.1 | | Installation Source | ~/.rbenv/versions/2.3.1/bin/fastlane | | Host | Mac OS X 10.14.4 (18E226) | | Ruby Lib Dir | ~/.rbenv/versions/2.3.1/lib | | OpenSSL Version | OpenSSL 1.0.2o 27 Mar 2018 | | Is contained | false | | Is homebrew | false | | Is installed via Fabric.app | false | | Xcode Path | /Applications/Xcode.app/Contents/Developer/ | | Xcode Version | 10.2 | ### System Locale | Variable | Value | | | -------- | ----------- | - | | LANG | en_US.UTF-8 | ✅ | | LC_ALL | | | | LANGUAGE | | | ### fastlane files: The Fastfile has been abbreviated to the relevant lane.
`./fastlane/Fastfile` ```ruby fastlane_require 'fileutils' fastlane_require 'spaceship' # Fastfile # # @author Jeff Remer # @copyright Strava, Inc. 2015 # # This is a Fastfile. We use it to define our Fastlane lanes. # Currently this is used to build nightlies automatically on # Boonen, our build machine and to build TestFlight betas # manually, on your own machine. This can be customized, but # unless you know what you are doing you should ask someone. # # Documentation on Fastfiles can be found here: # https://github.com/KrauseFx/fastlane/tree/master/docs # All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md # can also be listed using the `fastlane actions` command BASE_BUNDLE_ID= # REDACTED… default_platform :ios platform :ios do lane :distribute_beta do if latest_testflight_build_number(version: get_version_number(target: 'Strava')) != get_build_number.to_i UI.user_error!("Current build number doesn't match latest TestFlight build number") end app = Spaceship::Tunes::Application.find(BASE_BUNDLE_ID) build = Spaceship::TestFlight::Build.latest(app_id: app.apple_id, platform: 'ios') begin build.update_build_information!(whats_new: what_to_test) UI.success("Successfully set the changelog for build") rescue => ex UI.user_error!("Could not set changelog: #{ex}") end build.auto_notify_enabled = true # Expire any existing builds in reivew waiting_for_review_build = Spaceship::TestFlight::Build.all_waiting_for_review(app_id: build.app_id, platform: 'ios').first unless waiting_for_review_build.nil? UI.important("Another build is already in review. Going to expire that build and submit the new one.") UI.important("Expiring build: #{waiting_for_review_build.train_version} - #{waiting_for_review_build.build_version}") waiting_for_review_build.expire! UI.success("Expired previous build: #{waiting_for_review_build.train_version} - #{waiting_for_review_build.build_version}") end build.export_compliance.encryption_updated = false build.beta_review_info.demo_account_required = true begin build.submit_for_testflight_review! rescue => ex raise ex unless ex.to_s.include?('504') # Ignore spurious App Store Connect 504s UI.message("Submitting the build for review timed out, trying to recover.") build = Spaceship::TestFlight::Build.find(app_id: build.app_id, build_id: build.id) raise ex unless updated_build.approved? end external_testers = Spaceship::TestFlight::Group.default_external_group(app_id: build.app_id) build.add_group!(external_testers) unless external_testers.nil? end end def what_to_test "New in Strava…" end ```
`./fastlane/Appfile` ```ruby app_identifier REDACTED team_name "Strava" team_id REDACTED ```
### fastlane gems | Gem | Version | Update-Status | | -------- | ------- | ------------- | | fastlane | 2.120.0 | ✅ Up-To-Date | ### Loaded fastlane plugins: | Plugin | Version | Update-Status | | ----------------------- | ------- | ------------- | | fastlane-plugin-bugsnag | 1.4.1 | ✅ Up-To-Date |
Loaded gems | Gem | Version | | ------------------------- | ------------ | | did_you_mean | 1.0.0 | | slack-notifier | 2.3.2 | | atomos | 0.1.3 | | claide | 1.0.2 | | colored2 | 3.1.2 | | nanaimo | 0.2.6 | | xcodeproj | 1.8.1 | | rouge | 2.0.7 | | xcpretty | 0.3.0 | | terminal-notifier | 2.0.0 | | terminal-table | 1.8.0 | | multipart-post | 2.0.0 | | word_wrap | 1.0.0 | | public_suffix | 2.0.5 | | babosa | 1.0.2 | | colored | 1.2 | | highline | 1.7.10 | | commander-fastlane | 4.4.6 | | excon | 0.62.0 | | unf | 0.1.4 | | domain_name | 0.5.20180417 | | http-cookie | 1.0.3 | | faraday-cookie_jar | 0.0.6 | | gh_inspector | 1.1.3 | | mini_magick | 4.5.1 | | rubyzip | 1.2.2 | | security | 0.1.3 | | xcpretty-travis-formatter | 1.0.0 | | tty-cursor | 0.6.1 | | tty-spinner | 0.9.0 | | tty-screen | 0.6.5 | | faraday | 0.15.4 | | json | 2.2.0 | | io-console | 0.4.5 | | CFPropertyList | 3.0.0 | | mini_portile2 | 2.3.0 | | nokogiri | 1.8.4 | | plist | 3.5.0 | | google-cloud-env | 1.0.5 | | google-cloud-core | 1.3.0 | | uber | 0.1.0 | | declarative | 0.0.10 | | declarative-option | 0.1.0 | | representable | 3.0.4 | | signet | 0.11.0 | | httpclient | 2.8.3 | | google-api-client | 0.23.9 | | digest-crc | 0.4.1 | | google-cloud-storage | 1.16.0 | | memoist | 0.16.0 | | googleauth | 0.6.7 | | faraday_middleware | 0.13.1 | | fastimage | 2.1.5 | | bundler | 1.16.3 | | unicode-display_width | 1.5.0 | | addressable | 2.6.0 | | retriable | 3.1.2 | | mime-types | 3.2.2 | | mime-types-data | 3.2018.0812 | | multi_json | 1.13.1 | | jwt | 2.1.0 | | os | 1.0.0 | | psych | 2.0.17 | | xml-simple | 1.1.5 | | fastlane-plugin-bugsnag | 1.4.1 |
*generated on:* **2019-04-10**
janpio commented 5 years ago

Did this work before with the version of fastlane you were using, then suddenly not working any more (with the same version)? Or did this only break when updating to a newer fastlane version?

jeffremer commented 5 years ago

@janpio on version 2.118.1 our CI builds started recently failing because latest_testflight_build_number started reporting the version number as 1 when in fact it was 16408. I imagine this is due to #14521 - before that was reported it worked. So I tried updating to 2.120.0 and the CI build got a little further but I ran into this problem.

joshdholtz commented 5 years ago

@jeffremer Heyyyy 👋 Just as a heads up that Spaceship::TestFlight will be undergoing A LOT of changes soon 😊 Spaceship::TestFlight uses the old private APIs that are being sunset so we will be migrating over to the new official App Store Connect API.

What this means for fastlane is that Spaceship::TestFlight will be probably end up being mostly removed because it is not possible to retrofit the new App Store Connect API model relationships and architecture into how Spaceship::TestFlight was designed.

So during this process we were able to retrofit some of what the classes that were heavily used but its not great since we are missing some of the data. And I think that is what you are running into here.

In #14523, we did actually retrofit the response for Spaceship::TestFlight::Build.latest and it looks like some of the data that doesn't fit into the old model is actually causing this build_id error. build_id doesn't exist anymore in the way it used to so we might need to put even more of a crutch in this for now 😬 So I can take a look at that

BUT, I am working on a prototype right now that will essentially but what you are looking are doing with Spaceship::TestFlight::Build but instead it will be for Spaceship::ConnectAPI::Build. I'm hoping I can get this done in real soon because I would like to transfer off of the private APIs and onto the official App Store Connect APIs.

That being said, I can try to put together a setup like you have to that we can keep your flow working in the mean time 😬

jeffremer commented 5 years ago

Thanks for the update @joshdholtz - anything to keep us going in the meantime would be much appreciated. 👍

fastlane-bot commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

jeffremer commented 5 years ago

@fastlane-bot this hasn't been resolved.

jeffremer commented 5 years ago

BUT, I am working on a prototype right now that will essentially but what you are looking are doing with Spaceship::TestFlight::Build but instead it will be for Spaceship::ConnectAPI::Build. I'm hoping I can get this done in real soon because I would like to transfer off of the private APIs and onto the official App Store Connect APIs.

@joshdholtz any update on this? 🙏

jeffremer commented 5 years ago

Not sure if it's helpful at all, but it's not just the build information whats_new. Setting the export_compliance and beta_review_info info also fails with the same error.

jmad8 commented 5 years ago

Still a problem for me

geraldeersteling commented 5 years ago

Any updates on this? It's still asking for a non-existing param...

Katsz commented 5 years ago

This is still not fixed in 2.126.0

irb(main):057:0> require "spaceship"
irb(main):058:0> Spaceship::Tunes.login(username)
irb(main):059:0> Spaceship::Tunes.select_team(team_id: itc_team_id)
irb(main):060:0> app = Spaceship::Tunes::Application.find(bundle_identifier)
irb(main):061:0> conf.echo = true
=> true
irb(main):062:0> app.builds
Traceback (most recent call last):
       14: from <redacted>/irb:23:in `<main>'
       13: from <redacted>/irb:23:in `load'
       12: from <redacted>/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
       11: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/base.rb:286:in `inspect'
       10: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/base.rb:296:in `inspect_value'
        9: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/base.rb:296:in `map'
        8: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/base.rb:297:in `block in inspect_value'
        7: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/test_flight/build.rb:183:in `beta_review_info'
        6: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/test_flight/build.rb:141:in `reload'
        5: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/test_flight/build.rb:105:in `find'
        4: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/test_flight/client.rb:47:in `get_build'
        3: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/test_flight/client.rb:340:in `assert_required_params'
        2: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/test_flight/client.rb:340:in `each'
        1: from <redacted>/ruby/gems/2.6.0/gems/fastlane-2.126.0/spaceship/lib/spaceship/test_flight/client.rb:342:in `block in assert_required_params'
NameError (`build_id' is a required parameter)

On top of that client requesting /providers (plural), but api was moved(?) to /provider image

fastlane-bot commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

Friendly reminder: contributions are always welcome! Check out CONTRIBUTING.md for more information on how to help with fastlane and feel free to tackle this issue yourself :muscle:

fastlane-bot commented 5 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

fastlane-bot commented 5 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1: