Use case - automated CI build. When the previous build fails, the CI worker cleans up all its artefacts including temporary keychain. While leaving no default keychain in place, then create_keychain with option 'default_keychain: true' fails. The issue happens as create_keychain does not handle error returned by shell command security default-keychain
, which occurs when default keychain is not set.
You can use:
--capture_output
as the last commandline argument to get that collected for you
FASTLANE_PASSWORD=blabla fastlane --verbose alfa
Successfully loaded Appfile at path '/Users/admin/iphone-front-end/fastlane/Appfile'
- app_identifier: 'com.grocerkey.shopperapp'
- apple_id: '[email protected]'
- team_id: 'U5CS3T9JSF'
-------
DEBUG [2016-11-06 09:48:03.66]: Checking if there are any plugins that should be loaded...
INFO [2016-11-06 09:48:03.69]: -------------------------------------------------
INFO [2016-11-06 09:48:03.69]: --- Step: Verifying required fastlane version ---
INFO [2016-11-06 09:48:03.69]: -------------------------------------------------
INFO [2016-11-06 09:48:03.69]: Your fastlane version 1.107.0 matches the minimum requirement of 1.106.2 โ
INFO [2016-11-06 09:48:03.70]: ------------------------------
INFO [2016-11-06 09:48:03.70]: --- Step: default_platform ---
INFO [2016-11-06 09:48:03.70]: ------------------------------
INFO [2016-11-06 09:48:03.71]: Driving the lane 'ios alfa' ๐
INFO [2016-11-06 09:48:03.72]: -----------------------------
INFO [2016-11-06 09:48:03.72]: --- Step: create_keychain ---
INFO [2016-11-06 09:48:03.72]: -----------------------------
INFO [2016-11-06 09:48:03.72]: $ security create-keychain -p FjwGUxmiwuNdEzGup3Z45Q\=\= ci-alfa
INFO [2016-11-06 09:48:04.02]: $ security default-keychain
INFO [2016-11-06 09:48:04.07]: โธ security: SecKeychainCopyDefault: A default keychain could not be found.
WARN [2016-11-06 09:48:04.08]: Variable Dump:
INFO [2016-11-06 09:48:04.08]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios alfa"}
ERROR [2016-11-06 09:48:04.08]: Exit status of command 'security default-keychain' was 1 instead of 0.
security: SecKeychainCopyDefault: A default keychain could not be found.
INFO [2016-11-06 09:48:04.08]: Successfully generated documentation at path '/Users/admin/iphone-front-end/fastlane/README.md'
+------+-------------------------------------+-------------+
| fastlane summary |
+------+-------------------------------------+-------------+
| Step | Action | Time (in s) |
+------+-------------------------------------+-------------+
| 1 | Verifying required fastlane version | 0 |
| 2 | default_platform | 0 |
| ๐ฅ | create_keychain | 0 |
+------+-------------------------------------+-------------+
ERROR [2016-11-06 09:48:04.09]: fastlane finished with errors
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane_core-0.53.0/lib/fastlane_core/ui/interface.rb:145:in `user_error!': [!] Exit status of command 'security default-keychain' was 1 instead of 0. (FastlaneCore::Interface::FastlaneError)
security: SecKeychainCopyDefault: A default keychain could not be found.
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane_core-0.53.0/lib/fastlane_core/ui/ui.rb:14:in `method_missing'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/helper/sh_helper.rb:54:in `sh_control_output'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/helper/sh_helper.rb:10:in `sh'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/actions/create_keychain.rb:18:in `run'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:202:in `block (2 levels) in execute_action'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/actions/actions_helper.rb:35:in `execute_action'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:187:in `block in execute_action'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:186:in `chdir'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:186:in `execute_action'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:112:in `trigger_action_by_name'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/fast_file.rb:140:in `method_missing'
from Fastfile:60:in `block (2 levels) in parsing_binding'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/lane.rb:33:in `call'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:49:in `block in execute'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:45:in `chdir'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/runner.rb:45:in `execute'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/lane_manager.rb:52:in `cruise_lane'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/command_line_handler.rb:30:in `handle'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:69:in `block (2 levels) in run'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:178:in `call'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:153:in `run'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/runner.rb:444:in `run_active_command'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane_core-0.53.0/lib/fastlane_core/ui/fastlane_runner.rb:38:in `run!'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/delegates.rb:15:in `run!'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:257:in `run'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:31:in `start'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/cli_tools_distributor.rb:58:in `take_off'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/bin/fastlane:5:in `<top (required)>'
from /Users/admin/.rbenv/versions/2.3.1/bin/fastlane:22:in `load'
from /Users/admin/.rbenv/versions/2.3.1/bin/fastlane:22:in `<main>'
Please run fastlane env
and copy the output below. This will help us help you :+1:
If you used --capture_output
option please remove this block - as it is already included there.
โ
fastlane environment โ
| Key | Value |
| ------------------- | ----------------------------------------------- |
| OS | 10.11.6 |
| Ruby | 2.3.1 |
| Bundler? | false |
| Xcode Path | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version | 7.3.1 |
| Git | git version 2.7.4 (Apple Git-66) |
| Installation Source | /Users/admin/.rbenv/versions/2.3.1/bin/fastlane |
| Host | Mac OS X 10.11.6 (15G1004) |
| Ruby Lib Dir | /Users/admin/.rbenv/versions/2.3.1/lib |
| OpenSSL Version | OpenSSL 1.0.2j 26 Sep 2016 |
./fastlane/Fastfile
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
# update_fastlane
# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "1.106.2"
default_platform :ios
platform :ios do
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
# cocoapods
end
##### Lane: TEST ########################
desc "Runs all the tests"
lane :test do
scan
end
##### Lane: BETAAPPLE ########################
desc "Submit a new Beta Build to Apple TestFlight"
desc "This will also make sure the profile is up to date"
lane :betaapple do
# match(type: "appstore") # more information: https://codesigning.guide
gym # Build your app - more options available
pilot
# sh "your_script.sh"
# You can also use other beta testing services here (run `fastlane actions`)
end
##### Lane: RELEASE ########################
desc "Deploy a new version to the App Store"
lane :release do
# match(type: "appstore")
# snapshot
gym # Build your app - more options available
deliver(force: true)
# frameit
end
##### Lane: ALFA ########################
desc "Alfa Test fastlane"
lane :alfa do
keychain_name = "ci-alfa"
# Creating temporary keychain
create_keychain(
name: keychain_name,
default_keychain: true,
unlock: true,
timeout: false,
password: SecureRandom.base64
)
# Import Apple's root CA certificate
import_certificate(
certificate_path: "Provisioning/AppleComputerRootCertificate.cer",
keychain_name: keychain_name
)
# Import Apple's WWDR certificate
import_certificate(
certificate_path: "Provisioning/AppleWWDRCA.cer",
keychain_name: keychain_name
)
# provision devices from file Provisioning/devices to Apple developer portal; optimistic provisioning applies
register_devices(
devices_file: "Provisioning/devices"
)
# Deleting temporary keychain
delete_keychain(
name: keychain_name
)
end
##### Lane: BETA ########################
desc "Submit a new Beta build to Hockey App"
lane :beta do
keychain_name = "ci-beta"
create_keychain(
name: keychain_name,
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: true,
password: SecureRandom.base64
)
# Import distribution certificate
import_certificate(
certificate_path: "fastlane/Certificates/distribution.p12",
certificate_password: ENV["KEY_PASSWORD"],
keychain_name: keychain_name
)
# Provision devices from file Provisioning/devices to Apple developer portal; optimistic provisioning applies
register_devices(
devices_file: "Provisioning/devices"
)
# Fetch provisioning profile
sigh(
adhoc: true,
username: "[email protected]",
team_id: "XA8U8K5RRK",
provisioning_name: "CI Example Ad Hoc",
cert_id: "2T3HB2838A"
)
increment_build_number(build_number: number_of_commits)
# Build
gym(
configuration: "Ad Hoc",
sdk: "iphoneos9.2",
clean: true,
include_bitcode: false,
include_symbols: true,
use_legacy_build_api: true,
export_method: "enterprise"
)
# Push to Hockey
hockey(
api_token: ENV["HOCKEY_API_TOKEN"],
public_identifier: ENV["HOCKEY_APP_ID"],
notify: '0',
status: '2',
notes: last_git_commit[:message] + "n(Uploaded automatically via fastlane)"
)
delete_keychain(
name: keychain_name
)
end
after_all do |lane|
# This block is called, only if the executed lane was successful
# slack(
# message: "Successfully deployed new App Update."
# )
end
error do |lane, exception|
# slack(
# message: exception.message,
# success: false
# )
end
end
# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# fastlane reports which actions are used
# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer
./fastlane/Appfile
app_identifier "com.grocerkey.shopperapp" # The bundle identifier of your app
apple_id "[email protected]" # Your Apple email address
team_id "U5CS3T9JSF" # Developer Portal Team ID
# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md
| Gem | Version | Update-Status |
| ------------------- | ------- | ------------- |
| credentials_manager | 0.16.2 | โ
Up-To-Date |
| spaceship | 0.37.0 | โ
Up-To-Date |
| fastlane_core | 0.53.0 | โ
Up-To-Date |
| deliver | 1.15.0 | โ
Up-To-Date |
| snapshot | 1.16.3 | โ
Up-To-Date |
| frameit | 3.0.0 | โ
Up-To-Date |
| pem | 1.4.0 | โ
Up-To-Date |
| cert | 1.4.3 | โ
Up-To-Date |
| sigh | 1.11.2 | โ
Up-To-Date |
| produce | 1.3.0 | โ
Up-To-Date |
| gym | 1.12.0 | โ
Up-To-Date |
| pilot | 1.12.0 | โ
Up-To-Date |
| scan | 0.14.1 | โ
Up-To-Date |
| supply | 0.7.1 | โ
Up-To-Date |
| match | 0.10.0 | โ
Up-To-Date |
| screengrab | 0.5.5 | โ
Up-To-Date |
| fastlane | 1.107.0 | โ
Up-To-Date |
No plugins Loaded
Loaded gems
| Gem | Version |
| ------------------------- | ------------ |
| did_you_mean | 1.0.2 |
| highline | 1.7.8 |
| commander | 4.4.0 |
| terminal-table | 1.4.5 |
| json | 1.8.3 |
| multipart-post | 2.0.0 |
| faraday | 0.9.2 |
| faraday_middleware | 0.10.0 |
| dotenv | 2.1.1 |
| net-ssh | 3.2.0 |
| net-sftp | 2.1.2 |
| plist | 3.1.0 |
| security | 0.1.3 |
| krausefx-shenzhen | 0.14.10 |
| slack-notifier | 1.5.1 |
| CFPropertyList | 2.3.3 |
| claide | 1.0.1 |
| colored | 1.2 |
| nanaimo | 0.2.2 |
| xcodeproj | 1.4.1 |
| rouge | 1.11.1 |
| xcpretty | 0.2.4 |
| terminal-notifier | 1.7.1 |
| public_suffix | 2.0.3 |
| addressable | 2.5.0 |
| credentials_manager | 0.16.2 |
| multi_xml | 0.5.5 |
| unf_ext | 0.0.7.2 |
| unf | 0.1.4 |
| domain_name | 0.5.20161021 |
| http-cookie | 1.0.3 |
| faraday-cookie_jar | 0.0.6 |
| fastimage | 1.6.8 |
| xcode-install | 2.0.8 |
| word_wrap | 1.0.0 |
| multi_json | 1.12.1 |
| babosa | 1.0.2 |
| excon | 0.54.0 |
| rubyzip | 1.1.7 |
| gh_inspector | 1.0.2 |
| fastlane_core | 0.53.0 |
| bundler | 1.13.6 |
| mini_magick | 4.5.1 |
| xcpretty-travis-formatter | 0.0.4 |
| uber | 0.0.15 |
| representable | 2.3.0 |
| retriable | 2.1.0 |
| mime-types-data | 3.2016.0521 |
| mime-types | 3.1 |
| hurley | 0.2 |
| little-plugger | 1.1.4 |
| logging | 2.1.0 |
| jwt | 1.5.6 |
| memoist | 0.15.0 |
| os | 0.9.6 |
| signet | 0.7.3 |
| googleauth | 0.5.1 |
| httpclient | 2.8.2.4 |
| google-api-client | 0.9.19 |
| i18n | 0.7.0 |
| thread_safe | 0.3.5 |
| tzinfo | 1.2.2 |
| minitest | 5.9.1 |
| activesupport | 4.2.7.1 |
| io-console | 0.4.6 |
generated on: 2016-11-06
Looking for related GitHub issues on fastlane/fastlane...
โก๏ธ invalid byte sequence in US-ASCII
https://github.com/fastlane/fastlane/issues/2253 [closed] 2 ๐ฌ
6 weeks ago
โก๏ธ invalid byte sequence in US-ASCII
https://github.com/fastlane/fastlane/issues/2389 [closed] 2 ๐ฌ
6 weeks ago
โก๏ธ invalid byte sequence in US-ASCII (ArgumentError)
https://github.com/fastlane/fastlane/issues/227 [closed] 20 ๐ฌ
14 Sep 2016
and 17 more at: https://github.com/fastlane/fastlane/search?q=invalid%20byte%20sequence%20in%20US-ASCII&type=Issues&utf8=โ
/Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/highline-1.7.8/lib/highline.rb:730:in gsub': [!] invalid byte sequence in US-ASCII (ArgumentError)
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/highline-1.7.8/lib/highline.rb:730:in
format_statement'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/highline-1.7.8/lib/highline.rb:621:in say'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/highline-1.7.8/lib/highline.rb:261:in
ask'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/highline-1.7.8/lib/highline.rb:227:in agree'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane_core-0.53.0/lib/fastlane_core/ui/implementations/shell.rb:98:in
confirm'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane_core-0.53.0/lib/fastlane_core/ui/ui.rb:14:in method_missing'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/environment_printer.rb:6:in
output'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:252:in block (2 levels) in run'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:178:in
call'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/command.rb:153:in run'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/runner.rb:444:in
run_active_command'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane_core-0.53.0/lib/fastlane_core/ui/fastlane_runner.rb:38:in run!'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/commander-4.4.0/lib/commander/delegates.rb:15:in
run!'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:257:in run'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/commands_generator.rb:31:in
start'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/lib/fastlane/cli_tools_distributor.rb:58:in take_off'
from /Users/admin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fastlane-1.107.0/bin/fastlane:5:in
load'
from /Users/admin/.rbenv/versions/2.3.1/bin/fastlane:22:in
It seems like this issue might be related to code signing :no_entry_sign:
Have you seen our new Code Signing Troubleshooting Guide? It will help you resolve the most common code signing issues :+1:
https://github.com/fastlane/fastlane/pull/6887 should fix it - please +1 it.
Retested with following versions, result: PASSED.
DN:~ admin$ fastlane -v
fastlane 1.108.0
DN:~ admin$ match -v
match 0.11.0
Thanks @hjanuschka !
Most helpful comment
Retested with following versions, result: PASSED.
DN:~ admin$ fastlane -v
fastlane 1.108.0
DN:~ admin$ match -v
match 0.11.0
Thanks @hjanuschka !