fastlane: [deliver] iOS screenshot uploader: wrong order

New Issue Checklist

Issue Description

If 10 screenshots are uploaded and the naming of the screenshots is [1…10], then the 10th screenshot will be ordered to the front and show up as first screenshot.

This issue has been reported before, but automatically closed instead of fixed: https://github.com/fastlane/fastlane/issues/14785

Command executed
Complete output when running fastlane, including the stack trace and command used

Environment

summary>🚫 fastlane environment 🚫

Stack

Key Value
OS 10.15.2
Ruby 2.6.4
Bundler? false
Git git version 2.21.0 (Apple Git-122)
Installation Source ~/.rbenv/versions/2.6.4/bin/fastlane
Host Mac OS X 10.15.2 (19C57)
Ruby Lib Dir ~/.rbenv/versions/2.6.4/lib
OpenSSL Version OpenSSL 1.0.2s 28 May 2019
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 11.0

System Locale

Error
No Locale with UTF8 found 🚫

fastlane files:

No Fastfile found

No Appfile found

fastlane gems

Gem Version Update-Status
fastlane 2.140.0 🚫 Update available

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-bugsnag 1.4.1 ✅ Up-To-Date
fastlane-plugin-badge 1.3.0 🚫 Update available
Loaded gems
Gem Version
did_you_mean 1.3.0
slack-notifier 2.3.2
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
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
excon 0.71.1
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.13.1
gh_inspector 1.1.3
mini_magick 4.9.5
multi_xml 0.6.0
rubyzip 1.3.0
security 0.1.3
xcpretty-travis-formatter 1.0.0
bundler 1.17.2
jwt 2.1.0
uber 0.1.0
declarative 0.0.10
declarative-option 0.1.0
representable 3.0.4
mini_mime 1.0.2
signet 0.12.0
googleauth 0.10.0
httpclient 2.8.3
google-api-client 0.36.4
nanaimo 0.2.6
colored2 3.1.2
claide 1.0.3
CFPropertyList 3.0.2
atomos 0.1.3
xcodeproj 1.14.0
unicode-display_width 1.6.0
plist 3.5.0
addressable 2.7.0
tty-screen 0.7.0
tty-cursor 0.7.0
tty-spinner 0.9.2
babosa 1.0.3
faraday 0.17.3
unf_ext 0.0.7.6
unf 0.1.4
domain_name 0.5.20190701
fastimage 2.1.7
json 2.3.0
dotenv 2.7.5
naturally 2.2.0
simctl 1.6.7
retriable 3.1.2
multi_json 1.14.1
memoist 0.16.2
os 1.0.1
digest-crc 0.4.1
google-cloud-env 1.3.0
google-cloud-core 1.4.1
google-cloud-storage 1.25.1
emoji_regex 1.0.1
forwardable 1.2.0
logger 1.3.0
stringio 0.0.2
ipaddr 1.2.2
openssl 2.1.2
ostruct 0.1.0
strscan 1.0.0
date 2.0.0
fileutils 1.1.0
etc 1.0.1
io-console 0.4.7
zlib 1.0.0
rexml 3.1.9
psych 3.1.0
mutex_m 0.1.0
xml-simple 1.1.5
git 1.5.0
fastlane-plugin-bugsnag 1.4.1
curb 0.9.10
badge 0.11.0
fastlane-plugin-badge 1.3.0

generated on: 2020-01-31

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 23 (14 by maintainers)

Most upvoted comments

Hey @EmDee I just opened a PR that fixes this issue, based on our discussions 😊 let me know if that works for you.

https://github.com/fastlane/fastlane/pull/18200

This is a good point! I have never thought of this…

@EmDee Can’t you deal with this issue by prefixing/suffixing starting from 0? (or you can use whatever works; e.g. alphabets )

irb(main):005:0> [*0…10].map {|x| “6.5_#{x}.jpg” }.sort => [“6.5_0.jpg”, “6.5_1.jpg”, “6.5_2.jpg”, “6.5_3.jpg”, “6.5_4.jpg”, “6.5_5.jpg”, “6.5_6.jpg”, “6.5_7.jpg”, “6.5_8.jpg”, “6.5_9.jpg”]

Since the limit is max “10” right now, this just works.

I know this is not human friendly nor what you want. However, for those reasons @rogerluan mentioned for the backwards compatibility, this is a fair workaround until the point where we can make breaking changes. No changes are required but you can easily fix the issue on your ends. It’s definitely worth documenting on its page though for people having the same issue.


cc: @aried3r JFYI: Uploads using multiple threads does break the order but deliver also re-order screenshots after uploading is done here. And this is where the origin issue causes app_screenshots.sort_by(&:file_name)😂

https://github.com/fastlane/fastlane/blob/e89cdcfb869ad0640438cc5f6ed261bb50887641/deliver/lib/deliver/upload_screenshots.rb#L233-L250

I’m considering working on this (no promises!), but I have a few questions. @janpio, in https://github.com/fastlane/fastlane/issues/14785#issuecomment-503469720 you mentioned that the order of uploads mattered, however uploads can be multithreaded, can an order even be guaranteed then? Or is Apple sorting the screenshots by filename on their side? I’m not sure which of the moving parts is responsible. I guess for single-threaded uploads, guarantees can be made.

See NUMBER_OF_THREADS in Deliver::UPLOAD_SCREENSHOTS.

https://github.com/fastlane/fastlane/blob/5e03f6aed7ab9abb620b67107146bc615ee3184d/deliver/lib/deliver/upload_screenshots.rb#L16

https://github.com/fastlane/fastlane/blob/5e03f6aed7ab9abb620b67107146bc615ee3184d/deliver/lib/deliver/upload_screenshots.rb#L118-L127

At work we use https://github.com/public-law/naturally for a similar problem, in case padding screenshots with a leading 0 is not an option.