상세 컨텐츠

본문 제목

Jenkins(for Mac)

카테고리 없음

by ciatentasas1983 2020. 3. 22. 16:44

본문

  1. Jenkins Download Mac

A guide for setting up a Jenkins CI server on Mac OS X machine. So you want to have Continuous Integration for Mobile in your company and your final choice of CI server is Jenkins. If your company is big and you are lucky enough the Dev Support or Dev Ops team will do all the heavy-lifting and install it for you. But if it’s not the case you might’ve just landed on a page that has something to help you out. Install A kind of warning first, avoid installing Jenkins as Launch Daemon. For detailed reasoning checkout out.

Offers a list of options for Jenkins installation but doesn’t mention Mac OS X. It mentions though and I’ve heard nothing but good things about Docker. In this article I will stick with. You will need JDK to be before proceeding.

To install run a simple shell command. Jenkins will be installed to usr/local and Homebrew will actually tell you right away how to turn it into a Launch Agent. This recommends you to symlink Jenkins launch agent plist file to /Library/LaunchAgents but I would advise against it. As you will see next you will need to modify that file. That means if you ever upgrade Jenkins via Homebrew all your changes in plist will be lost. My recommendation is to copy it instead of making a symbolic link.

Even more, once installed via Homebrew I then delegate Jenkins upgrades to Jenkins itself. For this reason I pin Homebrew formula to prevent Homebrew from upgrading Jenkins files. Now you also have manual control over Jenkins installation and can start/stop it from command line. Configure To understand why you need to change plist try to run Jenkins server. Give it a go, create a couple of build projects that do some basics like checking out git repository and running simple build command.

Very soon you should get an error message saying that Jenkins has ran out of memory. This seems to be a common issue with JVM and Mac OS X,. I’m not quite sure why default configuration doesn’t account for this, probably this is Mac specific and other operating systems are OK. Anyway, you need to modify default plist file for Launch Agent. Here’s what you need and might want to change.

JVM Virtual Memory and Garbage Collection. Tell JVM to use a 64-bit data model if available ( -d64). Set minimum and maximum heap size with -Xms and Xmx flags. 512 Mb works for me most of the time.

Configure garbage collector, class unloading and permanent space. HTTP Proxy By far the largest source of issues and frustration, company proxy. Specify it using -D option. Port and Prefix Run Jenkins on a custom port with custom prefix in url. This example uses default 8080 port and /jenkins prefix, so you can access your Jenkins dashboard like or ever These arguments need to be passed to jenkins.war which was installed by Homebrew to /usr/local/opt/jenkins/libexec.

Run at Load Enable Run at Load option to start server automatically if machine reboots. Environment Variables If any of the commands in this plist need environment variables this is how you can define them. Standard Output and Error It is up to you to redirect stdout and stderr.

While sounds like a good idea for logging I would advise against redirecting stderr into a file. I once had to deal with 90 Gb log file created by Bamboo remote agent over a few months period. Note that Jenkins put its files in.jenkins folder in your user’s home path. You also have to specify full paths when dealing with launch agent plists. Create log folder if it’s not there yet. Other By default Jenkins enables security protocol for email. I have also faced an issue with and had to set preferIPv4Stack flag as a workaround.

These are all flags for java command. Full Config Now put it all together.

Jenkins Download Mac

Now you have a reliable Jenkins server that runs 24/7 and performs stable CI tasks. Tips To find out how exactly Jenkins was launched, grep active processes list. The output will tell you everything you need to know. Other Ways Jenkins Runner There are other ways to install and start Jenkins server, one of them is using runner script. It is not bundled with Homebrew installation by default, you should download it manually as mentioned on the Jenkins Wiki page. In this case all the configuration options are in data/wrapper.conf file, you can check and easily figure out where to add your custom options. The runner shell script itself can be launched as Launch Agent or Launch Daemon.

Overall this is just a higher level of configuration. Legacy Runner Another approach I’ve seen is to use custom runner script. I am actually working with one right now but I suspect this is a legacy version of jenkins.sh. The main difference is that all configuration is stored in Mac OS X defaults and then read by the script like this.

Defaults are stored as plist and are read as a dictionary. An example output looks like this Using sudo defaults write you can change Jenkins configuration. Obviously this is less preferred way than using wrapper.conf. Using OS X defaults leads to configuration which is non-reusable on other operating systems and can’t be easily put in SCM if needed. Summary A short summary - install with Homebrew, configure as Launch Agent. To configure Jenkins for Mobile CI tasks you can read other articles in this blog.

The configuration is far from being final. You will have to install plugins, configure SSH keys for git repositories and perform multitude of other administrative tasks to bring your Jenkins CI box up to speed.

Jenkins(for Mac)

Installing Jenkins is usually easy. It’s even easier on the Mac using. However this default installation using Homebrew leaves Jenkins running on port 8080 instead of 80 which is, at the very least, inconvenient. Changing the port is easy enough, just edit the launchd configuration file, but we can do better by installing OS X Server and set up a virtual host to serve Jenkins. Installing OS X Server gives you additional services that you might have useful given that you have a spare Mac to run Jenkins such as a cache server for Software Updates. Installing OS X Server OS X Server is. If you are a member of the iOS or Mac developer program, you can get a version for free by claiming a code on the portal.

Installing Jenkins on OS X There are several ways to install Jenkins. There’s an installer package you can grab, or you can install it using. I choose Homebrew. From a Terminal window type brew install jenkins. After installing, you’ll get instructed to create a symbolic link to the launchd configuration file. Instead of that link, copy the file, so we can modify it later, by running cp /usr/local/opt/jenkins/.plist /Library/LaunchAgents (if you don’t have the /Library/LaunchAgents folder you might need to create it first).

Creating a Virtual Server on OS X Server’s Apache On the Mac running OS X Server open the Server app. It will ask you to choose a server and then login. Once in, choose Websites on the left menu. On the top-right you have a button to start Apache. On the bottom, there’s a list of Websites. Use the plus button to add a new one for Jenkins.

When editing the Virtual Host, choose a Domain Name such as jenkins.example.com. If you go to Edit Advanced Settings you’ll see the following screen: except that you won’t have the webapp called “Jenkins using ajp13”.

Let’s go ahead and create it. Creating the Jenkins Webapp Sidenote: OS X Server and Apache configuration files While you can edit the Apache configuration file for the Jenkins Virtual Host you just created, OS X Server will overwrite it as soon as you make any changes to the Virtual Host using the UI. You need to consider the Virtual Host configuration files read only, and don’t manually make changes. Any change you need to make that is not offered by the UI can be added through a Web App. Creating the Webapp Webapps are defined with plist files stored in /Library/Server/Web/Config/apache2/webapps/. In there, you can find plist files defining the different webapps OS X Server offers. There’s a sample one called com.example.mywebapp.plist and you can get the documentation for this by running man webapp.plist.

The plist we created for Jenkins looks like this. ProxyPassReverse / ajp://127.0.0.1:8102/ What we do here is configure Apache to use modproxyajp to send some requests to Jenkins running the AJP13 protocol on port 8102. Adding this webapp to your Virtual Host In order to add this webapp to my Virtual Host, I had to restart the whole Mac running OS X server, as it didn’t show up on the Webapps panel. Your mileage may vary. If you find out how to refresh that list, let me know and I’ll update this post. Configuring Jenkins to use AJP13 Remember I told you to copy the launchd configuration file instead of symlinking it? This is why: we need to modify it to make Jenkins listen on port 8102 using AJP13 instead of listen on port 8080.

Here’s how my modified homebrew.mxcl.jenkins.plist file looks.