ios jenkins

by Agam Mahajan

通过Agam Mahajan

如何使用Jenkins和Fastlane制作iOS点播构建系统 (How to make an iOS on-demand build system with Jenkins and Fastlane)

This article is about creating iOS builds through Jenkins BOT, remotely, without the need of a developer.

本文旨在通过Jenkins BOT远程创建iOS构建,而无需开发人员。

Before starting, I want to say that this is my first article. So feel free to leave a comment if something can be improved :)

在开始之前,我想说这是我的第一篇文章。 如果可以改进,请随时发表评论:)

为什么这是个好主意? (Why is this a good idea?)

When a developer makes a feature, they QA test it before pushing it to production. So a build has to be shared with the QA team with some test configurations.

当开发人员创建功能时,他们会先对其进行质量检查,然后再将其投入生产。 因此,必须通过一些测试配置与质量检查团队共享构建。

Xcode (the IDE) takes a significant amount of time to compile and generate this build. This means that any person that needs the build would have to install the IDE, clone the repository, create a signing identity and certificate and then create the build themselves. Or depend on the developer to create one for them.

Xcode(IDE)需要大量时间来编译和生成此版本。 这意味着需要构建的任何人都必须安装IDE,克隆存储库,创建签名身份和证书,然后自己创建构建。 或者依靠开发人员为他们创建一个。

During the build creation process, the IDE is unusable. This severely impacts the productivity of the developer. In my company, the average build time of an .ipa is around 20 mins. On average, a developer makes 2–3 builds daily.This means 5 working hours a week get wasted.

在构建创建过程中,IDE不可用。 这严重影响了显影剂的生产率。 在我的公司中,.ipa的平均构建时间约为20分钟。 平均而言,开发人员每天进行2-3次构建,这意味着每周要浪费5个工作小时。

But what if there was an automated system which could generate the builds on its own? This would free the developers from this responsibility. It would also make it possible for anyone to get a build easily.

但是,如果有一个可以自行生成构建的自动化系统呢? 这将使开发人员摆脱这种责任。 这也将使任何人都可以轻松获得构建。

Jenkins is one of the solutions to our problem.

詹金斯是解决我们问题的方法之一。

Making builds easily available to testers and developers ensures that people are able to test features faster and ship to production more easily. This improves the productivity of development teams. It also improves the quality of products pushed to production.

向测试人员和开发人员轻松提供构建版本可确保人们能够更快地测试功能并更轻松地将其交付生产。 这提高了开发团队的生产力。 它还提高了推向生产的产品的质量。

现在开始吧。 (Let’s get started now.)

先决条件 (Prerequisites)

You will require:

您将需要:

  • macOS Machine (it is better to run it on Mac products)macOS机器(最好在Mac产品上运行)
  • 10 GB of drive space (for Jenkins)10 GB的驱动器空间(用于Jenkins)
  • Java 8 installed (either a JRE or Java Development Kit (JDK) is fine)

    已安装Java 8(可以使用JRE或Java开发工具包(JDK))

    Java 8 installed (either a JRE or Java Development Kit (JDK) is fine)http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    已安装Java 8(可以使用JRE或Java开发工具包(JDK)都可以) http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Additional Plugins to be installed

要安装的其他插件

  • homebrew自制
  • wgetget
  • RVM Plugin

    RVM插件

    RVM PluginInstallation guide

    RVM插件安装指南

    RVM PluginInstallation guidehttps://rvm.io/rvm/security

    RVM插件安装指南 https://rvm.io/rvm/security

Make one Branch with a file in it with the name Jenkinsfile with sample code:node { sh ‘echo HelloWorld’}Let's name it jenkins-integration. Will come back to this later.

使用示例代码在其中创建一个名为Jenkinsfile的文件的分支: node { Jenkinsfile sh 'echo HelloWorld' }其命名为jenkins-integration 。 稍后会再谈到。

  • Install Xcode on your machine from the App Store从App Store在计算机上安装Xcode
  • Install Fastlane on your machine. Jenkins will internally use fastlane commands to generate builds.在计算机上安装Fastlane。 Jenkins将在内部使用fastlane命令生成构建。

Now let’s go through it step by step.

现在,让我们逐步进行操作。

步骤1.在您的计算机上安装Jenkins (Step 1. Install Jenkins on your machine)

You can install on a MacBook or mac-mini. Mac-mini is preferred as it can be kept alive.

您可以安装在MacBook或mac-mini上。 Mac-mini是首选,因为它可以保持活动状态。

Download Jenkins -> https://jenkins.io/

下载Jenkins-&g t; https:// jenkins。 io /

Run java -jar jenkins.war --httpPort=8080 in the command line. If you’re getting an error in the terminal, try a different port (for example, 9090) as sometimes some ports are not available.

在命令行中运行java -jar jenkins.war --httpPort = 8080 。 如果终端出现错误,请尝试使用其他端口(例如9090),因为有时某些端口不可用。

Browse to http://localhost:8080 and follow the instructions to complete the installation.

浏览到http:// localhost:8080并按照说明完成安装。

Then add admin credentials and don’t forget them (as did I :P). Later you can go to Jenkins > Manage Jenkins > Manager Users and do your changes if needed.

然后添加管理员凭据,不要忘记它们(就像我:P一样)。 稍后,您可以转到Jenkins>管理Jenkins>管理员用户,并根据需要进行更改。

步骤2.创建您的第一个管道 (Step 2. Creating Your first Pipeline)

Create a new job and choose Pipeline Project.

创建一个新作业,然后选择Pipeline Project

To check out your project, under the section Pipeline, in Definition, choose Pipeline Script from SCM and in SCM choose Git

要检出您的项目,请在“ 管道 ”部分下的“ 定义”中,选择“ SCM中的管道脚本”,然后在SCM中选择“ Git”。

Then add your repo URL and add the credentials if its a private repo. In branches to build , add */jenkins-integration,the branch which we created earlier.

然后添加您的存储库URL,并在其为私人存储库的情况下添加凭据。 在build的分支中,添加* / jenkins-integration, 我们之前创建的分支。

Make sure Script Path is Jenkinsfile which we have created in our new branch. All the scripts will be written in this Jenkinsfile.

确保脚本路径是我们在新分支中创建的Jenkinsfile 。 所有脚本都将写入此Jenkinsfile中。

Click on Save and Jenkins will automatically scan your repo with the mentioned branch and will run the Jenkinsfile script.

单击“保存”,Jenkins将使用提到的分支自动扫描您的仓库,并将运行Jenkinsfile脚本。

Now we are ready to configure our Jenkinsfile to create builds

现在我们准备配置Jenkinsfile来创建构建

步骤3.将参数添加到作业 (Step 3. Add parameters to the Job)

User input is required for

需要用户输入

  • branch科
  • environment (test or prod)环境(测试或生产)

For that we need to configure our project to take input parameters for a job.

为此,我们需要将项目配置为接受作业的输入参数。

Go to the Configure section and check This project is parameterised.Then select add parameter and add the same accordingly.

转到“ 配置”部分,然后检查“ 此项目已参数化” 然后选择添加参数并相应地添加。

When you click on save, you will see a new section on left side -> Build with Parameters. This will be the user interface to make builds.

当您单击保存时,您将在左侧看到一个新部分-&g t;。 用参数生成 。 这将是进行构建的用户界面。

These params will be used in our Jenkins script.

这些参数将在我们的Jenkins脚本中使用。

步骤3.配置Jenkins脚本 (Step 3. Configure Jenkins Script)

Will create multiple steps in our Jenkinsfile, each having one responsibility, and it will create a nice UI when it is built.

将在我们的Jenkinsfile中创建多个步骤,每个步骤都有一个职责,并且在构建时会创建一个漂亮的UI。

Go to your Jenkinsfile and replace the script with the following:

转到您的Jenkinsfile并将脚本替换为以下内容:

First, check out the branch through the parameter which we added earlier. Add your repo and GitHub token.

首先,通过我们之前添加的参数检出分支。 添加您的仓库和GitHub令牌。

Now the GitHub token should not be visible to others. To do this, go to Manage Jenkins-> Configure System ->Global properties and add githubToken as an environment variable.

现在,GitHub令牌对其他人不可见。 为此,请转到Manage Jenkins- &g t;。 配置系统 ->全局属性,并添加github令牌作为环境变量。

Then invoke the script to change the environment.

然后调用脚本以更改环境。

Next, invoke fastlane to clean (remove derived data, clean, delete .dsym files etc).

接下来,调用fastlane进行清理(删除派生数据,清理,删除.dsym文件等)。

If code signing is required, do that next using ad-hoc. You can use development or app store based on your needs.

如果需要代码签名,请使用ad-hoc接下来进行。 您可以根据需要使用开发应用商店

Next, create builds using the gym command in fastlane.

接下来,使用fastlane中的gym命令创建构建。

步骤4.运行作业 (Step 4. Run the Job)

Now our script is ready. Go to Jenkins and open Build with Parameters.

现在我们的脚本已经准备好了。 转到Jenkins并打开Build with Parameters。

It will start to run the script and will create a nice UI with multiple steps as mentioned in the Jenkinsfile.

如Jenkinsfile中所述,它将开始运行脚本并创建具有多个步骤的漂亮UI。

When the job is completed, go to the project Users/agammahajan/.jenkins/workspace/iOS_Build_Systemsand you will see that the .ipa has been created. Voilà!

作业完成后,转到项目Users / agammahajan / .jenkins / workspace / iOS_Build_Systems ,您将看到已创建.ipa 。 瞧!

Now you can share this build with others. You can use the Slack plugin to upload the builds to Slack if you want.

现在,您可以与其他人共享此构建。 如果需要,可以使用Slack插件将内部版本上传到Slack。

结语 (Wrapping up)

So to conclude here, we can see how easy it is to setup an automated bot which enables any person to trigger builds in just 2 steps: Give Branch->Test Environment-> Done.

因此,在这里总结一下,我们可以看到设置一个自动化的bot有多么容易,它使任何人都可以通过两个步骤触发构建:提供分支->测试环境->完成。

This has helped me and my fellow developers improve productivity and ship faster. It has also helped the QA team, so that they don’t have to depend on developers every time they need to test something. I hope it benefits you and your company also.

这帮助我和我的其他开发人员提高了生产率并加快了发货速度。 它也为质量检查团队提供了帮助,因此他们不必在每次需要测试某些东西时都依赖开发人员。 我希望它也能使您和您的公司受益。

From here, the possibilities are endless.

从这里开始,无限的可能性

  1. You can make scheduled jobs to generate nightly builds.您可以进行计划的工作以生成夜间版本。
  2. Upload builds directly to the App Store.将内部版本直接上传到App Store。
  3. Cache the builds, so builds with the same configuration are not generated again.缓存构建,因此不会再次生成具有相同配置的构建。
  4. Distributing the IPA in house for OTA (Over the air) installation.内部分发IPA以进行OTA(无线)安装。
  5. Make a CI-CD pipeline to run automated tests on every commit and make them production ready.建立CI-CD管道以对每个提交运行自动化测试,并使其准备就绪。

翻译自: https://www.freecodecamp.org/news/how-to-make-an-ios-on-demand-build-system-with-jenkins-and-fastlane-8eb1e02c73d1/

ios jenkins

ios jenkins_如何使用Jenkins和Fastlane制作iOS点播构建系统相关推荐

  1. iOS自动化部署方案Jenkins Fastlane code.aliyun 蒲公英 appStore

    使用初衷 公司产品版本比较多,很多版本都需要独立化部署.导致产生了每个地址需要打包,每次打包就是一件麻烦的事情,常常一下午的时间过去了却都浪费在打包这件事情上了.So-.研究了下Fastlane.爬了 ...

  2. Fastlane为iOS带来持续部署

    Fastlane是一组工具套件,旨在实现iOS应用发布流程的自动化,并且提供一个运行良好的持续部署流程,只需要运行一个简单的命令就可以触发这个流程. Fastlane是一个ruby脚本集合,其中囊括了 ...

  3. 使用 fastlane 实现 iOS 持续集成

    使用 fastlane 实现 iOS 持续集成 2015-09-16 09:06 编辑: suiling 分类:iOS开发 来源:everettjf  0 3494 iOSfastlane持续集成 招 ...

  4. 在linux中制作IOS文件

    1.从光盘中制作ISO文件: 把光盘放入光驱中(注意不需要挂载光盘) 格式:cp  /dev/cdrom  ISO文件名 执行下列命令: #cp  /dev/cdrom  mycd.iso 可以使用f ...

  5. 推荐一个制作ios图标的网站

    在线制作ios图标,非常方便实用: http://makeappicon.com

  6. 开发者分享在PC上制作iOS游戏的经验(下)

    开发者分享在PC上制作iOS游戏的经验(下) 发布时间:2013-05-01 09:48:18  Tags: AI, 市场营销, 手势, 测试, 游戏平衡 简介 这时候我们已经创造了一款可行的游戏,即 ...

  7. 带交互的 iOS 产品原型可以用什么软件制作?

    摘自知乎http://www.zhihu.com/question/20326729 来源:知乎 著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 首先如果你小团队或者个人开发,当 ...

  8. fastlane 进行 ios 构建

    雁过留声,人过留名,做过留博.这是一篇关于如何用fastlane进行ios打包等操作的流程小记. 1.fastlane 安装,自行移步百度,无非就是ruby环境问题,还有翻墙的问题,这里不再赘述. 2 ...

  9. 开发者分享在PC上制作iOS游戏的经验(上)

    开发者分享在PC上制作iOS游戏的经验(上) 发布时间:2013-04-30 08:55:54  Tags: Marmalade, 原型, 对象层级结构, 用PC制作iOS游戏, 设计 作者:Thom ...

最新文章

  1. ios linux时间戳转时间,将UNIX时间戳转换为数据 – iOS
  2. jQuery基础:下(事件及动画效果)
  3. 消防信号总线原理_建筑电气消防设计6大常见问题分析
  4. cacti监控添加thold插件
  5. Centos设置程序开机自启的方法
  6. wince2秒快速启动TOC分析
  7. python取两个列表的并集、交集、差集
  8. swift语言 编写 ios开发 第一个程序hello world!
  9. 华为设备堆叠原理和配置
  10. 模拟实现memcpy、memmove函数
  11. excel导出动态表头以及二级三级表头,还有数据库动态的数据来源
  12. 采集rtsp流摄像头到浏览器实时播放方案
  13. 【职场】大公司想招程序员,一般都在什么网站上进行招聘呢?
  14. 如何加强水电站班组安全建设?
  15. 字母数字特殊字符部分unicode对照表
  16. 算法设计课第十周作业
  17. 写给初学者的Python与pip安装教程
  18. 这些Linux技能你会了,面试官:哎呦小伙子不错哦!
  19. implicit feedback
  20. Java版工程行业管理系统源码-专业的工程管理软件-提供一站式服务

热门文章

  1. HTML如何添加锚点,文末领取面试资料
  2. 淘淘商城之技术选型、开发工具和环境、人员配置
  3. 关于如何在Python中使用静态、类或抽象方法的权威指南
  4. winfrom 点击按钮button弹框显示颜色集
  5. 学习Spring Data JPA
  6. Oracle【IT实验室】数据库备份与恢复之二:SQL*Loader
  7. 快速排序——算法系列
  8. VBScript数组函数
  9. mysql实战33 | 我查这么多数据,会不会把数据库内存打爆?
  10. 认证鉴权与API权限控制在微服务架构中的设计与实现(一)