1

我试图在 Azure DevOps 管道中使用 Fastlane 仅用于构建 iOS 应用程序,我尝试导入我拥有的证书文件,但它一直给我错误,
将所有敏感数据删除到“xxxx”

Getting : security: SecKeychainItemImport: The specified keychain could not be found
 

执行的命令

 default_platform(:ios)

platform :ios do

desc "Ios build "

lane :release do
    create_keychain(
    name: "iPhone Distribution: xxxx, INC",
    default_keychain: true,
    unlock: true,
    timeout: 3600,
    lock_when_sleeps: true,
    password:"xxx"
    )

    import_certificate(
    certificate_path: "xxxx.cer",
    keychain_name: "iPhone Distribution: xxxx, INC",
    keychain_password:"xxxx"
    )

    import_certificate(
    certificate_path: "xxxx.p12",
    certificate_password: "netics77perso",
    keychain_name: "iPhone Distribution: xxxx, INC",
    keychain_password:"xxxx"
)
end

输出 :

2020-09-08T21:05:36.7924880Z DEBUG [2020-09-08 21:05:36.79]: Checking if there are any plugins that should be loaded...
2020-09-08T21:05:36.9225840Z [33mSuccessfully loaded Appfile at path '/Users/runner/work/1/a/ios_artifacts/fastlane/Appfile'[0m
2020-09-08T21:05:36.9264960Z - [36mapp_identifier[0m: '[32mcom.xxxx.xxxx[0m'
2020-09-08T21:05:36.9274650Z - [36mapple_id[0m: '[32mxxxx@xxxx.com[0m'
2020-09-08T21:05:36.9282660Z -------
2020-09-08T21:05:37.0126610Z INFO [2020-09-08 21:05:37.01]: [32m------------------------------[0m
2020-09-08T21:05:37.0163310Z INFO [2020-09-08 21:05:37.01]: [32m--- Step: default_platform ---[0m
2020-09-08T21:05:37.0203110Z INFO [2020-09-08 21:05:37.01]: [32m------------------------------[0m
2020-09-08T21:05:37.0219820Z /Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.158.0/fastlane_core/lib/fastlane_core/ui/interface.rb:141: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
2020-09-08T21:05:37.0258670Z /Users/runner/hostedtoolcache/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/fastlane-2.158.0/fastlane_core/lib/fastlane_core/ui/errors/fastlane_error.rb:9: warning: The called method `initialize' is defined here
2020-09-08T21:05:37.0271870Z INFO [2020-09-08 21:05:37.01]: [32mDriving the lane 'ios release' 🚀[0m
2020-09-08T21:05:37.0282040Z INFO [2020-09-08 21:05:37.01]: [32m-----------------------------[0m
2020-09-08T21:05:37.0311150Z INFO [2020-09-08 21:05:37.01]: [32m--- Step: create_keychain ---[0m
2020-09-08T21:05:37.0330570Z INFO [2020-09-08 21:05:37.01]: [32m-----------------------------[0m
2020-09-08T21:05:37.1553810Z INFO [2020-09-08 21:05:37.15]: [36m$ security list-keychains -d user[0m
2020-09-08T21:05:37.1710130Z INFO [2020-09-08 21:05:37.16]: â–¸ [35m"/Users/runner/Library/Keychains/iPhone Distribution: xxxx TECHNOLOGIES, INC-db"[0m
2020-09-08T21:05:37.1952790Z INFO [2020-09-08 21:05:37.19]: [32m--------------------------------[0m
2020-09-08T21:05:37.1965230Z INFO [2020-09-08 21:05:37.19]: [32m--- Step: import_certificate ---[0m
2020-09-08T21:05:37.1986400Z INFO [2020-09-08 21:05:37.19]: [32m--------------------------------[0m
2020-09-08T21:05:37.3147120Z ERROR [2020-09-08 21:05:37.31]: [31msecurity: SecKeychainItemImport: The specified keychain could not be found.[0m
2020-09-08T21:05:37.3157620Z INFO [2020-09-08 21:05:37.31]: [32m--------------------------------[0m
2020-09-08T21:05:37.3159000Z INFO [2020-09-08 21:05:37.31]: [32m--- Step: import_certificate ---[0m
2020-09-08T21:05:37.3161380Z INFO [2020-09-08 21:05:37.31]: [32m--------------------------------[0m
2020-09-08T21:05:37.3650880Z ERROR [2020-09-08 21:05:37.36]: [31msecurity: SecKeychainItemImport: The specified keychain could not be found.[0m
2020-09-08T21:05:37.3671550Z INFO [2020-09-08 21:05:37.36]: [32mSuccessfully generated documentation at path '/Users/runner/work/1/a/ios_artifacts/fastlane/README.md'[0m
2020-09-08T21:05:37.3725080Z 
2020-09-08T21:05:37.3770750Z +------+--------------------+-------------+
2020-09-08T21:05:37.3780600Z |            [32mfastlane summary[0m             |
2020-09-08T21:05:37.3827850Z +------+--------------------+-------------+
2020-09-08T21:05:37.3828450Z | Step | Action             | Time (in s) |
2020-09-08T21:05:37.3834520Z +------+--------------------+-------------+
2020-09-08T21:05:37.3845600Z | 1    | default_platform   | 0           |
2020-09-08T21:05:37.3849370Z | 2    | create_keychain    | 0           |
2020-09-08T21:05:37.3862610Z | 3    | import_certificate | 0           |
2020-09-08T21:05:37.3899420Z | 4    | import_certificate | 0           |
2020-09-08T21:05:37.3900940Z +------+--------------------+-------------+
2020-09-08T21:05:37.3906010Z 
2020-09-08T21:05:37.3907410Z INFO [2020-09-08 21:05:37.37]: [32mfastlane.tools finished successfully 🎉[0m
2020-09-08T21:05:37.4023220Z 
2020-09-08T21:05:37.4095380Z ##[section]Finishing: create_keychain

Fastlane 环境环境

2020-09-08T21:05:30.0950580Z <details><summary>✅ fastlane environment ✅&lt;/summary>
2020-09-08T21:05:30.0951450Z 
2020-09-08T21:05:30.0951640Z ### Stack
2020-09-08T21:05:30.0951760Z 
2020-09-08T21:05:30.0952090Z | Key                         | Value                                              |
2020-09-08T21:05:30.0952960Z | --------------------------- | -------------------------------------------------- |
2020-09-08T21:05:30.0953470Z | OS                          | 10.14.6                                            |
2020-09-08T21:05:30.0953910Z | Ruby                        | 2.7.1                                              |
2020-09-08T21:05:30.0954380Z | Bundler?                    | false                                              |
2020-09-08T21:05:30.0954810Z | Git                         | git version 2.28.0                                 |
2020-09-08T21:05:30.0955290Z | Installation Source         | ~/hostedtoolcache/Ruby/2.7.1/x64/bin/fastlane      |
2020-09-08T21:05:30.0955730Z | Host                        | Mac OS X 10.14.6 (18G6020)                         |
2020-09-08T21:05:30.0956190Z | Ruby Lib Dir                | ~/hostedtoolcache/Ruby/2.7.1/x64/lib               |
2020-09-08T21:05:30.0956660Z | OpenSSL Version             | OpenSSL 1.1.1d  10 Sep 2019                        |
2020-09-08T21:05:30.0957090Z | Is contained                | false                                              |
2020-09-08T21:05:30.0957560Z | Is homebrew                 | false                                              |
2020-09-08T21:05:30.0957990Z | Is installed via Fabric.app | false                                              |
2020-09-08T21:05:30.0958460Z | Xcode Path                  | /Applications/Xcode_11.3.1.app/Contents/Developer/ |
2020-09-08T21:05:30.0958890Z | Xcode Version               | 11.3.1                                             |
2020-09-08T21:05:30.0959180Z 
2020-09-08T21:05:30.0959290Z 
2020-09-08T21:05:30.0959450Z ### System Locale
2020-09-08T21:05:30.0959580Z 
2020-09-08T21:05:30.0959800Z | Variable | Value       |   |
2020-09-08T21:05:30.0960380Z | -------- | ----------- | - |
2020-09-08T21:05:30.0961020Z | LANG     | en_US.UTF-8 | ✅ |
2020-09-08T21:05:30.0961570Z | LC_ALL   | en_US.UTF-8 | ✅ |
2020-09-08T21:05:30.0961880Z | LANGUAGE |             |   |
2020-09-08T21:05:30.0962040Z 
2020-09-08T21:05:30.0962150Z 
2020-09-08T21:05:30.0962310Z ### fastlane files:
2020-09-08T21:05:30.0962510Z 
2020-09-08T21:05:30.0962730Z <details><summary>`./fastlane/Fastfile`</summary>
2020-09-08T21:05:30.0962920Z 
2020-09-08T21:05:30.0963100Z ```ruby
2020-09-08T21:05:30.0963290Z default_platform(:ios)
2020-09-08T21:05:30.0963440Z 
2020-09-08T21:05:30.0963630Z platform :ios do
2020-09-08T21:05:30.0963770Z 
2020-09-08T21:05:30.0963930Z   desc "Ios build "
2020-09-08T21:05:30.0964100Z 
2020-09-08T21:05:30.0964270Z   lane :release do
2020-09-08T21:05:30.0964460Z create_keychain(
2020-09-08T21:05:30.0964780Z   name: "iPhone Distribution: xxxx, INC",
2020-09-08T21:05:30.0965080Z   default_keychain: true,
2020-09-08T21:05:30.0966120Z   unlock: true,
2020-09-08T21:05:30.0966690Z   timeout: 3600,
2020-09-08T21:05:30.0966960Z   lock_when_sleeps: true,
2020-09-08T21:05:30.0967190Z   password:"xxxx"
2020-09-08T21:05:30.0967370Z )
2020-09-08T21:05:30.0967510Z 
2020-09-08T21:05:30.0967680Z import_certificate(
2020-09-08T21:05:30.0967920Z    certificate_path: "xxxx.cer",
2020-09-08T21:05:30.0968320Z    keychain_name: "iPhone Distribution: xxxx, INC",
2020-09-08T21:05:30.0968670Z         keychain_password:"xxxx"
2020-09-08T21:05:30.0969290Z )
2020-09-08T21:05:30.0969410Z 
2020-09-08T21:05:30.0969570Z import_certificate(
2020-09-08T21:05:30.0969880Z   certificate_path: "xxxx.p12",
2020-09-08T21:05:30.0970190Z   certificate_password: "xxxx",
2020-09-08T21:05:30.0971200Z   keychain_name: 'iPhone Distribution: xxxx, INC',
2020-09-08T21:05:30.0971570Z   keychain_password:"xxxx"
2020-09-08T21:05:30.0971830Z )
2020-09-08T21:05:30.0971940Z 
2020-09-08T21:05:30.0972080Z   end
2020-09-08T21:05:30.0972200Z 
2020-09-08T21:05:30.0972380Z end
2020-09-08T21:05:30.0972490Z 
2020-09-08T21:05:30.0972620Z ```
2020-09-08T21:05:30.0972800Z </details>
2020-09-08T21:05:30.0973230Z 
2020-09-08T21:05:30.0973530Z <details><summary>`./fastlane/Appfile`</summary>
2020-09-08T21:05:30.0973730Z 
2020-09-08T21:05:30.0973870Z ```ruby
2020-09-08T21:05:30.0974130Z app_identifier("com.xxxx.xxxx") 
2020-09-08T21:05:30.0974410Z apple_id("xxxx@xxxx.com") 
2020-09-08T21:05:30.0974910Z 
2020-09-08T21:05:30.0975120Z ```
2020-09-08T21:05:30.0975270Z </details>
2020-09-08T21:05:30.0975390Z 
2020-09-08T21:05:30.0975590Z ### fastlane gems
2020-09-08T21:05:30.0975730Z 
2020-09-08T21:05:30.0976300Z | Gem      | Version | Update-Status |
2020-09-08T21:05:30.0976960Z | -------- | ------- | ------------- |
2020-09-08T21:05:30.0977650Z | fastlane | 2.158.0 | ✅ Up-To-Date  |
2020-09-08T21:05:30.0977920Z 
2020-09-08T21:05:30.0978090Z 
2020-09-08T21:05:30.0978290Z ### Loaded fastlane plugins:
2020-09-08T21:05:30.0978480Z 
2020-09-08T21:05:30.0978680Z **No plugins Loaded**
2020-09-08T21:05:30.0978830Z 
2020-09-08T21:05:30.0978930Z 
2020-09-08T21:05:30.0979170Z <details><summary><b>Loaded gems</b></summary>
2020-09-08T21:05:30.0979360Z 
2020-09-08T21:05:30.0979900Z | Gem                       | Version      |
2020-09-08T21:05:30.0980650Z | ------------------------- | ------------ |
2020-09-08T21:05:30.0980960Z | did_you_mean              | 1.4.0        |
2020-09-08T21:05:30.0981820Z | slack-notifier            | 2.3.2        |
2020-09-08T21:05:30.0982150Z | atomos                    | 0.1.3        |
2020-09-08T21:05:30.0982430Z | CFPropertyList            | 3.0.2        |
2020-09-08T21:05:30.0982770Z | claide                    | 1.0.3        |
2020-09-08T21:05:30.0983060Z | colored2                  | 3.1.2        |
2020-09-08T21:05:30.0983380Z | nanaimo                   | 0.3.0        |
2020-09-08T21:05:30.0983670Z | xcodeproj                 | 1.18.0       |
2020-09-08T21:05:30.0984320Z | rouge                     | 2.0.7        |
2020-09-08T21:05:30.0984630Z | xcpretty                  | 0.3.0        |
2020-09-08T21:05:30.0985610Z | terminal-notifier         | 2.0.0        |
2020-09-08T21:05:30.0986350Z | unicode-display_width     | 1.7.0        |
2020-09-08T21:05:30.0986950Z | terminal-table            | 1.8.0        |
2020-09-08T21:05:30.0987410Z | plist                     | 3.5.0        |
2020-09-08T21:05:30.0987770Z | public_suffix             | 4.0.6        |
2020-09-08T21:05:30.0988110Z | addressable               | 2.7.0        |
2020-09-08T21:05:30.0988740Z | multipart-post            | 2.0.0        |
2020-09-08T21:05:30.0989100Z | word_wrap                 | 1.0.0        |
2020-09-08T21:05:30.0990080Z | tty-screen                | 0.8.1        |
2020-09-08T21:05:30.0991060Z | tty-cursor                | 0.7.1        |
2020-09-08T21:05:30.0991870Z | tty-spinner               | 0.9.3        |
2020-09-08T21:05:30.0992330Z | babosa                    | 1.0.3        |
2020-09-08T21:05:30.0993330Z | colored                   | 1.2          |
2020-09-08T21:05:30.0993930Z | highline                  | 1.7.10       |
2020-09-08T21:05:30.0994960Z | commander-fastlane        | 4.4.6        |
2020-09-08T21:05:30.0995290Z | excon                     | 0.76.0       |
2020-09-08T21:05:30.0995580Z | faraday                   | 1.0.1        |
2020-09-08T21:05:30.0995900Z | unf_ext                   | 0.0.7.7      |
2020-09-08T21:05:30.0996190Z | unf                       | 0.1.4        |
2020-09-08T21:05:30.0996520Z | domain_name               | 0.5.20190701 |
2020-09-08T21:05:30.0997480Z | http-cookie               | 1.0.3        |
2020-09-08T21:05:30.0998160Z | faraday-cookie_jar        | 0.0.7        |
2020-09-08T21:05:30.0998470Z | faraday_middleware        | 1.0.0        |
2020-09-08T21:05:30.0998760Z | fastimage                 | 2.2.0        |
2020-09-08T21:05:30.0999090Z | gh_inspector              | 1.1.3        |
2020-09-08T21:05:30.0999380Z | json                      | 2.3.0        |
2020-09-08T21:05:30.0999710Z | mini_magick               | 4.10.1       |
2020-09-08T21:05:30.1000690Z | rubyzip                   | 2.3.0        |
2020-09-08T21:05:30.1001080Z | security                  | 0.1.3        |
2020-09-08T21:05:30.1001740Z | xcpretty-travis-formatter | 1.0.0        |
2020-09-08T21:05:30.1002050Z | dotenv                    | 2.7.6        |
2020-09-08T21:05:30.1002620Z | bundler                   | 2.1.4        |
2020-09-08T21:05:30.1002990Z | naturally                 | 2.2.0        |
2020-09-08T21:05:30.1003340Z | simctl                    | 1.6.8        |
2020-09-08T21:05:30.1003970Z | jwt                       | 2.2.2        |
2020-09-08T21:05:30.1004330Z | uber                      | 0.1.0        |
2020-09-08T21:05:30.1004770Z | declarative               | 0.0.20       |
2020-09-08T21:05:30.1006410Z | declarative-option        | 0.1.0        |
2020-09-08T21:05:30.1006810Z | representable             | 3.0.4        |
2020-09-08T21:05:30.1007660Z | retriable                 | 3.1.2        |
2020-09-08T21:05:30.1008320Z | mini_mime                 | 1.0.2        |
2020-09-08T21:05:30.1008630Z | multi_json                | 1.15.0       |
2020-09-08T21:05:30.1009480Z | signet                    | 0.14.0       |
2020-09-08T21:05:30.1009910Z | memoist                   | 0.16.2       |
2020-09-08T21:05:30.1010220Z | os                        | 1.1.1        |
2020-09-08T21:05:30.1011080Z | googleauth                | 0.13.1       |
2020-09-08T21:05:30.1011660Z | httpclient                | 2.8.3        |
2020-09-08T21:05:30.1012770Z | google-api-client         | 0.38.0       |
2020-09-08T21:05:30.1013390Z | google-cloud-env          | 1.3.3        |
2020-09-08T21:05:30.1015240Z | google-cloud-errors       | 1.0.1        |
2020-09-08T21:05:30.1016060Z | google-cloud-core         | 1.5.0        |
2020-09-08T21:05:30.1016440Z | rake                      | 13.0.1       |
2020-09-08T21:05:30.1017050Z | digest-crc                | 0.6.1        |
2020-09-08T21:05:30.1017950Z | google-cloud-storage      | 1.28.0       |
2020-09-08T21:05:30.1018340Z | emoji_regex               | 3.0.0        |
2020-09-08T21:05:30.1018640Z | jmespath                  | 1.4.0        |
2020-09-08T21:05:30.1019280Z | aws-partitions            | 1.365.0      |
2020-09-08T21:05:30.1019880Z | aws-eventstream           | 1.1.0        |
2020-09-08T21:05:30.1020750Z | aws-sigv4                 | 1.2.2        |
2020-09-08T21:05:30.1021550Z | aws-sdk-core              | 3.105.0      |
2020-09-08T21:05:30.1022190Z | aws-sdk-kms               | 1.37.0       |
2020-09-08T21:05:30.1022870Z | aws-sdk-s3                | 1.79.1       |
2020-09-08T21:05:30.1023180Z | uri                       | 0.10.0       |
2020-09-08T21:05:30.1023520Z | forwardable               | 1.3.1        |
2020-09-08T21:05:30.1023810Z | logger                    | 1.4.2        |
2020-09-08T21:05:30.1024130Z | cgi                       | 0.1.0        |
2020-09-08T21:05:30.1024420Z | timeout                   | 0.1.0        |
2020-09-08T21:05:30.1024850Z | stringio                  | 0.1.0        |
2020-09-08T21:05:30.1025660Z | ipaddr                    | 1.2.2        |
2020-09-08T21:05:30.1025950Z | openssl                   | 2.1.2        |
2020-09-08T21:05:30.1026280Z | ostruct                   | 0.2.0        |
2020-09-08T21:05:30.1026570Z | strscan                   | 1.0.3        |
2020-09-08T21:05:30.1027180Z | date                      | 3.0.0        |
2020-09-08T21:05:30.1027500Z | delegate                  | 0.1.0        |
2020-09-08T21:05:30.1027790Z | fileutils                 | 1.4.1        |
2020-09-08T21:05:30.1028120Z | zlib                      | 1.1.0        |
2020-09-08T21:05:30.1028400Z | singleton                 | 0.1.0        |
2020-09-08T21:05:30.1028730Z | rexml                     | 3.2.3        |
2020-09-08T21:05:30.1029020Z | open3                     | 0.1.0        |
2020-09-08T21:05:30.1029350Z | yaml                      | 0.1.0        |
2020-09-08T21:05:30.1029640Z | psych                     | 3.1.0        |
2020-09-08T21:05:30.1030200Z | mutex_m                   | 0.1.0        |
2020-09-08T21:05:30.1030580Z | webrick                   | 1.6.0        |
2020-09-08T21:05:30.1030810Z </details>
2020-09-08T21:05:30.1030970Z 
2020-09-08T21:05:30.1031080Z 
2020-09-08T21:05:30.1031660Z *generated on:* **2020-09-08**
2020-09-08T21:05:30.1031950Z </details>
2020-09-08T21:05:30.1032760Z [21:05:30]: [33mTake notice that this output may contain sensitive information, or simply information that you don't want to make public.[0m
2020-09-08T21:05:30.1033780Z [21:05:30]: [32mOpen https://github.com/fastlane/fastlane/issues/new to submit a new issue ✅[0m

更新
还将 log_output:true 添加到 import_certificate 并显示:

security import xxxx.cer -k '/Users/runner/Library/Keychains/iPhone\ Distribution:\ xxxxx,\ INC-db' -P '' -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild

但是当我这样做时:

ls -la /Users/runner/Library/Keychains/ 

我可以看到文件:

2020-09-09T07:42:02.4193010Z drwxr-xr-x   8 runner  staff    256 Sep  9 07:42 .
2020-09-09T07:42:02.4194280Z drwxr-xr-x@ 47 runner  staff   1504 Sep  4 12:26 ..
2020-09-09T07:42:02.4195140Z -r--r--r--   1 runner  staff      0 Jan  5  2018 .fl34AC2A0A
2020-09-09T07:42:02.4195990Z -r--r--r--   1 runner  staff      0 Sep  9 07:42 .fl5C99C5E2
2020-09-09T07:42:02.4197000Z drwx------   8 runner  staff    256 Sep  9 07:16 4203018E-580F-C1B5-9525-B745CECA79EB
2020-09-09T07:42:02.4197890Z -rw-r--r--   1 runner  staff  20460 Sep  9 07:42 iPhone Distribution: xxxxx, INC-db
2020-09-09T07:42:02.4198770Z -rw-r--r--@  1 runner  staff  74416 Sep  9 07:21 login.keychain-db
2020-09-09T07:42:02.4199520Z -rw-r--r--@  1 runner  staff  81040 Jul 22  2019 login_renamed_1.keychain-db
4

0 回答 0