preface

The company didn’t have its own publishing platform, so it happened that I had used it before, so I wanted to build it myself, mainly using Jenkins, and went through it from 0 to 1. Many pits in the middle, a little bit of information, or get. My computer is a MAC, so some of my operations are MAC based, if it is a Windows machine, the path will be different, pay attention!!

The installation

It is easy to install the latest stable version. There are many tutorials on the Internet that say you need to install JAVA first. There is no need because the latest stable installation package will come with JAVA11.

brew install jenkins-lts
Copy the code

/usr/local/Cellar /usr/local/Cellar /usr/local/Cellar

After installing it, follow the instructions in the tutorial to boot it up. After starting up, open the home page and log in with the initial password.

Installing a plug-in

Since the project is on GitLab, I will install some plug-ins needed by GitLab.

1.Gitlab API

2.Gitlab Hook

This plugin does not support Java11, but jenkins-LTS installs Java11 by default, so we need a lower version. This is an important point that I have been trying to figure out for a long time. Finally, I found a solution in a forum.

We want to change the Jenkins – LTS invokes the Java point, find the installation position of Jenkins – LTS, I here is the location of the/usr/local/Cellar/Jenkins – LTS / 2.263.1, open the homebrew. MXCL. Jenkins – LTS. File,

<? The XML version = "1.0" encoding = "utf-8"? > <! DOCTYPE plist PUBLIC "- / / / / DTD plist Apple / 1.0 / EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > < plist Version ="1.0"> dict> <key>Label</key> <string> Homebrew.mxcl.Jenkins -lts</string> <key>ProgramArguments</key> <array> <string>/usr/local/opt/openjdk@11/bin/java</string> <string>-Dmail.smtp.starttls.enable=true</string> <string>-Djava.awt.headless=true</string> <string>-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true</string> <string>-jar</string> <string>/usr/local/opt/jenkins-lts/libexec/jenkins.war</string> <string>--httpListenAddress=127.0.0.1</string> <string>--httpPort=8080</string> </array> <key> </dict> </plist>Copy the code

The reference to JAVA refers to Java11, so we can just point to Java8. We will install Java8 first. It is recommended to download it directly from the official website.

After installed, find the corresponding path, I should be here/Library/Java/JavaVirtualMachines jdk1.8.0 _291. JDK/Contents/Home/bin/Java, the/usr/local/opt/its @ 11 /bin/ Java.

Brew Services restart Jenkins-lts

At this point, our installation and the required environment is ready, and then we can enter the actual combat