In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Build Project Location
/var/lib/jenkins/workspace/jenkins_project_name
Manual build:
1 New free-style jenkins project---build--execute shell
rm -rf project1/
git clone git@192.168.1.14:group1/project1.git
ssh 192.168.1.17 "/etc/init.d/tomcat stop"
ssh 192.168.1.18 "/etc/init.d/tomcat stop"
scp -r project1/ root@192.168.1.17:/data/tomcat/webapps/web01/
scp -r project1/ root@192.168.1.18:/data/tomcat/webapps/web01/
ssh 192.168.1.17 "/etc/init.d/tomcat start"
ssh 192.168.1.18 "/etc/init.d/tomcat start"
2 Roll back the above item to the previous version
pwd
#rm -rf project1/
#git clone git@192.168.1.14:group1/project1.git
cd project1
git reset --hard HEAD^
#Description, one ^is back to the previous version, two ^is back to the previous version
#ssh 192.168.1.17 "/etc/init.d/tomcat stop"
#ssh 192.168.1.18 "/etc/init.d/tomcat stop"
scp -r ./ root@192.168.1.17:/data/tomcat/webapps/web01/
scp -r ./ root@192.168.1.18:/data/tomcat/webapps/web01/
#ssh 192.168.1.17 "/etc/init.d/tomcat start"
#ssh 192.168.1.18 "/etc/init.d/tomcat start"
3 New Pipeline Project---Pipeline--Script
node {
stage('git code') {
echo 'git code'
sh 'rm -rf project1/'
sh 'git clone git@192.168.1.14:group1/project1.git'
}
stage('stop tomcat') {
echo 'stop tomcat'
sh 'ssh 192.168.1.17 "/etc/init.d/tomcat stop"'
sh 'ssh 192.168.1.18 "/etc/init.d/tomcat stop"'
}
stage('scp code') {
echo 'scp code'
sh 'scp -r project1/ root@192.168.1.17:/data/tomcat/webapps/web01/'
sh 'scp -r project1/ root@192.168.1.18:/data/tomcat/webapps/web01/'
}
stage('stop tomcat') {
echo 'stop tomcat'
sh 'ssh 192.168.1.17 "/etc/init.d/tomcat start"'
sh 'ssh 192.168.1.18 "/etc/init.d/tomcat start"'
}
}
Configure auto-trigger builds
1 on Jenkins:
Configure global security---Check Allow anonymous read access--Cancel Prevent Cross Site Request Forgery explosions
Click on a jenkins project test1--Configure---Build Triggers---Check Trigger builds remotely--Enter Authentication Token: 123123--Check: Build when a change is pushed to GitLab
2 on gitlab:
Click on the wrench icon--Settings--Network--Inbound requests--Check Allow requests to the local network from hooks and services
Click gitlab project1---Settings---Intergrations---Enter in RUL: 192.168.1.15:8080/buildByToken/build? job=test1&token=123123
---Check Push events under Trigger---Check Enable SSL verification---Finally click Add Webhook---Then test
Note: 192.168.1.15 is the address of jenkins, test1 is the project name in jenkins
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.