fastlane: latest_testflight_build_number returns random data

New Regression Checklist

Regression Information

  • Breaking version: 2.120.0
  • Last working version: 2.119.0

Regression Description

Running the latest_testflight_build_number action returns random data when no version is passed in. It used to return the latest build number from the latest version.

Complete output when running fastlane, including the stack trace and command used
$ bundle exec fastlane run latest_testflight_build_number
[✔] 🚀
+------------------------------------------------+---------+------------------------------------------------------------+
|                                                     Used plugins                                                      |
+------------------------------------------------+---------+------------------------------------------------------------+
| Plugin                                         | Version | Action                                                     |
+------------------------------------------------+---------+------------------------------------------------------------+
| fastlane-plugin-appconfig                      | 0.3.0   | push_config pull_config                                    |
| fastlane-plugin-setup_fragile_tests_for_rescan | 2.1.1   | setup_fragile_tests_for_rescan                             |
| fastlane-plugin-test_center                    | 3.6.3   | suppressed_tests suppress_tests suppress_tests_from_junit  |
|                                                |         | tests_from_xctestrun collate_test_result_bundles           |
|                                                |         | tests_from_junit multi_scan collate_html_reports           |
|                                                |         | collate_junit_reports collate_json_reports                 |
+------------------------------------------------+---------+------------------------------------------------------------+

10:13:03: — Step: latest_testflight_build_number — 10:13:03: -------------------------------------------- 10:13:03: Login to App Store Connect (ios@email.com) Available session is not valid any more. Continuing with normal login. [10:13:08]: Login successful [10:13:10]: Fetching the latest build number for version 10.0.0 // this version doesn’t exist in our portal [10:13:12]: Latest upload for version 10.0.0 is build: 4 // we’re at build number 160+, no idea where this 4 comes from [10:13:12]: Result: 4

Environment

✅ fastlane environment ✅

Stack

Key Value
OS 10.14.4
Ruby 2.6.2
Bundler? true
Git git version 2.20.1 (Apple Git-117)
Installation Source ~/.rbenv/versions/2.6.2/bin/fastlane
Host Mac OS X 10.14.4 (18E226)
Ruby Lib Dir ~/.rbenv/versions/2.6.2/lib
OpenSSL Version OpenSSL 1.0.2r 26 Feb 2019
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_CA.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
default_platform :ios
fastlane_version '2.120.0'

fastlane_require 'json'

platform :ios do

  # --------------------------------------------------
  # Set Up & Tear Down
  # --------------------------------------------------

  before_all do |lane, options|
  end

  after_all do |lane, options|
  end

  # --------------------------------------------------
  # Lanes
  # --------------------------------------------------

  import 'utils/shared_utils.rb'
  import 'lanes/assemble.rb'
  import 'lanes/build.rb'
  import 'lanes/bump.rb'
  import 'lanes/config.rb'
  import 'lanes/coverage.rb'
  import 'lanes/install.rb'
  import 'lanes/metadata.rb'
  import 'lanes/mock.rb'
  import 'lanes/release.rb'
  import 'lanes/sauce.rb'
  import 'lanes/symbols.rb'
  import 'lanes/testflight.rb'
  import 'lanes/tests.rb'

  # --------------------------------------------------
  # Error Handling
  # --------------------------------------------------

  error do |lane, exception, options|
  end

end

`./fastlane/Appfile`
app_identifier "[REDACTED]"
apple_id "[REDACTED]"
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-appconfig 0.3.0 💥 Check failed
fastlane-plugin-setup_fragile_tests_for_rescan 2.1.1 ✅ Up-To-Date
fastlane-plugin-test_center 3.6.3 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.3.0
bundler 1.17.3
etc 1.0.1
forwardable 1.2.0
fileutils 1.1.0
CFPropertyList 3.0.0
concurrent-ruby 1.1.5
i18n 0.9.5
minitest 5.11.3
thread_safe 0.3.6
tzinfo 1.2.5
activesupport 4.2.11.1
public_suffix 2.0.5
addressable 2.6.0
atomos 0.1.3
babosa 1.0.2
claide 1.0.2
clamp 1.3.0
fuzzy_match 2.0.4
nap 1.1.0
cocoapods-core 1.6.1
cocoapods-deintegrate 1.0.4
cocoapods-downloader 1.2.2
cocoapods-plugins 1.0.0
cocoapods-search 1.0.0
cocoapods-stats 1.1.0
netrc 0.11.0
cocoapods-trunk 1.3.1
cocoapods-try 1.1.0
colored2 3.1.2
escape 0.0.4
fourflusher 2.2.0
gh_inspector 1.1.3
molinillo 0.6.6
ruby-macho 1.4.0
nanaimo 0.2.6
xcodeproj 1.8.2
cocoapods 1.6.1
colored 1.2
colorize 0.8.1
highline 1.7.10
commander-fastlane 4.4.6
declarative 0.0.10
declarative-option 0.1.0
digest-crc 0.4.1
unf_ext 0.0.7.5
unf 0.1.4
domain_name 0.5.20180417
dotenv 2.7.2
emoji_regex 1.0.1
excon 0.64.0
multipart-post 2.0.0
faraday 0.15.4
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.13.1
fastimage 2.1.5
jwt 2.1.0
memoist 0.16.0
multi_json 1.13.1
os 1.0.0
signet 0.11.0
googleauth 0.6.7
httpclient 2.8.3
mime-types-data 3.2019.0331
mime-types 3.2.2
uber 0.1.0
representable 3.0.4
retriable 3.1.2
google-api-client 0.23.9
google-cloud-env 1.0.5
google-cloud-core 1.3.0
google-cloud-storage 1.16.0
json 2.2.0
mini_magick 4.5.1
multi_xml 0.6.0
plist 3.5.0
rubyzip 1.2.2
security 0.1.3
naturally 2.2.0
simctl 1.6.5
slack-notifier 2.3.2
terminal-notifier 2.0.0
unicode-display_width 1.5.0
terminal-table 1.8.0
tty-screen 0.6.5
tty-cursor 0.6.1
tty-spinner 0.9.0
word_wrap 1.0.0
rouge 2.0.7
xcpretty 0.3.0
xcpretty-travis-formatter 1.0.0
git 1.5.0
fastlane-plugin-appconfig 0.3.0
fastlane-plugin-setup_fragile_tests_for_rescan 2.1.1
xctest_list 1.1.7
fastlane-plugin-test_center 3.6.3
mini_portile2 2.4.0
nokogiri 1.10.2
slather 2.4.7

generated on: 2019-04-16

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 26 (16 by maintainers)

Most upvoted comments

@janpio I did the changes and I have raised a PR for this.

#14683

@ramnac Seems like the same PR i made for the exact same issue: https://github.com/fastlane/fastlane/pull/14670 vs https://github.com/fastlane/fastlane/pull/14683

But I see you also included a check for whether Spaceship::Tunes::Application.find() actually returns something. I’ll close my PR in favor of yours

@janpio @ramnac same issue:

Gemfile.lock:

GIT
  remote: https://github.com/ramnac/fastlane
  revision: e01c136f71b04512105d4458e2c94c08602055bd
  branch: master

output:

$ bundle exec fastlane run latest_testflight_build_number
[✔] 🚀
+------------------------------------------------+---------+------------------------------------------------------------+
|                                                     Used plugins                                                      |
+------------------------------------------------+---------+------------------------------------------------------------+
| Plugin                                         | Version | Action                                                     |
+------------------------------------------------+---------+------------------------------------------------------------+
| fastlane-plugin-appconfig                      | 0.3.0   | push_config pull_config                                    |
| fastlane-plugin-setup_fragile_tests_for_rescan | 2.1.1   | setup_fragile_tests_for_rescan                             |
| fastlane-plugin-test_center                    | 3.6.3   | suppressed_tests suppress_tests suppress_tests_from_junit  |
|                                                |         | tests_from_xctestrun collate_test_result_bundles           |
|                                                |         | tests_from_junit multi_scan collate_html_reports           |
|                                                |         | collate_junit_reports collate_json_reports                 |
+------------------------------------------------+---------+------------------------------------------------------------+

[08:01:45]: --------------------------------------------
[08:01:45]: --- Step: latest_testflight_build_number ---
[08:01:45]: --------------------------------------------
[08:01:45]: Login to App Store Connect ([REDACTED]@[REDACTED].com)
Available session is not valid any more. Continuing with normal login.
[08:01:48]: Login successful
[08:01:49]: Fetching the latest build number for version 10.0.0
[08:01:51]: Latest upload for version 10.0.0 is build: 4
[08:01:51]: Result: 4

Hi,

I’m currently trying to debug some issues & fallout after the API removal by Apple. The results you get from the preReleaseVersions endpoint is due to the sorting of the returned versions sort: "-versions". This I’m fairly sure is the best way to handle defaults. When using latest_testflight_build_number it defaults to the highest version submitted, you can override that by using latest_testflight_build_number(version: "3.4.0") to get the latest build number for a specific version on AppStore Connect.

BTW: You should be able to see all the previous versions here: https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/<AppID>/activity/ios/builds

However, there are some inconsistencies further down the line here: the call to get_builds defaults to searching for the latest uploaded build for the given version, and NOT the highest build_number (version) that’s uploaded. https://github.com/fastlane/fastlane/blame/be55c12077fe91f4eecb64e8ee3a3fa4b8085048/fastlane/lib/fastlane/actions/app_store_build_number.rb#L52

I’m guessing this might be a slight of thought while writing that part, as you might end up in a constantly failing upload if you base your uploaded build_number on that. In our case, we had never uploaded build 0 or 1, and with the issues the last weeks ended up with uploading build_number 1, however, since that’s the first response when sorting by "-uploadedDate" the next upload may never get uploaded as version 2 (build_number) is already uploaded.

I’ll open a separate issue for this, but it might be useful to be aware of.

I ran bundle exec fastlane run spaceship_logs:

# Logfile created on 2019-04-24 08:17:19 -0700 by logger.rb/66358
INFO  [08:17:19]: >> GET preReleaseVersions: [undefined body] 
DEBUG [08:17:19]: << GET preReleaseVersions: 200 {"data"=>[{"type"=>"preReleaseVersions", "id"=>"69b6213c-a2ca-111b-e053-5b8c7c11c0fe", "attributes"=>{"version"=>"10.0.0", "platform"=>"IOS"}, "relationships"=>{"builds"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/preReleaseVersions/69b6213c-a2ca-111b-e053-5b8c7c11c0fe/relationships/builds", "related"=>"https://appstoreconnect.apple.com/iris/v1/preReleaseVersions/69b6213c-a2ca-111b-e053-5b8c7c11c0fe/builds"}}, "app"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/preReleaseVersions/69b6213c-a2ca-111b-e053-5b8c7c11c0fe/relationships/app", "related"=>"https://appstoreconnect.apple.com/iris/v1/preReleaseVersions/69b6213c-a2ca-111b-e053-5b8c7c11c0fe/app"}}}, "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/preReleaseVersions/69b6213c-a2ca-111b-e053-5b8c7c11c0fe"}}], "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/preReleaseVersions?limit=1&sort=-version&filter%5Bapp%5D=1161533637", "next"=>"https://appstoreconnect.apple.com/iris/v1/preReleaseVersions?cursor=AQ.a-II-Q&limit=1&sort=-version&filter%5Bapp%5D=1161533637"}, "meta"=>{"paging"=>{"total"=>98, "limit"=>1}}}
INFO  [08:17:19]: >> GET builds: [undefined body] 
DEBUG [08:17:20]: << GET builds: 200 {"data"=>[{"type"=>"builds", "id"=>"69ae25a2-477c-fce9-e053-5b8c7c111149", "attributes"=>{"version"=>"4", "uploadedDate"=>"2017-10-11T14:03:31-07:00", "expirationDate"=>"2018-01-09T14:03:31-08:00", "expired"=>true, "minOsVersion"=>"9.0", "iconAssetToken"=>{"width"=>120, "templateUrl"=>"https://is2-ssl.mzstatic.com/image/thumb/Newsstand128/v4/a0/ca/8a/a0ca8af4-20c9-1ea5-1a3e-f65e07dcf5b8/Icon-60@2x.png.png/{w}x{h}bb.{f}", "height"=>120}, "processingState"=>"VALID", "usesNonExemptEncryption"=>false, "qcState"=>"BETA_INTERNAL_TESTING"}, "relationships"=>{"preReleaseVersion"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/preReleaseVersion", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/preReleaseVersion"}}, "individualTesters"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/individualTesters", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/individualTesters"}}, "betaBuildMetrics"=>{"meta"=>{"paging"=>{"total"=>1, "limit"=>10}}, "data"=>[{"type"=>"betaBuildMetrics", "id"=>"69ae25a2-477c-fce9-e053-5b8c7c111149"}], "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/betaBuildMetrics", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/betaBuildMetrics"}}, "betaGroups"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/betaGroups", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/betaGroups"}}, "betaBuildLocalizations"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/betaBuildLocalizations", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/betaBuildLocalizations"}}, "appEncryptionDeclaration"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/appEncryptionDeclaration", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/appEncryptionDeclaration"}}, "betaAppReviewSubmission"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/betaAppReviewSubmission", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/betaAppReviewSubmission"}}, "app"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/app", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/app"}}, "buildBetaDetail"=>{"data"=>{"type"=>"buildBetaDetails", "id"=>"69ae25a2-477c-fce9-e053-5b8c7c111149"}, "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/buildBetaDetail", "related"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149/buildBetaDetail"}}}, "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds/69ae25a2-477c-fce9-e053-5b8c7c111149"}}], "included"=>[{"type"=>"betaBuildMetrics", "id"=>"69ae25a2-477c-fce9-e053-5b8c7c111149", "attributes"=>{"installCount"=>0, "crashCount"=>0, "inviteCount"=>0, "sevenDayTesterCount"=>0}, "relationships"=>{"build"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/betaBuildMetrics/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/build", "related"=>"https://appstoreconnect.apple.com/iris/v1/betaBuildMetrics/69ae25a2-477c-fce9-e053-5b8c7c111149/build"}}, "betaGroup"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/betaBuildMetrics/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/betaGroup", "related"=>"https://appstoreconnect.apple.com/iris/v1/betaBuildMetrics/69ae25a2-477c-fce9-e053-5b8c7c111149/betaGroup"}}}, "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/betaBuildMetrics/69ae25a2-477c-fce9-e053-5b8c7c111149"}}, {"type"=>"buildBetaDetails", "id"=>"69ae25a2-477c-fce9-e053-5b8c7c111149", "attributes"=>{"autoNotifyEnabled"=>true, "didNotify"=>false, "internalBuildState"=>"EXPIRED", "externalBuildState"=>"EXPIRED"}, "relationships"=>{"build"=>{"links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/buildBetaDetails/69ae25a2-477c-fce9-e053-5b8c7c111149/relationships/build", "related"=>"https://appstoreconnect.apple.com/iris/v1/buildBetaDetails/69ae25a2-477c-fce9-e053-5b8c7c111149/build"}}}, "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/buildBetaDetails/69ae25a2-477c-fce9-e053-5b8c7c111149"}}], "links"=>{"self"=>"https://appstoreconnect.apple.com/iris/v1/builds?include=betaBuildMetrics%2CbuildBetaDetail&filter%5BpreReleaseVersion%5D=69b6213c-a2ca-111b-e053-5b8c7c11c0fe&limit=1&sort=-uploadedDate&filter%5Bapp%5D=1161533637", "next"=>"https://appstoreconnect.apple.com/iris/v1/builds?cursor=AQ.GXQEGw&include=betaBuildMetrics%2CbuildBetaDetail&filter%5BpreReleaseVersion%5D=69b6213c-a2ca-111b-e053-5b8c7c11c0fe&limit=1&sort=-uploadedDate&filter%5Bapp%5D=1161533637"}, "meta"=>{"paging"=>{"total"=>2, "limit"=>1}}}

@janpio negative, still getting the same behaviour with fastlane 2.121.0:

$ bundle exec fastlane run latest_testflight_build_number
[✔] 🚀
+------------------------------------------------+---------+------------------------------------------------------------+
|                                                     Used plugins                                                      |
+------------------------------------------------+---------+------------------------------------------------------------+
| Plugin                                         | Version | Action                                                     |
+------------------------------------------------+---------+------------------------------------------------------------+
| fastlane-plugin-appconfig                      | 0.3.0   | push_config pull_config                                    |
| fastlane-plugin-setup_fragile_tests_for_rescan | 2.1.1   | setup_fragile_tests_for_rescan                             |
| fastlane-plugin-test_center                    | 3.6.3   | suppressed_tests suppress_tests suppress_tests_from_junit  |
|                                                |         | tests_from_xctestrun collate_test_result_bundles           |
|                                                |         | tests_from_junit multi_scan collate_html_reports           |
|                                                |         | collate_junit_reports collate_json_reports                 |
+------------------------------------------------+---------+------------------------------------------------------------+

[08:17:14]: --------------------------------------------
[08:17:14]: --- Step: latest_testflight_build_number ---
[08:17:14]: --------------------------------------------
[08:17:14]: Login to App Store Connect ([REDACTED]@[REDACTED].com)
Available session is not valid any more. Continuing with normal login.
[08:17:18]: Login successful
[08:17:19]: Fetching the latest build number for version 10.0.0
[08:17:20]: Latest upload for version 10.0.0 is build: 4
[08:17:20]: Result: 4