# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo # rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key # yum install jenkins # systemctl start jenkins java
# cat /var/lib/jenkins/secrets/initialAdminPassword
http://x.x.x.x:8080/
node {
stage 'Deploy1'
sh "date"
sh "whoami"
sh "pwd"
stage 'Deploy2'
sh "sleep 3"
sh "date"
}
sh 'date | true'
def RESULT = sh (
script: "do something",
returnStatus: true
) == 0
if(RESULT) {
// do something
} else {
// do something
}
/etc/sysconfig/jenkins
JENKINS_USER="user01"
chown -R user01: /var/lib/jenkins /var/log/jenkins /var/cache/jenkins
curl -so config.xml --user USER:PASSWORD "http://x.x.x.x/config.xml"
curl -XPOST --data-binary @config.xml --user USER:PASSWORD "http://x.x.x.x/config.xml"