This is the 10th day of my participation in the August More Text Challenge. For details, see:August is more challenging
1: Run the following command on the Linux COMMAND line interface (CLI) to start Jenkins. If the Jenkins image is not found on the local device, the Jenkins image is pulled first. Note that this tutorial is based on Linux and Docker has been installed. docker run -p 8080:8080 -p 50000:50000 -v jenkins_data:/var/jenkins_home jenkinsci/blueocean2: disable systemctl stop firewalld.service (if this line is executed, an error is reportedFailed to stop firewalld.service: Unit firewalld.service not loaded.Run systemctl mask firewalld first and then systemctl stop firewalld. Service)
3: visithttp://jenkins IP address of the host :8080
3: To unlock Jenkins, use the following command to enter the Jenkins container, And then execute the second line command to get the secret key docker exec – it container ID/bin/bash cat/var/jenkins_home/secrets/initialAdminPassword
4: After entering the secret key, the following page is displayed (You are advised to select the first one). Select the key, wait until the plug-in is installed, and create a user.5: Configure Jenkins JDK and Maven Jenkins container. Run the echo $JAVA_HOME command to view the JDK installation directory. I’m using version 3.6.3 of Maven.Install Maven Integration in Manage Jenkins-Manage Plugins-Optional Plugins. Create a new task after the installation.7: Push the code to the code cloud (you can choose different code bases such as Git, GitHub, etc.) 7.1 First create a repository on the code cloud7.2: Push the local code to the code cloud, right-click the project team-share project, and click the following interface in order. Then commit and push, and the URL is the URL copied from the code cloud.The following error occurred on the first referral because the submit branch was not selected.Solution: right-click project team-remote-push, and then press the following operation to Push the code to the code cloud.8: Jenkins configuration code cloud 8.1: Create a Maven projectThe credentials user name and password are the account password of the code cloud. The Build command depends on the project. In this case, the test project POM file is the most initialized maven file, so a clean package command will be sufficient.8.3: Post Steps Select shell. This step is done after the packaging is complete, which is to start the project.
! /bin/bash
APP_HOME= PWD # Jar package name of the maven package JAR_NAME= jenkins-maven-server-0.0.1-snapshot. jar JAR_PATH=${APP_HOME}/target
PID_FILE=” APPHOME”/”{APP_HOME}”/”APPHOME”/”{SERVER_NAME}”. Pid if [-f “PIDFILE”]; ThenPID = “cat” {PID_FILE} “); then PID=`cat “PIDFILE”]; ThenPID = ‘cat”PID_FILE”‘ && kill -9 PID && echo “kill process “{PID}” finished!” fi
cd $JAR_PATH
# Modify file permission chmod 755 $JAR_NAME
# Start service BUILD_ID=dontKillMe nohup Java -jar $JAR_NAME &
JAVA_PID=! echo”! echo “! echo”{JAVA_PID}” > “${PID_FILE}”
8.4: After the project configuration is saved, click Build now to carry out code pulling, build packaging and start services.8.5: Finally, access your engineering interface in the browser.
Note: when starting the container, you need to add the port of your project so that the outside world can access your project. For example, this is 10858. docker run -p 8080:8080 -p 10858:10858 -p 50000:50000 -v jenkins_data:/var/jenkins_home jenkinsci/blueocean
I am Chen PI, a Coding ITer in the Internet, wechat search “Chen PI JavaLib” first time to read the latest article oh!
The end of this sharing ~~
If you think the article is helpful to you, like, collect, follow, comment on your