The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary

Preface


Continuous integration is an important part of agile development, in order to ensure the development of new features, but also to ensure the maintenance of the old features, from a sprint to the next sprint. The continuous integration tool is one of the most popular tools we can use to ensure the development and maintenance of parallelism:

1.Jenkins

2.Buildbot

3.Travis CI

After comparison, Jenkins tool to build a relatively simple (only refers to the installation), packaging speed is also faster, get a lot of friends of all ages, so this article is to describe the Jenkins build environment for the purpose. (stepped on a lot of pits ha ha ha ha)

Benefits of Jenkins

Before writing this article, I think it is necessary to mention the benefits of Jenkins to a team.

The most simple and crude benefits is to reduce the coupling development team and the test team, Jenkins also supports automatic packing, upload, modify, save configuration compile connecting device, run the packaging – – with ipa– and then to test personnel waiting for these simple steps. Also avoid testing the wrong packet, such as the development of the bug has been modified to fight back this problem.

Note: packaged IPA packages need to have a Xcode environment, so in order to configure the Windows server in the company’s iOS environment, requiring the server must be Mac OS system, Linux and can only pull aside. I was in a Mac Mini with the environment.

Steps can be roughly divided into the following steps:

1 build Java environment

2 build Jenkins environment

3 configuration certificate and description file, key string

4 configuration project

5 configure the Xcode environment

1 configure the Java environment


Mac browser to open http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html OS installation package to download, JDK are easy to install, the installation process is omitted here.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
JDK

2 build Jenkins environment


The browser to open Jenkins website click to download the Jenkins, select the Mac OS installation package, I installed 2.46.1

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
select Jenkins installation package

The next step is to fool the next installation, here is not a map.

After installing the browser will automatically open http://localhost:8080, if you do not open the link can be automatically opened manually, then provided the following error message

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
unlock Jenkins

As the name suggests, we want to go to the log path to get password, enter to enter the Jenkins. Right Finder-> go to folder -> enter /Users/Shared/Jenkins/Home enter should see below

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
Jenkins PSD

See the secrets file is a minus sign, right click the secrets-> -&gt display; share and -&gt permissions; everyone permissions to read and write.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
secret permissions

Double click on the secrets should be shown as follows:

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
initialAdminPassword

Similarly, because we do not have the right to read and write initialAdminPassword can not be opened, the right initialAdminPassword-> display profile -> everyone permissions to read and write

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
initialAdminPassword permissions

Then use the text to open initialAdminPassword, the inside of the string of digital copy, this string of numbers to fill the page Jenkins to start, if you accidentally close the page above, can open the http://localhost:8080.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
unlock

Then continue, then you will see the following page, select the red box in the Install suggested plugins (Jenkins recommended installation of plug-ins)

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
customize Jenkins

After seeing this page, wait for Jenkins to download the plugin

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
download Plugin

Create a Admin User here, after these items are completed on the OK finish and click save. Remember to remember the user name and password, after you log in to use, forget the password on the trouble.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
user name and password

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
ready

This step has been shown that the Jenkins environment has been set up. Click start using Jenkins

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
into the Jenkins page

At this point need to configure the plug-in, the system management -> management plug-in -&gt

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
plugin management first step

Because the project is configured for SVN manager, GIT management code can refer to other students to configure the tutorial. We first download the SVN plug-in, enter the SVN in the filter input box, tick SVN Publisher plugin. Click install.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
plugin management -svn

Similarly, we have to download the Xcode integration and keychains Provisioning Profiles Management these two plug-ins, and.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
plugin management -xcode integration

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
plugin management – keychain and profiles

The two search, check and then directly install. Then wait to finish

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
waiting for plug-in installation to complete

After the installation is completed, we restart the next Jenkins, reload the plugin. Can slide to the bottom of the check restart, or it can be entered in the address bar of http://localhost:8080/restart

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
to complete the installation plug-in restart Jenkins

After the restart should enter the user name and password, the user name of the password has just been registered into.

There is also an important step, we first give the Jenkins administrator privileges to avoid subsequent access to the problem.

System preferences set -> user and group -> point lock, and then check the Jenkins user to allow users to manage this computer”.

This step is best to set up a password for the Jenkins user, to facilitate the latter check whether the Jenkins configuration error or check code error.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
Jenkins user rights issues

3 configuration certificate and description file, key string


Click system management -> keychain provision Profiles and Management

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
keychain and provision

Prior to this, I prepared the development certificate.P12 + description file, the production certificate.P12 + description files, respectively, for on-line packaging and test package. This step does not require us to upload certificates, but upload the files and login.keychain. Login.keychain pit! Have pit! Have pit!!!!! Before I was to copy the login.keychian to the desktop and then upload, when the building is always wrong Keychian permissions. Then I did the following.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
configuration Keychain certificate and description file

Prior to the popularity of the first look, Jenkins is actually a user opened their own, used to store some configuration files and information. We can find the folder for Jenkins users in finder, and click on the folder

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
looking for upper folder

Then find the shared Jenkins user

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
Jenkins directory

1.Finder-> go to folder -> /Users/ “your Mac username” /library

2 find the keychains folder, copy

3 with the above method to Jenkins-> Library folder

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
copy Keychain file

In order to avoid similar errors found in the description file, we also copy the description file to the Jenkins user -> Library.

1.Finder-> go to folder -> /Users/ “your Mac username” /library (or there is a method to open xcode-> preferences-> find the description file under your account)

2 find the keychains folder and copy the entire folder MobileDevice

3 with the above method to Jenkins-> Library folder.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
copy mobileDevice file

The next step is to upload the keychain and the description file.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
upload keychain and description file

Here we choose just copy the past Jenkins file directory keychain and description file. Click to select the file -> search login.keychain, here to pay attention to whether the Jenkins directory under the keychain.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
upload Keychain

After uploading the key to open, I need to upload the two certificate to the name, because I want to upload a development certificate and a production certificate, so upload two. Copy the names of the two certificates

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
certificate name

Then click Add Code Signing Identity, respectively, the two names in the past. After the completion of the following:

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
Keychain

The next step is to describe the file. Note here that the /Users/Shared/Jenkins/Library/MobileDevice/Provisioning Profiles in the Provisioning Profiles address. Then according to the steps to upload keychain, Jenkins user directory description file uploaded on the line

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
Profile address Provisioning

This is the end.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
Keychain describes the file success chart

4 configuration project

Keychain configuration, the next is to build a new project. Enter the name of your project (the project name will generate a folder under Jenkins). To build a free style software project, click OK

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
new project

1.General

After you have finished the new selection, discard the old build, configure the number of days to keep the build and the maximum number

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
configuration old build

2 source management

Then configure the source code management, which is the path to pull the code Jenkins (as far as possible to the project location), if not Credentials, then click on the right side of the add, fill in their SVN account and password. If this column is not red, basically address what is right.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
configuration SVN

3 build environment

Next, configure the build environment, where we check the Keychains and Signing Identities, select login.keychain, and then select the corresponding certificate name. Also check the Mobile Provisioning Profiles, select the corresponding description file.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
build environment

4 construction

Because I use the cocoapods project, so we have to build in the selection of the implementation of the script, in which the input

#bin/bsah – L

Export LANG=en_US.UTF-8

Export LANGUAGE=en_US.UTF-8

Export LC_ALL=en_US.UTF-8

CD $WORKSPACE/ your project name

/usr/local/bin/pod update –verbose –no-repo-update

Note: no #bin/bsah – L

Export LANG=en_US.UTF-8

Export LANGUAGE=en_US.UTF-8

Export LC_ALL=en_US.UTF-8 /usr/local/bin/ that may cause the compiler to read the pod statement. When you build a pod statement error, ninety percent is the error.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
create script

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
input

Next add the Xcode build tool

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
add Xcode build tool

First configure General, there is a pit!!!! Output path must be under the workspace path, and then will not be enough to report such issues as

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
xcode-general configuration

After Code signing & OS X Keychain options

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
signing & OS X Keychain options (Code)

Next is configuring Advanced Xcode build options.

Tips:jenkins in its Home-&gt workspace directory; the construction of a folder, the folder name is your project name (such as your project name is JenkinsProj, then there will be Jenkins-> Home-> workspace-> JenkinsProj this folder). ${WORKSPACE} will generally go to the folder created by Jenkins.

Build output diretory or honest point in the workspace under the better, because the directory created by Jenkins I think it is clear enough. Before I wrote another user will be reported under the authority problem.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
advance configuration

Generally this configuration can be successfully packaged, the entire configuration process, can not be careless or self righteous configuration. There may be enough to write the article or the wrong place, welcome to correct me. Also hope that we will encounter a lot of problems to share ~!

Error Encyclopedia


1 key string error

Similar to the following key string error, I give you a tips:

1, the key is set up and used on the two places, respectively, -&gt Keychains and Provisioning management system; Profiles Management and -&gt project configuration inside; building environment Keychains and Code Signing Identities the two places to find, to see if there is a mismatch, or in accordance with the corresponding steps mentioned above again.

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
Keychain error

2.cocoapods error

Similar to the following error, the first thing to check the project configuration inside the -> build -> Execute shell is not wrong.

#bin/bsah – L

Export LANG=en_US.UTF-8

Export LANGUAGE=en_US.UTF-8

Export LC_ALL=en_US.UTF-8

CD $WORKSPACE/ your project file

/usr/local/bin/pod update –verbose –no-repo-update

If this is not enough to write off the current user, MAC, enter the Jenkins user, to see whether the installation of the cocoapods, if not installed, need to install a version and to conform to the current user (Jenkins user password can be set in the -&gt system; the preferences of the user and group settings.)

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary
cocoapods error

3.Xcode terminated packaging

Encountered Xcode termination package into the Jenkins user at this time, in the Jenkins compiler to see if there is no problem. If there is a problem, this time you have to check the items on your SVN is correct.

4.scheme error

Open Xcode-> manageSchema, hook up share

The history of the most complete Jenkins+SVN+iOS+cocoapods environment and its error summary

You can leave a message to the problem, we work together to solve