1

I'm setting up a CICD server with Azure DevOps Pipelines for my iOS application and am having trouble with code signing. I think the issue is Xcode being unable to access the keychain, so it displays a prompt for me to enter a password and provide access - I'm unable to enter this because it's running headless in the CI server.

I'm getting the same problem using xcodebuild and Fastlane gym.

Xcode build

xcodebuild build -workspace './ios/myApp.xcworkspace' -scheme 'myApp' -verbose

Output line it prompts for a keychain password:

GenerateDSYMFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app.dSYM /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/myApp (in target: myApp)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios
    /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/myApp -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app.dSYM

PBXCp /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/Lottie.framework /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework (in target: myApp)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -exclude Headers -exclude PrivateHeaders -exclude Modules -exclude \*.tbd -strip-debug-symbols -bitcode-strip replace-with-marker -bitcode-strip-tool /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip -strip-tool /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -resolve-src-symlinks /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/Lottie.framework /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks
/Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -S /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/Lottie.framework/Lottie -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework/Lottie 
/Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework/Lottie -m -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework/Lottie 

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-target-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-target-headers.hmap

WriteAuxiliaryFile /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    write-file /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.o /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    export LANG=en_US.US-ASCII
    /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DPOD_CONFIGURATION_RELEASE=1 -DCOCOAPODS=1 -DPOD_CONFIGURATION_RELEASE=1 -DGPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 -DPOD_CONFIGURATION_RELEASE=1 -DPB_FIELD_32BIT=1 -DPB_NO_PACKED_STRUCTS=1 -DPB_ENABLE_MALLOC=1 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode_10.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -fembed-bitcode-marker -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap -ivfsoverlay /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/include -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Firebase -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseAnalyticsInterop -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseCore -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseInstanceID -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseMessaging -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/GoogleUtilities -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Protobuf -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/nanopb -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Firebase/CoreOnly/Sources -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources-normal/armv7 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources/armv7 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources -F/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/FirebaseAnalytics/Frameworks -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/GoogleAppMeasurement/Frameworks -MMD -MT dependencies -MF /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.d --serialize-diagnostics /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.dia -c /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/armv7/Pods-myAppTests-dummy.o

CompileC /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.o /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target: Pods-myAppTests)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios/Pods
    export LANG=en_US.US-ASCII
    /Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/vsts/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DPOD_CONFIGURATION_RELEASE=1 -DCOCOAPODS=1 -DPOD_CONFIGURATION_RELEASE=1 -DGPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 -DPOD_CONFIGURATION_RELEASE=1 -DPB_FIELD_32BIT=1 -DPB_NO_PACKED_STRUCTS=1 -DPB_ENABLE_MALLOC=1 -DNS_BLOCK_ASSERTIONS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode_10.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -fembed-bitcode-marker -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-generated-files.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-own-target-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-all-non-framework-target-headers.hmap -ivfsoverlay /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/all-product-headers.yaml -iquote /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Pods-myAppTests-project-headers.hmap -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/include -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Firebase -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseAnalyticsInterop -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseCore -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseInstanceID -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/FirebaseMessaging -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/GoogleUtilities -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/Protobuf -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Headers/Public/nanopb -I/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Firebase/CoreOnly/Sources -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources-normal/arm64 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources/arm64 -I/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/DerivedSources -F/Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/FirebaseAnalytics/Frameworks -F/Users/vsts/agent/2.150.3/work/1/s/ios/Pods/GoogleAppMeasurement/Frameworks -MMD -MT dependencies -MF /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.d --serialize-diagnostics /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.dia -c /Users/vsts/agent/2.150.3/work/1/s/ios/Pods/Target\ Support\ Files/Pods-myAppTests/Pods-myAppTests-dummy.m -o /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/Pods.build/Release-iphoneos/Pods-myAppTests.build/Objects-normal/arm64/Pods-myAppTests-dummy.o

CodeSign /Users/vsts/Library/Developer/Xcode/DerivedData/safepoint-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/safepoint.app/Frameworks/Lottie.framework (in target: safepoint)
    cd /Users/vsts/agent/2.150.3/work/1/s/ios
    export CODESIGN_ALLOCATE=/Applications/Xcode_10.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "iPhone Developer: XXXX XXXXX (XXXXXX)"
Provisioning Profile: "match Development com.jamesrogers.myApp"
                      (XXXXXXXXXXXXXXXXXXXXXXXXXx)

    /usr/bin/codesign --force --sign 91BB2EBDF2635F1D8B951B60FDA0CB8406EA5B85 --timestamp=none --preserve-metadata=identifier,entitlements,flags /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Products/Release-iphoneos/myApp.app/Frameworks/Lottie.framework

Fastlane gym

gym(scheme: 'myApp', workspace: './ios/myApp', verbose: true)

Output line it prompts for a keychain password:

Generating 'myApp.app.dSYM'
‌Copying‌ /Users/vsts/Library/Developer/Xcode/DerivedData/myApp-baobuhuxmmxrfqdivdrvlrzqvfby/Build/Intermediates.noindex/ArchiveIntermediates/myApp/BuildProductsPath/Release-iphoneos/Lottie.framework‌

Attempted solutions

I have tried two things to get around this, but they both result in Xcode prompting me for keychain access.

  1. I tried unlocking the keychain but failed to find any concrete information online on how to do so. Firstly, I don't know what keychain to use or what password to use. From some information I found here, it appears the password for the default keychain "is normally the password for the user that is starting the agent". Does this mean it's the password for my azure devops account? I then run the following to see all my available keychains:
security list-keychains

// output
"/Users/vsts/Library/Keychains/login.keychain-db"
"/Library/Keychains/System.keychain"

I'm assuming the default keychain is login.keychain-db, since I don't have permission to access System.keychain.

Running the following using my azure devops account password with fastlane (right before match and gym):

unlock_keychain(
  path: "/Users/vsts/Library/Keychains/login.keychain-db",
  password: "myPassword")
)

or using security util (before fastlane match and gym):

security unlock-keychain -p myPassword /Users/vsts/Library/Keychains/login.keychain-db

This still results in the same problem. I also get some warnings from fastlane match:

[12:06:53]: ‌Could not configure imported keychain item (certificate) to prevent UI permission popup when code signing‌Check if you supplied the correct `keychain_password` for keychain: `/Users/vsts/Library/Keychains/login.keychain-db`security: SecKeychainItemSetAccessWithPassword: The user name or passphrase you entered is not correct.‌
[12:06:53]: 
[12:06:53]: ‌Please look at the following docs to see how to set a keychain password:‌
[12:06:53]: ‌ - https://docs.fastlane.tools/actions/sync_code_signing
‌[12:06:53]: ‌ - https://docs.fastlane.tools/actions/get_certificates‌

This indicates the keychain name or password is incorrect, and tells me that I xcode will prompt me for the keychain password. Does anybody know what the password should be?

  1. My other attempt was to create a new keychain to install and read the certificates. I've tried this using built-in fastlane actions and the security command utility. I also set the newly created keychain to default, added it to the search list and unlocked it.

In Fastfile before match and gym:

create_keychain(
  name: 'ios-build',
  password: 'password123',
  default_keychain: true,
  unlock: true,
  add_to_search_list: true
)

or using security util (before fastlane match and gym):

security create-keychain -p password123 ios-build.keychain // create keychain
security list-keychains -d user -s login.keychain ios-build.keychain // add to search path
security unlock-keychain -p password123 /Users/vsts/Library/Keychains/ios-build.keychain-db // unlock

I also set the MATCH_KEYCHAIN_NAME and MATCH_KEYCHAIN_PASSWORD environment variables to reference this new keychain.

This time, the warnings from match are gone (suggesting it has correctly installed the certs and profiles to the new keychain), but it still hangs on the keychain password prompt when building. I also tried this with an empty password for the keychain - exact same problem. I am wondering if Xcode is still trying to access the original default keychain, and not the newly created one? If so, do I need to configure xcode/gym to look for the newly created keychain?

The tools I'm using:

  • Microsoft Hosted Agent: macOS-10.14
  • Xcode: 10.2.1
  • Fastlane: 2.123.0
jamesrogers93
  • 335
  • 1
  • 5
  • 15
  • Your question doesn't include the _actual_ problem you are having, please add the output you are getting and what makes you think this points to the problem you identified. – janpio May 23 '19 at 17:08
  • Hi @janpio, sorry about that. I have edited the question with the output – jamesrogers93 May 24 '19 at 08:29
  • The output you added doesn't clearly show the problem - can you add more lines _before_ things get stuck (and define what that actually means)? Can you use your fastlane configuration locally successfully to build your app? Are you using https://docs.fastlane.tools/actions/setup_ci/? – janpio May 24 '19 at 10:52
  • I've provided additional log outputs. What I mean by getting stuck, is Xcode prompting me for a keychain password for codesigning. I did not see that setup_ci action. I'll give that a go and report back :) – jamesrogers93 May 24 '19 at 11:11
  • I've just had a look at setup_ci. It looks like it's written to only support travisCI and circleCI specifically. Although, I had a look through the [src](https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/setup_ci.rb), and in either case, it creates a new keychain using the same method I have already tried. I don't expect it to change anything but I'll still give it a try in case I've missed anything. I'll try it with the 'circleci' config, as it also makes apparently makes logs easier to collect – jamesrogers93 May 24 '19 at 11:28
  • If you archive the target in Xcode with same ITC credentials, would it work? Normally I'd try everything in Xcode firstly, then test fastlane next. When the MacOS prompts you for keychain permission, remember to select "Always Allow" – Chris Chen May 24 '19 at 11:30
  • @jamesrogers93 The `provider` parameter is optional. @Chris Chen This is about running it on Azure Piplines - no way to click anything. – janpio May 24 '19 at 11:32
  • @janpio if you have a local Mac environment, would you be able to try archiving an IPA. AFIAK, several things in the Xcode project target team settings and build settings can cause issues – Chris Chen May 24 '19 at 11:34
  • I missed the optional `provider` field, I'll leave it empty – jamesrogers93 May 24 '19 at 11:35
  • @ChrisChen Everything works as expected locally – jamesrogers93 May 24 '19 at 11:36
  • If you leave `provider` empty, setup_ci does nothing, as it implies you're not running on a CI. You need to set `provider` for it to create the temp keychain. – jamesrogers93 May 24 '19 at 11:39
  • Oh right, use `force: true` then. (sorry) – janpio May 24 '19 at 11:41
  • You still write "it prompts for a keychain password" in your question. Is this a known thing or something you assume? – janpio May 24 '19 at 11:42
  • It's something I'm assuming based on [this](https://stackoverflow.com/questions/13078033/xcode-project-on-jenkins-stuck-at-codesign) – jamesrogers93 May 24 '19 at 11:48
  • Another reason I assume this is because I was able to replicate the problem locally – jamesrogers93 May 24 '19 at 11:53
  • 1
    @janpio My build just completed successfully thanks to `setup_ci`. I'm not sure where I went wrong with my manual temp keychain fix. Thanks very much for the help :) If you submit an answer, I can mark it as accepted – jamesrogers93 May 24 '19 at 12:27

1 Answers1

2

Fastlane has an action setup_ci that can be used to prepare the keychain and match for usage in a CI environment.

The provider param is optional, but you might have to set force:true if your CI provider is not correctly identified automatically. (Please open an issue at fastlane if that is the case. Thanks.)

janpio
  • 10,645
  • 16
  • 64
  • 107