自動化部署jenkins
阿新 • • 發佈:2018-11-07
自己實現的一個自動化部署
1.在jenkins中,在系統配置中新增ssh
2.建立一個maven專案
3.選擇相關資訊
4.上傳shell指令碼到伺服器
5.給shell指令碼新增執行許可權
6.啟動構件
給shell指令碼新增執行許可權
除錯過程的主要資訊
正常情況: Waiting for Jenkins to finish collecting data [JENKINS] Archiving /var/jenkins_home/workspace/test_portal/pom.xml to com.itrus/portal/0.0.1-SNAPSHOT/portal-0.0.1-SNAPSHOT.pom [JENKINS] Archiving /var/jenkins_home/workspace/test_portal/target/portal.war to com.itrus/portal/0.0.1-SNAPSHOT/portal-0.0.1-SNAPSHOT.war SSH: Connecting from host [76cfcbf03083] SSH: Connecting with configuration [remote_test_server] ... channel stopped SSH: EXEC: STDOUT/STDERR from command [rm -rf /usr/local/apache-tomcat-8.5.31/webapps/portal /usr/local/apache-tomcat-8.5.31/bin/restart.sh] ... 23345 ===========shutdown================ ========kill /usr/local/apache-tomcat-8.5.31 begin============== 23345 ========kill /usr/local/apache-tomcat-8.5.31 end============== ===========startup============== Tomcat started. SSH: EXEC: completed after 2,802 ms SSH: Disconnecting configuration [remote_test_server] ... SSH: Transferred 1 file(s) Finished: SUCCESS 錯誤情況: Waiting for Jenkins to finish collecting data [JENKINS] Archiving /var/jenkins_home/workspace/portal_20180910_to_124.205.224.179_9018/pom.xml to com.itrus/portal/0.0.1-SNAPSHOT/portal-0.0.1-SNAPSHOT.pom [JENKINS] Archiving /var/jenkins_home/workspace/portal_20180910_to_124.205.224.179_9018/target/portal.war to com.itrus/portal/0.0.1-SNAPSHOT/portal-0.0.1-SNAPSHOT.war channel stopped SSH: Connecting from host [76cfcbf03083] SSH: Connecting with configuration [ixin_ceshiji_124.205.224.179_9017] ... SSH: EXEC: STDOUT/STDERR from command [rm -rf /root/apache-tomcat-7.0.63/webapps/portal /root/apache-tomcat-7.0.63/bin/restart179.sh] ... bash: line 1: /root/apache-tomcat-7.0.63/bin/restart179.sh: Permission denied SSH: EXEC: completed after 401 ms SSH: Disconnecting configuration [ixin_ceshiji_124.205.224.179_9017] ... ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]] Build step 'Send build artifacts over SSH' changed build result to UNSTABLE Finished: UNSTABLE root 25964 1 3 10:42 pts/0 00:04:37 /usr/local/jdk1.8/jre/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-8.5.31/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /usr/local/apache-tomcat-8.5.31/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.31/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/apache-tomcat-8.5.31 -Dcatalina.home=/usr/local/apache-tomcat-8.5.31 -Djava.io.tmpdir=/usr/local/apache-tomcat-8.5.31/temp org.apache.catalina.startup.Bootstrap start root 9453 1 13 12:47 pts/2 00:03:45 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djava.util.logging.config.file=/root/apache-tomcat-7.0.63/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms2048m -Xmx5120m -XX:MaxPermSize=1024m -Dfile.encoding=GBK -Dsun.jnu.encoding=GBK -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dfile.encoding=UTF-8 -Djava.endorsed.dirs=/root/apache-tomcat-7.0.63/endorsed -classpath /root/apache-tomcat-7.0.63/bin/bootstrap.jar:/root/apache-tomcat-7.0.63/bin/tomcat-juli.jar -Dcatalina.base=/root/apache-tomcat-7.0.63 -Dcatalina.home=/root/apache-tomcat-7.0.63 -Djava.io.tmpdir=/root/apache-tomcat-7.0.63/temp org.apache.catalina.startup.Bootstrap start