我们的自动构建在Jenkins上运行.构建本身在从属服务器上运行,从服务器通过SSH执行.
我收到一个错误:
00:03:25.113 [codesign-app] build/App.app: User interaction is not allowed.
Run Code Online (Sandbox Code Playgroud)
我已经尝试了迄今为止我在其他帖子中看到的所有建议:
在所有情况下,我都会得到同样的错误.
为了诊断问题,我尝试在我的本地终端上运行"security unlock-keychain"命令,发现它实际上并没有解锁钥匙串 - 如果我查看Keychain Access,锁定符号仍然存在.无论我是在命令行上传递密码还是让它提示我,都是这种情况.使用GUI解锁相同的钥匙串将提示我输入密码然后解锁.另外,如果我运行"security lock-keychain",我会在运行命令后立即看到键锁.这让我觉得解锁钥匙串实际上并不起作用.我在Lion(我们用于构建奴隶)和Mavericks(我正在开发)上遇到相同的行为.
接下来,我尝试将-v添加到所有安全命令:
list-keychains "-d" "system" "-s" "/Users/tester/.secret/App.keychain"
Listing keychains to see if it was added: ((
"/Library/Keychains/System.keychain"
))
unlock-keychain "-p" "**PASSWORD**" "/Users/tester/.secret/App.keychain"
build/App.app: User interaction is not allowed.
Run Code Online (Sandbox Code Playgroud)
从这看起来,列表 - 钥匙链似乎是不起作用的.也许都不行.:/
这里有一个类似的问题.解决方案很有趣 - 在launchctl中将"SessionCreate"设置为true.但我不是在master上构建 - 我的构建过程是从一个slave构建机器上的SSH启动的.也许有一种命令行方式可以在运行"SessionCreate"时执行launchctl正在执行的操作?
从macOS Sierra开始,我无法在没有usr/bin/codesign UI的情况下使用/ usr/bin/security将codeign-identity导入到钥匙串中,以便在使用此标识时提示访问.这打破了构建服务器的打包脚本.似乎没有解决方法.这会影响自定义创建的钥匙串,但也会影响login.keychain.
重现步骤:在终端中执行以下命令(要求签名标识可用于导入):
security create-keychain -p test buildagent.keychain
security unlock-keychain -p test buildagent.keychain
security list-keychains -d user -s buildagent.keychain
security default-keychain -s buildagent.keychain
security import identity.p12 -k buildagent.keychain -P password -T /usr/bin/codesign
codesign -vfs '$IDENTITY' '${PRODUCT}' --keychain 'buildagent.keychain'
Run Code Online (Sandbox Code Playgroud)
结果:macOS显示UI提示,要求获得访问先前导入的私钥的权限.
我尝试了很多解决方法,但似乎没有任何工作:
导入身份肯定有效,我可以在Keychain Access应用程序中显示钥匙串的内容时看到证书和密钥.私钥的访问控制设置也已正确配置(使用所需的代码签名例外规则).
如何避免来自Sierra的UI提示?
在我的公司,我们使用Jenkins Git Plugin(2.4.2)和Git LFS(1.1.2)针对我们的内部GitHub Enterprise实例建立了Jenkins CI系统.尽管存储在Jenkins中的有效凭证使用全局配置的凭证存储在Mac从站上,但检查存储库始终以此失败结束:
Caused by: hudson.plugins.git.GitException: Command "git checkout -f ___my_commit_hash___ returned status code 128:
stdout:
stderr: Downloading ___my_lfs_file___ (754 B)
Error accessing media: ___my_lfs_file___ (___my_lfs_file_hash___)
Errors logged to .git\lfs\objects\logs\___my_lfs_log___.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge %f failed 2
error: external filter git-lfs smudge %f failed
fatal: ___my_lfs_file___: smudge filter lfs failed
Run Code Online (Sandbox Code Playgroud)
并且git日志显示:
Git credentials for https://git.mycompany.com/myrepository.git not found.
Run Code Online (Sandbox Code Playgroud)
要么:
Bad Credentials
Run Code Online (Sandbox Code Playgroud)
当我登录到奴隶并直接运行命令时,一切正常; 只有Jenkins从属进程才会触发错误.这也似乎只影响我们的Mac奴隶,Windows奴隶使用存储的凭据并正确运行Git LFS.如何配置Git插件以在Mac从站上正确运行Git LFS?
在 MacOSX 上,如果我 ssh 进入并运行命令:
security -v unlock-keychain -p <password> <keychain_path>
Run Code Online (Sandbox Code Playgroud)
钥匙链解锁,世界一切都好。
如果我将相同的命令放入 bash 脚本并运行
bash test.sh
Run Code Online (Sandbox Code Playgroud)
我被提示输入密码。
我怎样才能解决这个问题?
我正在尝试通过 ssh 使用 xcodebuild 命令运行 iOS 测试。当我尝试运行那些构建和运行 iOS UI 测试的命令时,我遇到以下错误。
注意:我在通过 ssh 解锁的机器上拥有所有钥匙串。
命令
HOME=/Users/mcj xcodebuild build-for-testing -project ios/ios_test_app/HXKPIIOS/HXKPIIOS.xcodeproj -scheme HXKPIIOS -destination 'platform=iOS,id=d623bacb04507071723fe1286c148edb822d5422' -derivedDataPath /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data| tee /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/uitest/build1.log
Run Code Online (Sandbox Code Playgroud)
错误
/usr/bin/codesign '-r-' '--display' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib: code object is not signed at all
Codesigning /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib
/usr/bin/codesign '--force' '--sign' '<code sign identity>' '--verbose' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib: unknown error -1=ffffffffffffffff
error: Task failed with exit 1 signal 0 {
/usr/bin/codesign '--force' '--sign' '<code sign identity>' '--verbose' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
}
** TEST BUILD FAILED **
The following build …Run Code Online (Sandbox Code Playgroud) macos ×4
ssh ×3
ios ×2
jenkins ×2
bash ×1
code-signing ×1
codesign ×1
git ×1
git-lfs ×1
keychain ×1
macos-sierra ×1
xcode ×1
xcodebuild ×1