日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

运行Jenkins部署任务

發布時間:2024/9/27 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 运行Jenkins部署任务 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、運行Jenkins部署任務

  • 1. 執行Jenkins部署任務
  • 2. 打開瀏覽器訪問部署應用程序
  • 3. 確定發布結果的正確性
  • 4. 確認執行結果成功

  • 1. 執行Jenkins部署任務
  • 查看控制臺輸出

    異常信息如下:
Started by user admin Running as SYSTEM Building remotely on TestEnv in workspace /root/.jenkins/workspace/DeployOrder No credentials specified Cloning the remote Git repository Cloning repository git@github.com:gb-heima/order.git> git.exe init /root/.jenkins/workspace/DeployOrder/order # timeout=10 ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Could not init /root/.jenkins/workspace/DeployOrder/orderat org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:813)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:605)at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)at hudson.remoting.UserRequest.perform(UserRequest.java:212)at hudson.remoting.UserRequest.perform(UserRequest.java:54)at hudson.remoting.Request$2.run(Request.java:369)at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)at java.util.concurrent.FutureTask.run(FutureTask.java:266)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)at java.lang.Thread.run(Thread.java:745)Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to TestEnvat hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)at hudson.remoting.Channel.call(Channel.java:957)at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)at com.sun.proxy.$Proxy85.execute(Unknown Source)at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)at hudson.scm.SCM.checkout(SCM.java:504)at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)at hudson.model.Run.execute(Run.java:1818)at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)at hudson.model.ResourceController.execute(ResourceController.java:97)at hudson.model.Executor.run(Executor.java:429) Caused by: hudson.plugins.git.GitException: Error performing command: git.exe init /root/.jenkins/workspace/DeployOrder/orderat org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2049)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2010)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2006)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1638)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:811)... 11 more Caused by: java.io.IOException: Cannot run program "git.exe" (in directory "/root/.jenkins/workspace/DeployOrder/order"): error=2, No such file or directoryat java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)at hudson.Proc$LocalProc.<init>(Proc.java:249)at hudson.Proc$LocalProc.<init>(Proc.java:218)at hudson.Launcher$LocalLauncher.launch(Launcher.java:937)at hudson.Launcher$ProcStarter.start(Launcher.java:455)at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2038)... 15 more Caused by: java.io.IOException: error=2, No such file or directoryat java.lang.UNIXProcess.forkAndExec(Native Method)at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)at java.lang.ProcessImpl.start(ProcessImpl.java:134)at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)... 20 more ERROR: Error cloning remote repo 'origin' Finished: FAILURE

異常解決方案:
請跳轉:https://blog.csdn.net/weixin_40816738/article/details/90280863

  • 2. 打開瀏覽器訪問部署應用程序
    • 瀏覽器訪問:http://192.168.45.145:8090/

      現在成功部署成功了!!!!
  • 3. 確定發布結果的正確性
  • 4. 確認執行結果成功

本章回顧

本章講述了

  • 典型的自動化部署任務過程
  • 并實際創建了一個Jenkins自動化部署任務開發中的一些要素
  • 實際執行自動化部署任務
    通過這個任務,我們可以看到測試環境被自動化的創建了出來。有了這個任務我么嘗試一下,實戰環節。
    在實戰中我們實際體驗一下如何達到開發修改代碼,推送遠程github倉庫,測試一鍵部署測試環境
  • 附上:deploy.sh腳本內容:
#!/usr/bin/env bash #編譯+部署order站點#需要配置如下參數 # 項目路徑, 在Execute Shell中配置項目路徑, pwd 就可以獲得該項目路徑 # export PROJ_PATH=這個jenkins任務在部署機器上的路徑# 輸入你的環境上tomcat的全路徑 # export TOMCAT_APP_PATH=tomcat在部署機器上的路徑### base 函數 killTomcat() {pid=`ps -ef|grep tomcat|grep java|awk '{print $2}'`echo "tomcat Id list :$pid"if [ "$pid" = "" ]thenecho "no tomcat pid alive"elsekill -9 $pidfi } cd $PROJ_PATH/order mvn clean install# 停tomcat killTomcat# 刪除原有工程 rm -rf $TOMCAT_APP_PATH/webapps/ROOT rm -f $TOMCAT_APP_PATH/webapps/ROOT.war rm -f $TOMCAT_APP_PATH/webapps/order.war# 復制新的工程 cp $PROJ_PATH/order/target/order.war $TOMCAT_APP_PATH/webapps/cd $TOMCAT_APP_PATH/webapps/ mv order.war ROOT.war# 啟動Tomcat cd $TOMCAT_APP_PATH/ sh bin/startup.sh

總結

以上是生活随笔為你收集整理的运行Jenkins部署任务的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。