Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App version and build number arguments no working with upload_to_testflight #20986

Open
4 tasks done
tyler-jewell opened this issue Jan 10, 2023 · 1 comment
Open
4 tasks done

Comments

@tyler-jewell
Copy link

New Issue Checklist

Issue Description

When I supply app_version and build_number to upload_to_testflight action, it uses the latest(+1) build number and my latest version number on Apple Store Connect.

Command executed
fastlane run upload_to_testflight app_version:"0.0.2" build_number:"10" api_key_path:"./fastlane/AuthKey_[API_ID].json"
Complete output when running fastlane, including the stack trace and command used
tylerjewell@Tylers-Mac-mini ios % fastlane run upload_to_testflight app_version:"0.0.2" build_number:"10" api_key_path:"./fastlane/AuthKey_[App ID].json"          
[✔] 🚀 
[12:55:12]: fastlane detected a Gemfile in the current directory
[12:55:12]: However, it seems like you didn't use `bundle exec`
[12:55:12]: To launch fastlane faster, please use
[12:55:12]: 
[12:55:12]: $ bundle exec fastlane run upload_to_testflight app_version:0.0.2 build_number:10 api_key_path:./fastlane/AuthKey_[App ID]json
[12:55:12]: 
[12:55:12]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[12:55:13]: ----------------------------------
[12:55:13]: --- Step: upload_to_testflight ---
[12:55:13]: ----------------------------------
[12:55:13]: Creating authorization token for App Store Connect API
[12:55:13]: Ready to upload new build to TestFlight (App: 1663937464)...
[12:55:14]: Going to upload updated app to App Store Connect
[12:55:14]: This might take a few minutes. Please don't interrupt the script.
[12:55:19]: [altool] 2023-01-10 12:55:19.536 *** Error: The provided entity includes an attribute with a value that has already been used The bundle version must be higher than the previously uploaded version: ‘8’. (ID: 5a262fb3-af79-4eb2-8b0e-21685ad45ad9) (-19232)

[12:55:19]: [altool]  {

[12:55:19]: [altool]     NSLocalizedDescription = "The provided entity includes an attribute with a value that has already been used";

[12:55:19]: [altool]     NSLocalizedFailureReason = "The bundle version must be higher than the previously uploaded version: \U20188\U2019. (ID: 5a262fb3-af79-4eb2-8b0e-21685ad45ad9)";

[12:55:19]: [altool]     "original_server_error" =     {

[12:55:19]: [altool]         code = "ENTITY_ERROR.ATTRIBUTE.INVALID.DUPLICATE";

[12:55:19]: [altool]         detail = "The bundle version must be higher than the previously uploaded version.";

[12:55:19]: [altool]         id = "5a262fb3-af79-4eb2-8b0e-21685ad45ad9";

[12:55:19]: [altool]         meta =         {

[12:55:19]: [altool]             previousBundleVersion = 8;

[12:55:19]: [altool]         };

[12:55:19]: [altool]         source =         {

[12:55:19]: [altool]             pointer = "/data/attributes/cfBundleVersion";

[12:55:19]: [altool]         };

[12:55:19]: [altool]         status = 409;

[12:55:19]: [altool]         title = "The provided entity includes an attribute with a value that has already been used";

[12:55:19]: [altool]     };

[12:55:19]: [altool]     previousBundleVersion = 8;

[12:55:19]: [altool] }

[12:55:19]: Application Loader output above ^
[12:55:19]: Error uploading '/var/folders/mq/wj6_0mcx2sl7x4skq7cx8nh00000gn/T/6813f32d-bf2c-4467-847d-a395fc8614aa.ipa'.
[12:55:19]: The provided entity includes an attribute with a value that has already been used The bundle version must be higher than the previously uploaded version: ‘8’. (ID: 5a262fb3-af79-4eb2-8b0e-21685ad45ad9) (-19232)
[12:55:19]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.
[12:55:19]: Could not download/upload from App Store Connect!

[!] Error uploading ipa file: 
 [Application Loader Error Output]: Error uploading '/var/folders/mq/wj6_0mcx2sl7x4skq7cx8nh00000gn/T/6813f32d-bf2c-4467-847d-a395fc8614aa.ipa'.
[Application Loader Error Output]: The provided entity includes an attribute with a value that has already been used The bundle version must be higher than the previously uploaded version: ‘8’. (ID: 5a262fb3-af79-4eb2-8b0e-21685ad45ad9) (-19232)
[Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.

--capture-output

DEBUG [2023-01-10 12:56:34.72]: Checking if there are any plugins that should be loaded...
DEBUG [2023-01-10 12:56:34.86]: Using app_version: 0.0.2
DEBUG [2023-01-10 12:56:34.87]: Using build_number: 10
DEBUG [2023-01-10 12:56:34.87]: Using api_key_path: ./fastlane/AuthKey_[App ID].json

Environment

✅ fastlane environment ✅

Stack

Key Value
OS 13.1
Ruby 3.1.3
Bundler? false
Git git version 2.39.0
Installation Source /opt/homebrew/Cellar/fastlane/2.211.0/libexec/bin/fastlane
Host macOS 13.1 (22C65)
Ruby Lib Dir /opt/homebrew/Cellar/ruby/3.1.3/lib
OpenSSL Version OpenSSL 1.1.1s 1 Nov 2022
Is contained false
Is homebrew true
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 14.2
Swift Version 5.7.2

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# update_fastlane

# default_platform(:ios)

# platform :ios do
#   desc "Build and sign iOS app"
#   lane :release do

#     # delete_keychain

#     # create_keychain
    
#     app_store_connect_api_key

#     match(type: "appstore", readonly: is_ci)

#     # build_app

#     # upload_to_testflight(build_number: "10", app_version:"0.0.2")

#   end
# end




platform :ios do
  
  desc "Get certificates"
  lane :certificates do
    sync_code_signing(
      type: "development",
      app_identifier: ['com.mezops.mezopsApp'],
      force_for_new_devices: true,
      readonly: true
    )

    sync_code_signing(
      type: "appstore",
      app_identifier: 'com.mezops.mezopsApp',
      readonly: true
    )
  end

  desc "Generate new certificates"
  lane :generate_new_certificates do
    sync_code_signing(
      type: "development",
      app_identifier: ['com.mezops.mezopsApp'],
      force_for_new_devices: true,
      readonly: false
    )
  end

  desc "deploy"
  lane :deploy do
    ENV["MATCH_GIT_BASIC_AUTHORIZATION"]="TWV6LU9wczpnaXRodWJfcGF0XzExQVJMMzVSWTBmaXFhd1V4TkJac3lfNmJYWFFpTERVM3dtZ0Uxc3JVSHcxU2VzMjduaWJkYXlqcVNVVGxidVhMQldMSE5OQUdKZVdJTTRrYVg="
    ENV["MATCH_PASSWORD"]="cardsrule"
    ENV["MATCH_KEYCHAIN_PASSWORD"]="cardsrule"
    ENV["APP_STORE_CONNECT_API_KEY_KEY_ID"]="LPWBBK5UAB"
    ENV["APP_STORE_CONNECT_API_KEY_ISSUER_ID"]="0c94f797-97db-45b1-8343-81e57c09dd50"
    ENV["APP_STORE_CONNECT_API_KEY_KEY"]="LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR1RBZ0VBTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEJIa3dkd0lCQVFRZ2sxdlZpM1NJMDJZdW9kd2sKYnBqUzlXODlSQjFqQUJJVm5mNFIwNFo5SWJpZ0NnWUlLb1pJemowREFRZWhSQU5DQUFTVlNmaVNWTlNVRlQ3SgplQXkrWWt2aXlYamw2b2dFQWRnKzhLK01VWEtoOTk1RTFLOGtTWnIvVmNqcFF5N2pqN3pyOUJ2enlYOXM2bVozCllFbjg0SkpHCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0="


    setup_ci
    
    sync_code_signing(
      type: "appstore",
      app_identifier: 'com.mezops.mezopsApp',
      readonly: true
    )

    build_app(scheme: "Runner")
    
    app_store_connect_api_key(is_key_content_base64: true)

    upload_to_testflight(app_version: "0.0.2", build_number: "10")
  end
end
`./fastlane/Appfile`
app_identifier("com.mezops.mezopsApp") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple Developer Portal username


# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.211.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
error_highlight 0.3.0
did_you_mean 1.6.1
atomos 0.1.3
rexml 3.2.5
CFPropertyList 3.0.5
claide 1.1.0
colored2 3.1.2
nanaimo 0.3.0
xcodeproj 1.22.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
unicode-display_width 1.8.0
terminal-table 1.8.0
plist 3.6.0
addressable 2.8.1
multipart-post 2.0.0
word_wrap 1.0.0
optparse 0.1.1
tty-screen 0.8.1
tty-cursor 0.7.1
tty-spinner 0.9.3
artifactory 3.0.15
babosa 1.0.4
colored 1.2
highline 2.0.3
commander 4.6.0
faraday-em_http 1.0.0
faraday-em_synchrony 1.0.0
faraday-excon 1.1.0
faraday-httpclient 1.0.1
faraday-multipart 1.0.4
faraday-net_http 1.0.1
faraday-net_http_persistent 1.2.0
faraday-patron 1.0.0
faraday-rack 1.0.0
faraday-retry 1.0.3
ruby2_keywords 0.0.5
faraday 1.10.2
unf_ext 0.0.8.2
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.5
faraday-cookie_jar 0.0.7
faraday_middleware 1.2.0
fastimage 2.2.6
gh_inspector 1.1.3
naturally 2.2.1
rubyzip 2.3.2
security 0.1.3
xcpretty-travis-formatter 1.0.1
dotenv 2.8.1
bundler 2.3.26
simctl 1.6.8
google-apis-playcustomapp_v1 0.12.0
google-cloud-env 1.6.0
google-cloud-errors 1.3.0
google-cloud-core 1.6.0
google-apis-iamcredentials_v1 0.16.0
google-apis-storage_v1 0.19.0
memoist 0.16.2
multi_json 1.15.0
os 1.1.4
signet 0.17.0
googleauth 1.3.0
rake 13.0.6
digest-crc 0.6.4
mini_mime 1.1.2
google-cloud-storage 1.44.0
emoji_regex 3.2.3
set 1.0.2
public_suffix 5.0.1
excon 0.97.0
json 2.6.3
mini_magick 4.12.0
jwt 2.6.0
webrick 1.7.0
httpclient 2.8.3
retriable 3.1.2
trailblazer-option 0.1.2
declarative 0.0.20
uber 0.1.0
representable 3.2.0
google-apis-core 0.9.4
google-apis-androidpublisher_v3 0.32.0
aws-eventstream 1.2.0
aws-sigv4 1.5.2
aws-partitions 1.689.0
jmespath 1.6.2
aws-sdk-core 3.168.4
aws-sdk-kms 1.61.0
aws-sdk-s3 1.117.2
forwardable 1.3.2
logger 1.5.0
pathname 0.2.0
shellwords 0.1.0
cgi 0.3.5
date 3.2.2
timeout 0.2.0
stringio 3.0.1
securerandom 0.2.0
uri 0.11.0
openssl 3.0.1
digest 3.1.0
io-nonblock 0.1.0
ipaddr 1.2.4
io-wait 0.2.1
zlib 2.1.1
resolv 0.2.1
time 0.2.0
open-uri 0.2.0
mutex_m 0.1.1
net-http 0.3.0
net-protocol 0.1.2
ostruct 0.5.2
english 0.7.1
erb 2.2.3
strscan 3.0.1
abbrev 0.1.0
io-console 0.5.11
tempfile 0.1.2
delegate 0.2.0
fileutils 1.6.0
tmpdir 0.1.2
base64 0.1.1
singleton 0.1.1
open3 0.1.1
nkf 0.1.1
prettyprint 0.1.1
pp 0.3.0
find 0.1.1
yaml 0.2.0
psych 4.0.4

generated on: 2023-01-10

@leefaus
Copy link

leefaus commented Jan 12, 2023

I had this same issue. Here is what my code looked like:

  lane :build do
    # add actions here: https://docs.fastlane.tools/actions
    # app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
    setup_ci
    match(type: 'appstore', readonly: is_ci)
    # sync_code_signing(type: "Appstore")

    build_app(
      scheme: "File Editor",
      clean: true,
      output_directory: 'fastlane_builds/'
    )

    increment_build_number(
      build_number: latest_testflight_build_number + 1,
      xcodeproj: "File\ Editor.xcodeproj"
    )
    
    upload_to_testflight
  end

When I moved the increment_build_number block up above the build, everything was ok.

  lane :build do
    # add actions here: https://docs.fastlane.tools/actions
    # app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
    setup_ci
    match(type: 'appstore', readonly: is_ci)
    # sync_code_signing(type: "appstore")
    increment_build_number(
      build_number: latest_testflight_build_number + 1,
      xcodeproj: "File\ Editor.xcodeproj"
    )

    build_app(
      scheme: "File Editor",
      clean: true,
      output_directory: 'fastlane_builds/'
    )
    
    upload_to_testflight
  end

Here is a copy of my project if you want to see how I did this with GitLab CI: https://gitlab.com/honeydue/mobile-development/file-editor and you can see in this pipeline that the number is incremented and uploaded: https://gitlab.com/honeydue/mobile-development/file-editor/-/jobs/3590869185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants