美文网首页
Jenkins持续集成-Xcode

Jenkins持续集成-Xcode

作者: 大林宝子 | 来源:发表于2017-09-01 17:22 被阅读0次

    Jenkins插件配置

    安装jenkins,jsnkins推荐插件

    XCode插件

    Keychain and Provisioning Profiles Management

    代码管理插件,根据需求添加,这里是gitlab相关插件

    源码管理

    gitlab管理源码:如果项目访问级别是public,则可以使用用户名名+密码的方式,如果是private级别,则需要使用sshkey的方式(sshkey配置-自行搜索,比较简单)

    构建环境

    构建环境,这里使用的是Keychains and Code Signing Identities。

    首先在系统管理界面,点击Keychains and Provisioning Profiles Management进入keychains配置界面.

    1.上传login.keychain钥匙串.

    如果系统文件夹下是login.keychain-db,则将系统文件下的keychain文件夹拷贝到Jenkins home文件夹下,keychain文件改名为login.keychain

    上传login.keychain

    2.上传provisions文件

    将MobileDevice文件夹拷贝到jenkins library文件夹下,拖拽provision文件到输入框中,生成路径

    provision文件配置

    3.Keychains and Code Signing Identitieskeychain选择文件及证书

    4.Mobile Provisioning Profiles选择provision文件

    构建

    1.General build settings

    设置target名称

    Configuration:Release包

    Export method签名方式:development,

    output directory输出目录:${WORKSPACE}/build/

    2.Code signing & OS X keychain options

    Development Team:team id,开发者账号上看

    keychain path:拖动login.keychain到输入框中生成

    keychain password:电脑登录密码

    3.Advanced Xcode build options

    xcode scheme file: 同target名称

    xcode workspace file:同target名称

    build output directory: 输出目录,同上

    4.上传蒲公英

    点击 新增构建步骤,添加execute shell

    # 工程名

    APP_NAME="ipa包名,同上打包的包名"

    #userKey和apiKey需要在蒲公英的账号设置中查找

    userKey=""

    apiKey=""

    #蒲公英打包,ipa路径

    curl -F "file=@${WORKSPACE}/build/${APP_NAME}.ipa" \

    -F "uKey=${userKey}" \

    -F "_api_key=${apiKey}" \

    -F "updateDescription=$DESCRIPTION" \

    -F "isPublishToPublic=2" \

    http://www.pgyer.com/apiv1/app/upload

    其他报错

    1.缺少scheme

    xcodebuild: error: The project named “Foo” does not contain a scheme named “Bar”. The “-list” option can be used to find the names of the schemes in the project.

    解决方法:

    Choose Scheme > Manage Schemes (from the Product Menu).

    Ensure the ‘Shared’ box is checked for that scheme

    A new .xcscheme file has been created in your project at

    WorkspaceName.xcworkspace/xcshareddata/xcschemes.

    Commit this file to your repository

    2.源码管理报错

    仓库的url分两种:http/ssh

    a.如果使用ssh key方式,就把生成的ssh key添加到gitlab中,然后使用ssh的地址,不能使用http的地址

    b.如果使用http的地址,需要用户名、密码验证

    ssh生成:www.jianshu.com/p/d400a5a43ff7

    3.keychain权限报错

    Frameworks/AFNetworking.framework: unknown error -1=ffffffffffffffff

    Command /bin/sh failed with exit code 1

    解决办法:

    security set-key-partition-list -S apple-tool:,apple: -s -k 电脑密码 /Users/电脑名称/Library/Keychains/login.keychain-db

    进入钥匙串,找到对应证书,右键简介,进入访问控制

    相关文章

      网友评论

          本文标题:Jenkins持续集成-Xcode

          本文链接:https://www.haomeiwen.com/subject/awskjxtx.html