[SWIFT] When I renew the certificate with CircleCI × fastlane, I get an exit status: 65 error.

Background

At the current site, circleCI moves at the timing when it is committed to the develop branch, Fastlane moves, and it is uploaded to deployGate. When I renewed the certificate, for some reason fastlane crashed with ʻExit status: 65`.

When I sshed to CircleCI and looked at the log, it seemed that the codesign was down with a ʻerrsec internal component` error.

What i did

Add authority to p12 file registered in circleCI

Double-click the target private key in the keychain app → Access control → Add / usr / bin / codesign and xcode to the always allowed list.

Reference: https://qiita.com/sekitaka_1214/items/61d68d603ee1c1b7adf1

Unlock the keychain

Connect to CircleCI with ssh and hit the ↓ command. security unlock-keychain login.keychain

See also: https://stackoverflow.com/questions/24023639/xcode-command-usr-bin-codesign-failed-with-exit-code-1-errsecinternalcomponen

These two did not solve the problem. ..

Solution

As a result of various thoughts, it seems that the new certificate has changed from the old certificate and the intermediate certificate (Apple Worldwide Developer Relations Certification), and the problem was that CircleCI could not read the new intermediate certificate.

Correspondence contents

  1. Download the intermediate certificate (.cer).
  2. Base64-encode the intermediate certificate and set it in CircleCI as an environment variable. base64 -i (intermediate certificate) | pbcopy (This time, I set it as APPLE_RELATION_CERT.)
  3. Decode the intermediate certificate on CircleCI.

yml:.circleci/config.yml


- run: 
   name: Decode releation certificates
   command: base64 -D -o AppleWWDRCAG3.cer \<<< $APPLE_RELATION_CERT
  1. Register the intermediate certificate in your keychain with Fastlane.

fastlane/Fastlane


import_certificate(
  keychain_name: ENV["MATCH_KEYCHAIN_NAME"],
  keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"],
  certificate_path: 'AppleWWDRCAG3.cer',
  certificate_password: ''
)

This worked!

Summary

I got stuck in this bug for a whole day. .. If anyone knows how CircleCI or fastlane can read the new intermediate certificate, please let me know (> _ <)

I did my best to deal with this, so please LGTM if you like ᕦ (ò_óˇ) ᕤ

Recommended Posts

When I renew the certificate with CircleCI × fastlane, I get an exit status: 65 error.
I get an error when adding a dependency
When I bcrypt with node + docker, I got an error
A memo when "I do not get a certificate error with a self-signed certificate using Java's Keytool"
I found no way to get the error code when I received an exception on Android
I get a 404 error when testing forms authentication with Spring Security
I get an error with bundle install and puma cannot be installed.
I want to display an error message when registering in the database
I get an error when I try to use "^" or "$" in ruby ​​regular expression
When I try to run docker-compose, I get the error "Cannot locate specified Dockerfile: Dockerfile"
Send an email when an ERROR level log occurs with the logback SMTP Appender
I got an error when I ran rake routes.
[JavaScript] I can't get the response body at the time of error with axios (ajax)
The story when the container does not start up with docker-compose up and an error occurs
I have a question. I get an error when playing a video in Listview on android.
I get Mysql2 :: Error :: ConnectionError in the production environment
[Rails] What to do if you can't get an error message with the errors method
I got an error when using nextInt, nextLine and substring.
I got an InvalidUseOfMatchersException when using any with JUnit Mock
I want to make the frame of the text box red when there is an input error