Add new internal testers not working using fastlane
New Issue Checklist
- [x] Updated fastlane to the latest version
Issue Description
I have successfully running the app by configuring the
AppFile .env.default file Fastfile up to the uploading to the test flight that's working fine, but i am now trying to add a internal testers from fastlane and jenkins but i am facing the issues in console output like,
in Fastfile i have added lanes like add_internal_testers
desc "Add internal testers"
lane :add_internal_tester do
client = spaceship::connectapi.login('[email protected]', 'password')
client.select_team(team_name: 'Test Demo Solution, Inc.')
app = Spaceship::ConnectAPI::App.find('com.test.fastlanedemo')
client = Spaceship::TestFlight::Base.client
tester = Spaceship::TestFlight::Tester.new
tester.first_name = 'Tester'
tester.last_name = 'Abc'
tester.email = '[email protected]'
# group = Spaceship::TestFlight::Group.create!(app_id: app.id, group_name: 'Internal Tester1')
# group = Spaceship::TestFlight::Group.create!(app_id: app.id, group_name: 'Testers')
groups = Spaceship::TestFlight::Group.add_tester_to_groups!(tester: tester, app: '[email protected]' , groups: ['ITC.apps.tf.labels.internalTesters'])
end
also the main lane is
lane :upload_build_to_testflight do
load_asc_api_key
# create_appicon
fetch_and_increment_build_number
# unlock_keychain
renew_certificates
prepare_signing
build_release
upload_release
**`add_internal_tester`**
end
end
Please refer fastlane env
[✔] 🚀
[07:28:02]: fastlane detected a Gemfile in the current directory
[07:28:02]: However, it seems like you didn't use `bundle exec`
[07:28:02]: To launch fastlane faster, please use
[07:28:02]:
[07:28:02]: $ bundle exec fastlane env
[07:28:02]:
[07:28:02]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
objc[7948]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x21f9cab90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1047c82c8). One of the two will be used. Which one is undefined.
objc[7948]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x21f9cabe0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1047c8318). One of the two will be used. Which one is undefined.
[07:28:04]: Generating fastlane environment output, this might take a few seconds...
swift-driver version: 1.26.21 <details><summary>✅ fastlane environment ✅</summary>
### Stack
| Key | Value |
| --------------------------- | ------------------------------------------- |
| OS | 12.1 |
| Ruby | 2.7.2 |
| Bundler? | false |
| Git | git version 2.37.0 |
| Installation Source | ~/.rbenv/versions/2.7.2/bin/fastlane |
| Host | macOS 12.1 (21C52) |
| Ruby Lib Dir | ~/.rbenv/versions/2.7.2/lib |
| OpenSSL Version | OpenSSL 1.1.1l 24 Aug 2021 |
| Is contained | false |
| Is homebrew | false |
| Is installed via Fabric.app | false |
| Xcode Path | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version | 13.2.1 |
| Swift Version | 5.5.2 |
### System Locale
| Variable | Value | |
| -------- | ----------- | - |
| LANG | en_US.UTF-8 | ✅ |
| LC_ALL | | |
| LANGUAGE | | |
### fastlane files:
<details><summary>`./fastlane/Fastfile`</summary>
ruby
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
platform :ios do
profile_name = nil
app_identifier = "#{ENV["PRODUCE_APP_IDENTIFIER"]}"
app_schema = "#{ENV["APP_SCHEME"]}"
app_certificate = "#{ENV["CERTIFICATE"]}"
desc "Description of what the lane does"
lane :load_asc_api_key do
api_key = app_store_connect_api_key(
key_id: "#{ENV["KEY_ID"]}",
issuer_id: "#{ENV["ISSUER_ID"]}",
key_filepath: "#{ENV["KEY_FILEPATH"]}"
# in_house: false # detecting this via ASC private key not currently supported
)
# pilot(api_key: api_key)
end
lane :create_app_on_store do
load_asc_api_key
produce(
username: CredentialsManager::AppfileConfig.try_fetch_value(:apple_id),
app_identifier: app_identifier,
enable_services: {
push_notification: "on", # Valid values: "on", "off"
associated_domains: "on",
in_app_purchase: "on"
}
)
end
lane :create_appicon do
appicon(
appicon_image_file: '1024.png',
appicon_devices: [:ipad, :iphone, :ios_marketing],
appicon_path: “Test/Test/Image Assest/WhitelabelledApp.xcassets"
)
end
desc "Bump build number based on most recent TestFlight build number"
lane :fetch_and_increment_build_number do
#fetch read your app identifier defined in your Appfile
api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
current_version = get_version_number(
xcodeproj: "#{ENV["XCODEPROJ"]}"
#target: "#{ENV["TARGET"]}" # replace with your main target, required if you have more than one non-test target
)
latest_build_number = latest_testflight_build_number(
api_key: api_key,
version: current_version,
app_identifier: app_identifier
)
increment_build_number(
build_number: (latest_build_number + 1),
)
end
desc "Recreate the provisioning profiles so you can deploy to your device, release on fabric and push to app store"
lane :renew_certificates do
types = ["appstore"] #"development", "adhoc"
app_identifier = app_identifier
types.each do |type|
remove_provisioning_profile(app_identifier: app_identifier, type: type)
end
end
desc "Check certs and profiles"
lane :prepare_signing do |options|
app_id = app_identifier
api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
profile_name = "#{ENV["PROVISIONING_PROFILES"]}" # replace with the name of your existing profile, or define a name for the profile that fastlane will create if it’s not found
unlock_keychain(
path: "#{ENV["FASTLANE_KEYCHAIN_PATH"]}",
password: "#{ENV["FASTLANE_KEYCHAIN_PASSWORD"]}"
)
cert(
api_key: api_key,
keychain_path: ENV["FASTLANE_KEYCHAIN_PATH"] # the path to the keychain where your certificates are stored
)
# main app profile
sigh(
api_key: api_key,
app_identifier: app_id,
provisioning_name: profile_name,
force: true # always recreate this exact profile to ensure it's valid and not expired
)
profile_name = match_type = Actions.lane_context[SharedValues::SIGH_NAME]
end
lane :build_release do |options|
app_identifier = app_identifier
output_name = "#{ENV["PRODUCE_APP_NAME"]}" # specify the name of the .ipa file to generate
export_method = "app-store" # specify the export method
compile_bitcode = true # specify whether to enable bitcode
# turn off automatic signing during build so correct code signing identity is guaranteed to be used
update_code_signing_settings(
use_automatic_signing: false,
targets: ["#{ENV["TARGET"]}"], # specify which targets to update code signing settings for
code_sign_identity: app_certificate, # replace with name of code signing identity if different
bundle_identifier: app_identifier,
build_configurations: [app_schema], # only toggle code signing settings for Release configurations
profile_name: profile_name
)
unlock_keychain(
path: "#{ENV["FASTLANE_KEYCHAIN_PATH"]}",
password: "#{ENV["FASTLANE_KEYCHAIN_PASSWORD"]}"
)
gym(
scheme: "#{ENV["APP_SCHEME"]}", # app_schema replace with name of your project’s scheme
output_name: output_name,
# sdk: "iphoneos",
clean: true,
configuration: "#{ENV["APP_SCHEME"]}", # app_schema
# keychain_password: "#{ENV["FASTLANE_KEYCHAIN_PASSWORD"]}",
export_options: {
method: export_method,
provisioningProfiles: {
app_identifier => profile_name
},
compileBitcode: compile_bitcode,
xcargs: "ASSETCATALOG_COMPILER_APPICON_NAME=./Test/Test/Image Assest/WhitelabelledApp.xcassets/AppIcon.appiconset",
codesigning_identity: app_certificate
}
)
end
lane :upload_release do
api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
deliver(
api_key: api_key,
skip_screenshots: true,
skip_metadata: true,
skip_app_version_update: true,
force: true, # skips verification of HTML preview file (since this will be run from a CI machine)
run_precheck_before_submit: false # not supported through ASC API yet
)
end
lane :upload_build_to_testflight do
load_asc_api_key
# create_appicon
fetch_and_increment_build_number
# unlock_keychain
renew_certificates
prepare_signing
build_release
upload_release
end
end
</details>
<details><summary>`./fastlane/Appfile`</summary>
ruby
require('dotenv')
Dotenv.load '../.env.default'
app_identifier ENV["PRODUCE_APP_IDENTIFIER"] # The bundle identifier of your app
apple_id “mailto:[email protected]"
</details>
### fastlane gems
| Gem | Version | Update-Status |
| -------- | ------- | ------------- |
| fastlane | 2.208.0 | ✅ Up-To-Date |
### Loaded fastlane plugins:
| Plugin | Version | Update-Status |
| ------------------------------------------- | ------- | ------------- |
| fastlane-plugin-versioning | 0.5.1 | ✅ Up-To-Date |
| fastlane-plugin-appicon | 0.16.0 | ✅ Up-To-Date |
| fastlane-plugin-remove_provisioning_profile | 1.0.3 | ✅ Up-To-Date |
<details><summary><b>Loaded gems</b></summary>
| Gem | Version |
| ------------------------------------------- | ------------ |
| did_you_mean | 1.4.0 |
| rouge | 2.0.7 |
| xcpretty | 0.3.0 |
| terminal-notifier | 2.0.0 |
| terminal-table | 1.8.0 |
| plist | 3.6.0 |
| addressable | 2.8.0 |
| 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-cookie_jar | 0.0.7 |
| gh_inspector | 1.1.3 |
| mini_magick | 4.11.0 |
| naturally | 2.2.1 |
| security | 0.1.3 |
| xcpretty-travis-formatter | 1.0.1 |
| dotenv | 2.7.6 |
| bundler | 2.1.4 |
| simctl | 1.6.8 |
| uri | 0.10.0 |
| rexml | 3.2.5 |
| nanaimo | 0.3.0 |
| colored2 | 3.1.2 |
| claide | 1.1.0 |
| CFPropertyList | 3.0.5 |
| atomos | 0.1.3 |
| xcodeproj | 1.22.0 |
| unicode-display_width | 1.8.0 |
| public_suffix | 4.0.7 |
| excon | 0.92.3 |
| ruby2_keywords | 0.0.5 |
| faraday-retry | 1.0.3 |
| faraday-rack | 1.0.0 |
| faraday-patron | 1.0.0 |
| faraday-net_http_persistent | 1.2.0 |
| faraday-net_http | 1.0.1 |
| faraday-multipart | 1.0.4 |
| faraday-httpclient | 1.0.1 |
| faraday-excon | 1.1.0 |
| faraday-em_synchrony | 1.0.0 |
| faraday-em_http | 1.0.0 |
| faraday | 1.10.0 |
| unf_ext | 0.0.8.2 |
| unf | 0.1.4 |
| domain_name | 0.5.20190701 |
| http-cookie | 1.0.5 |
| faraday_middleware | 1.2.0 |
| fastimage | 2.2.6 |
| json | 2.6.2 |
| rubyzip | 2.3.2 |
| jwt | 2.4.1 |
| webrick | 1.7.0 |
| httpclient | 2.8.3 |
| multi_json | 1.15.0 |
| signet | 0.17.0 |
| os | 1.1.4 |
| memoist | 0.16.2 |
| googleauth | 1.2.0 |
| mini_mime | 1.1.2 |
| 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.7.0 |
| google-apis-playcustomapp_v1 | 0.10.0 |
| google-apis-androidpublisher_v3 | 0.25.0 |
| rake | 13.0.6 |
| digest-crc | 0.6.4 |
| google-apis-storage_v1 | 0.18.0 |
| google-apis-iamcredentials_v1 | 0.13.0 |
| google-cloud-errors | 1.2.0 |
| google-cloud-env | 1.6.0 |
| google-cloud-core | 1.6.0 |
| google-cloud-storage | 1.37.0 |
| emoji_regex | 3.2.3 |
| aws-eventstream | 1.2.0 |
| aws-sigv4 | 1.5.0 |
| aws-partitions | 1.608.0 |
| jmespath | 1.6.1 |
| aws-sdk-core | 3.131.3 |
| aws-sdk-kms | 1.58.0 |
| aws-sdk-s3 | 1.114.0 |
| forwardable | 1.3.1 |
| logger | 1.4.2 |
| cgi | 0.1.0 |
| date | 3.0.0 |
| timeout | 0.1.0 |
| stringio | 0.1.0 |
| ipaddr | 1.2.2 |
| openssl | 2.1.2 |
| zlib | 1.1.0 |
| mutex_m | 0.1.0 |
| ostruct | 0.2.0 |
| strscan | 1.0.3 |
| io-console | 0.5.6 |
| delegate | 0.1.0 |
| fileutils | 1.4.1 |
| singleton | 0.1.0 |
| open3 | 0.1.0 |
| yaml | 0.1.0 |
| psych | 3.1.0 |
| fastlane-plugin-versioning | 0.5.1 |
| fastlane-plugin-appicon | 0.16.0 |
| benchmark | 0.1.0 |
| fastlane-plugin-remove_provisioning_profile | 1.0.3 |
</details>
*generated on:* **2022-07-21**
</details>
[07:28:05]: Take notice that this output may contain sensitive information, or simply information that you don't want to make public.
[07:28:05]: 🙄 Wow, that's a lot of markdown text... should fastlane put it into your clipboard, so you can easily paste it on GitHub? (y/n)
y
[08:10:28]: Successfully copied markdown into your clipboard 🎨
[08:10:28]: Open https://github.com/fastlane/fastlane/issues/new to submit a new issue ✅
Any help would be appreciated.
Thanks in advance.
It seems like you have not included the output of fastlane env
To make it easier for us help you resolve this issue, please update the issue to include the output of fastlane env :+1:
I think there are multiple ways to do this, not sure if you are doing it the easy way 😇
This has been working for me:
connect_app = Spaceship::ConnectAPI::App.find(bundle_id)
beta_groups = connect_app.get_beta_groups
asc_group = connect_app.create_beta_group(group_name: "ASC", is_internal_group: true)
all_users = Spaceship::ConnectAPI.get_users
beta_testers = {}
all_users.each do |u|
next if u.email.include? "xyz"
beta_testers << {email: u.email}
end
Spaceship::ConnectAPI.post_bulk_beta_tester_assignments(beta_group_id: asc_group.id, beta_testers: beta_testers)
You can of course adjust your logic how you select the users. In this case I'm iterating over all internal users and add them to the new group called "ASC" (= App Store Connect)
@max-ott I checked by using your snippet. but I am facing some errors here are the my lane for testers
`desc "Add internal testers"
lane :add_internal_tester do
client = spaceship::connectapi.login(‘[[email protected]](mailto:[email protected])’, ‘password’)
client.select_team(team_name: ’Test Inc.’)
app = Spaceship::ConnectAPI::App.find(‘bundle_id’)
client = Spaceship::TestFlight::Base.client
tester = Spaceship::TestFlight::Tester.new
tester.first_name = ‘User’
tester.last_name = ‘1’
tester.email = ‘[[email protected]](mailto:[email protected])’
groups = Spaceship::TestFlight::Group.add_tester_to_groups!(tester: tester, app: ‘[email protected] , groups: [‘group_name’])
connect_app = Spaceship::ConnectAPI::App.find(bundle_id)
beta_groups = connect_app.get_beta_groups
asc_group = connect_app.create_beta_group(group_name: "Internal Testers", is_internal_group: true)
all_users = Spaceship::ConnectAPI.get_users
beta_testers = {}
all_users.each do |u|
next if u.email.include? "xyz"
beta_testers << {email: u.email}
end
Spaceship::ConnectAPI.post_bulk_beta_tester_assignments(beta_group_id: asc_group.id, beta_testers: beta_testers)
end`
when I am trying to run this lane it's throwing an error as per the screenshot below
Can you guide me on this?
Ruby is case sensitive. spaceship::connectapi.login in line 3 might be the issue. This needs to be Spaceship::ConnectAPI.login
@max-ott the above error [!] Could not find action, lane or variable 'spaceship' has been resolved as per your suggestion thanks.
But I am facing new error like screenshot attached
Kindly help me on this as I am not much aware about ruby
Thanks in advance
@fastlaneTeam can anyone help me on this? Any help would be appreciable.
@fastlaneTeam can anyone help me on this? Any help would be appreciable.
You should use Spaceship::ConnectAPI::Client.login('AppleID', 'password').
Not Spaceship::ConnectAPI.login
@fastlaneTeam can anyone help me on this? Any help would be appreciable.
You should use
Spaceship::ConnectAPI::Client.login('AppleID', 'password'). NotSpaceship::ConnectAPI.login
It's asking for two factor authentication Can you please help us on this?
@fastlaneTeam can anyone help me on this? Any help would be appreciable.
You should use
Spaceship::ConnectAPI::Client.login('AppleID', 'password'). NotSpaceship::ConnectAPI.loginIt's asking for two factor authentication Can you please help us on this?
You can read the source code. There are two ways to login your account.
https://github.com/fastlane/fastlane/blob/ff41f3556f1baf8e700477e50f65be728780aa94/spaceship/lib/spaceship/connect_api/client.rb#L54
https://github.com/fastlane/fastlane/blob/ff41f3556f1baf8e700477e50f65be728780aa94/spaceship/lib/spaceship/connect_api/client.rb#L31
If you use Spaceship::ConnectAPI::Client.login, you need to input two factor authentication.
If you use Spaceship::ConnectAPI::Client.auth, you can login in directly.
But I tried the auth method and it wouldn't work. Don't know what's wrong with it.
Finally, I chose to use the login method.
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:
This issue will be auto-closed if there is no reply within 1 month.
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: