Labels (separated by Spaces) : work


This paper will include the problems in Jenkins construction process in the form of problems and solutions, and will continue to collect in the comments later. If there are similar situations, please compare and solve them by yourself.

Reference for this article: Taught you how to use Jenkins ci iOS project http://www.jianshu.com/p/41ecb06ae95f about iOS – Jenkins for continuous integration project deployment http://www.jianshu.com/p/54c7daae6c94 iOS continuous integration: Jenkins at http://www.jianshu.com/p/faf879b3d182

Level 1:

Install Jenkins: First your computer should have a Java environment. Next, install Jenkins. You can go to the Jenkins portal and see how to install it; Of course you can also use the following methods:

  • Install homebrew
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy the code
  • Install Jenkins
$ brew install jenkins
Copy the code

Jenkins service needs to be started after successful installation;

Level 2:

Start Jenkins service: confirm that Jenkins has been installed. Enter the Jenkins installation directory on the terminal and there will be a file called jenkins.war.

$ java -jar jenkins.war
Copy the code

Or enter:

$ jenkins
Copy the code

When there is a:

The service is in place and ready to be configured;

Here are two more commands to enable and disable Jenkins (on Mac) :

$ sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
$ sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Copy the code

This can also be done on Linux:

$ sudo systemctl status jenkins.service
$ sudo systemctl start jenkins.service
Copy the code

However, in the actual operation process, there may be failure to stop the service. My approach is to directly open the activity monitor, search the Java service inside, and force the shutdown; If the service has not stopped, Jenkins will not start again.

If you want to see if Jenkins is running, use the following command to check:

$ ps aux | grep jenkins
Copy the code

Level 3:

Once installed and enabled, you can enter localhost:8080 in the browser to configure the page. Once the installation is complete, Safari will probably open automatically. If it doesn’t, open your browser and type http://localhost:8080

An error may be reported at this point. If there’s a problem with that. The cause of this problem is that the Java environment is faulty. Restart the Java environment.

At this point, if you reboot your computer, you’ll find that Jenkins has given you a new user name, Jenkins, but you don’t know the password. You might try the password, but it must be wrong, because the initial password is very complicated. The correct way to open http://localhost:8080 is to reset the initial password as shown in the following figure.

According to clew, find/Users/Shared/Jenkins/Home/the directory, this directory is Shared directory, but there are permissions, the Jenkins user/secrets/directory is not to read and write access.

Open the initialAdminPassword file and copy the password to a web page to reset the password. The following figure

Install it all the way through, enter your username, password, email, etc., and call it complete.

Continue with localhost:8080

However, this part is not over: WHEN I write blog, I have set their account logout, but then set the password but forget, how can not remember, how to do? First of all, I was wondering if I could use the Jenkins account I gave you. I tried and failed. Then baidu checked several methods, some methods are very complex, do not intend to use, we only use the most simple and crude; As long as the previous account information is not lost, it is OK to enter the system again, so:

Note that found in the process of actual operation is not/User/Shared/Jenkins config under/Home. XML, nor is it a/User/Shared/Jenkins/Home/users under config. XML, Config.xml in your own user directory ~/.jenkins/, possibly because Jenkins is running in the.Jenkins workspace of the current user directory.

After inspection, no error, can enter, but there seems to be a problem, that is, you can not find the option to manage users; Solve the problem, check the yellow circle in the figure, return to system management, management user (or a hidden prop);

It’s like an agent logging into an unauthorized account, but anyway, it’s cracked and on to the next level;

Level 4:

Leaving aside all the setup stuff in the project build, let’s take a look at some of the issues in Cer, Keychain, and Provisioning Profiles: Go to Administration -> Administration Plugins -> Optional Plugins to search and install Keychains and Provisioning Profiles Management plugins. Enter the plug-in:

Don’t fill in the blanks, I’ll tell you it’s a choice question; Go to the file directory, Command + Shift + G, and write the path ~/ repository /Keychains,

Keychain-db = login.keychain-db = login.keychain = login.keychain = login.keychain = login.keychain = login.keychain = login. To prevent references to -db elsewhere); After the completion of the upload will appear below some of your information; Then open your key chain, you know where it is;

Click the certificate used to pack, copy the name in the red box, and add it to identities.

If there are more than one, click On Add Code Signing Identity to Add;

Then there are PP files, which need to be copied from the system PP folder to Jenkins resource folder, as shown in the following two paths: this is the system PP file directory

Provisioning Profiles Directory Path = Provisioning Profiles Directory Path = Provisioning Profiles Directory Path

/User/{USERNAME}/Library/MobileDevice/Provisioning Profiles
Copy the code

Then go to your Apple account to find the PP file you need for packaging, and click upload to upload to Jenkins environment; Above, the certificate part solved;

Level 5

Create project process we will describe each item one by one: click New project, enter the project name, select build a free style software project, and then enter the configuration page.

  • The content of the General section is very simple, there is nothing to say, according to the need to fill; Here I would like to talk about the option of GitLab Connection. Since my own project uses the code managed by GitLab, I need to install a Plug-in of GitLab in Jenkins, and then conduct account configuration in Jenkins. Account password and SSH can be adopted, and there will be an SSH pit in this part. Without analysis, I will talk about it later. Here, I first use the account password to build, and it is found that SSH is not necessary.

The Credentials are configured here:

  • Source management Here I chose Git,Repository URLEnter the git address of your project. The password should start with HTTP or HTTPS.CredentialsFill in what you created in the previous step,

    Branch Specifier (blank for ‘any’)Fill in the branch that you want to build, and I have here*/release;

Here we photoshop a hidden BOSS:

Returned Status Code 143 Jenkins ERROR: ERROR repo 'Origin' returned Status Code 143 Jenkins ERROR: ERROR repo 'Origin'Copy the code

This error was prompted after the end of the project configuration to build, I had to make this discovery remote code was already pull to the local, just happens in the process of pull interrupts, himself in for nearly 50 times of trial and error and found the pull to the local code rate is variable, previously thought that is a question of SSH account, Then turned to spent the time of day to SSH, then the SSH after thorough found that the problem still exists, finally after baidu, Google, sogou also use (sometimes have to say, baidu search not to come out of sogou search), and found a few useful, later, is not hard, and stepped behind partners pay more attention to the pit, experience, if experience;

Blog.sina.com.cn/s/blog_72ef… Issues.jenkins-ci.org/browse/JENK… Stackoverflow.com/questions/3…

The solution lies in the Timeout, which you can see by looking at the word:

By the way, I have attached a link of code 128, which is related to this problem. Because the keywords of these problems are repeated, the searched articles may sometimes be misleading, so please be careful to distinguish:

returned status code 128 jenkins
ERROR: Error cloning remote repo 'origin'
stderr: Permission denied (publickey).
Copy the code

wantcoding.com/?p=293 this link is attached, go in to see you will have a surprise, and QQ group oh