Open Adam-Beno opened 3 months ago
I encountered the same issue, when i am using runner as service
, i got error like this:
CodeSign /Users/administrator/path/to/target.appex (in target 'target' from project 'project' at path '/Users/administrator/path/to/project.xcodeproj')
cd xxx
Signing Identity: "Apple Development: xxx xx (XXXXXXX)"
Provisioning Profile: "iOS Team Provisioning Profile: com.xxx.xxx"
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
/usr/bin/codesign --force --sign XXXXXXXXXXXXXXXXXXXXX --entitlements /Users/administrator/xxxx.appex.xcent --generate-entitlement-der /Users/administrator/xxxx.appex
/Users/administrator/xxxx.appex: errSecInternalComponent
Command CodeSign failed with a nonzero exit code
But when i am using ./run.sh
in terminal directly, everything is fine.
@Adam-Beno, I managed to code-signing when running runner as a service, i just tried unlocking login keychain (my signing key is on the login keychain) before running the xcodebuild cmd, and it works! Here's my code:
# ....
print("unlocking login keychain...")
# check if there is a file named login.keychain-password in the LOGIN_KEYCHAIN_PASSWORD_PATH
login_keychain_password_path = LOGIN_KEYCHAIN_PASSWORD_PATH.joinpath(
"login.keychain-password"
)
if login_keychain_password_path.exists():
keychain_password = login_keychain_password_path.read_text().strip()
if keychain_password:
print("unlocking login keychain with password...")
subprocess.run(
[
"security",
"unlock-keychain",
"-p",
keychain_password,
"login.keychain",
],
check=True,
)
else:
print("unlocking login keychain without password...")
subprocess.run(
[
"security",
"unlock-keychain",
"login.keychain",
],
check=True,
)
else:
print("login.keychain-password file not found, don't unlock login keychain")
## ....
print("cleaning...")
subprocess.run(
[
"xcodebuild",
"clean",
"-project",
XCODE_PROJECT_PATH,
"-scheme",
scheme,
"-derivedDataPath",
derived_data_path,
"-resultBundlePath",
xcode_result_bundle_path("build_clean"),
# *xcodebuild_authenticate_args,
],
check=True,
env=env,
)
print("archiving...")
subprocess.run(
[
"xcodebuild",
"archive",
"-project",
XCODE_PROJECT_PATH,
"-scheme",
scheme,
"-configuration",
build_configuration,
"-sdk",
"iphoneos",
"-destination",
"generic/platform=iOS",
"-archivePath",
archive_path,
"-derivedDataPath",
derived_data_path,
"-resultBundlePath",
xcode_result_bundle_path("build_archive"),
"-showBuildTimingSummary",
*xcodebuild_authenticate_args,
],
check=True,
env=env,
)
I encountered the same problem when using svc.sh
to start runner.
After looking at the code of run.sh
and svc.sh
, I found that run.sh
updates ca certificates, but svc.sh
does not update.
In order to perform xcode compilation normally, you can only use run.sh
to start runner.
Describe the bug Runner fails xcode signing step while being run as a service via
./svh.sh start
, however while using the runner via./run.sh
the job completes successfullyTo Reproduce
./svc.sh install
>./svc.sh start
Expected behavior Using runner as service should result in the same output as using the runner via the run command.
Runner Version and Platform
System
Runner
Gemfile
What's not working?
xcodebuild fails on signing step for the first native module of a RN app. There is not really an explanation on why. Here is a rundown of things I tried to fix the issue
Note: This whole time I was able to compile the app both in XCode and by manually executing the fastlane
1. Restarting mac mini (i know i know.. its a meme but you never know)
2. Switching between automatic and manual signing
Signing is the usual culprit when building iOS apps via CI but doing any changes had no effect on the archive error.
Initially I used automatic signing from XCode by enabling it in XCode on the project itself and in Gymfile via
Next I tried switching over to manual signing using Match and modifying the fastlane configs accordingly, yet the app still won't build
3. Configure fastlane to use different keychain
I noticed in the docs for fastlane they recommend adding
setup_ci
setup_ci to resolve potentional keychain issues but this had no effect on the error either.4. Upgraded Ruby
Initially I used the system provided Ruby but then I found a similar error online and someone mentioned that upgrading Ruby fixed it for them. So I ended up using Ruby
2.7.7
viarvm
.Job Log Output
Fastlane Output
Configs
Workflow
Fastfile
Appfile
Gymfile
Conclusion
I intially thought it's the service being unable to reach the keychain but after setting up the
setup_ci
step in fastlane and it having access to the chain + being able to write the certs I really have no idea what could be causing this issue. Maybe it's just xcode being xcode again...At least I can still use the pipeline with
./run.sh
to keep my autobuilds going 🙏