且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Ubuntu Linux上使用Jenkins构建iOS项目

更新时间:2023-10-15 18:24:58

xcodebuild 工具是来自Apple的Xcode SDK的一部分 - 它只能在Mac OS X上下载。

您不能简单地使用官方iOS工具在未运行OS X的计算机上构建。

The xcodebuild tool is part of the Xcode SDK from Apple — it's only available for download on Mac OS X.
You cannot simply use the official iOS tools to build on a computer that isn't running OS X.

这意味着,如果您有一个构建iOS应用程序的Jenkins作业,必须在Mac上构建。

This means that, if you have a Jenkins job which builds an iOS app, it must be built on a Mac.

然而,意味着Jenkins必须安装在Mac上。 Jenkins支持分布式构建,您可以拥有多台具有不同操作系统的计算机,并且可以指示Jenkins在哪台机器上运行某个版本。

This does not mean, however, that Jenkins must be installed on a Mac. Jenkins supports distributed builds, whereby you can have multiple machines, with different operating systems, and you can instruct Jenkins on which machine a certain build should run.

例如,因为你已经有一台Ubuntu机器作为你的Jenkins主服务器,你可以简单地将Mac添加为构建节点。然后,Jenkins master将通过SSH与构建节点(Mac)进行通信。在该构建节点的配置中,您应该添加一个标签,例如xcode,表示已安装Xcode SDK。

For example, as you already have a Ubuntu machine as your Jenkins master server, you can simply add a Mac as a build node. The Jenkins master would then communicate with the build node (Mac) via SSH. In the configuration for that build node, you should add a label, e.g. "xcode", to signify that the Xcode SDK is installed.

在Jenkins作业配置中,有一个名为限制此项目可以运行的位置的选项,其中你可以告诉詹金斯它可能只在具有给定标签的节点上构建这个作业。在这种情况下,您只需输入xcode,作业将始终在适当的Mac上构建,而不是在Ubuntu机器上构建。

In the Jenkins job configuration, there is an option called "Restrict where this project can be run", where you can tell Jenkins that it may build this job only on a node with a given label. In this case, you would just enter "xcode", and the job would always be built on an appropriate Mac, rather than on the Ubuntu machine.