bash Jenkins 和配置文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21990501/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 09:40:28  来源:igfitidea点击:

Jenkins and provisioning profiles

iosbashbuildjenkins

提问by mmmm

I'm trying to set my MAC to connect to Jenkins and be ready to build automatically. I've managed to create service that connects to Jenkins, but something is wrong.

我正在尝试将我的 MAC 设置为连接到 Jenkins 并准备好自动构建。我已经设法创建了连接到 Jenkins 的服务,但是出了点问题。

This is my plist file:

这是我的 plist 文件:

<key>Label</key>
    <string>com.example.ci</string>
    <key>ProgramArguments</key>
    <array>
        <string>sh</string>
        <string>/Users/Shared/Jenkins/Home/my_scripts/run_jenkins.sh</string>
    </array>
    <key>KeepAlive</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/Users/Shared/Jenkins/Home/stdout.log</string>
    <key>StandardErrorPath</key>
 <string>/Users/Shared/Jenkins/Home/error.log</string>

this is my run_jenkins.sh:

这是我的 run_jenkins.sh:

cd /Users/Shared/Jenkins/Home/
sudo -u jenkins java -jar slave.jar -jnlpUrl http://secret.mission:8080/computer/ios-slave/slave-agent.jnlp -secret 841557ed7843ac76fe1618e375

PROBLEM:

问题:

 $ /usr/bin/security find-identity -p codesigning -v
     0 valid identities found

this happens when I try to build right after start-up. Of course after that build fails.

当我尝试在启动后立即构建时会发生这种情况。当然在那之后构建失败了。

When I go sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plistand then sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plistthe result is :

当我去sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist然后sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist结果是:

$ /usr/bin/security find-identity -p codesigning -v
  [.. ]
     4 valid identities found

and build is succeeded. Why is that MAC can't find those profiles when it runs from start-up and how to fix this?

并且构建成功。为什么 MAC 在启动时无法找到这些配置文件以及如何解决此问题?

EDIT

编辑

I've edited my plist file:

我已经编辑了我的 plist 文件:

    <key>UserName</key>
    <string>jenkins</string>
    <key>Label</key>
    <string>com.example.ci</string>
    <key>ProgramArguments</key>
    <array>
        <string>sudo</string>
        <string>-u</string>
        <string>jenkins</string>
        <string>/usr/bin/java</string>
        <string>-Djava.awt.headless=true</string>
        <string>-jar</string>
        <string>/Users/Shared/Jenkins/Home/slave.jar</string>
        <string>-jnlpUrl</string>
        <string>http://secret.mission:8080/computer/ios-slave/slave-agent.jnlp
</string>
        <string>-secret</string>
        <string>841557ed7843ac76fe1618e375
</string>
    </array>
    <key>KeepAlive</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/Users/Shared/Jenkins/Home/stdout.log</string>
    <key>StandardErrorPath</key>
    <string>/Users/Shared/Jenkins/Home/error.log</string>

and still same situation...

还是一样的情况...

回答by sti

Use the Xcode plugin and read it's documentation, especially this bit: https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin#XcodePlugin-Signing

使用 Xcode 插件并阅读它的文档,尤其是这一点:https: //wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin#XcodePlugin-Signing