运行Jenkins部署任务

gblfy 2019-05-21 14:08:51  1881  收藏
分类专栏: 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/order
    at 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 TestEnv
        at 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/order
    at 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 directory
    at 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 directory
    at 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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
异常解决方案:
请跳转: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" = "" ]
    then
      echo "no tomcat pid alive"
    else
      kill -9 $pid
    fi
}
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
————————————————
版权声明:本文为CSDN博主「gblfy」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_40816738/article/details/90405943

jenkins报错hudson.plugins.git.GitException: Could not init /root/.jenkins/workspace/DeployOrder/order相关推荐

  1. Jenkins+GitHub报错hudson.plugins.git.GitException: Failed to fetch from GitHub 443

    偶然?总是? 在配置 源码管理的时候 使用https 进行代码的下载 配置的是用户名和密码 但是在执行构建的时候,总是会报错 443,但是偶尔也会有几次成功下载的,所以就很奇怪!!!!!!!!!! f ...

  2. Jenkins构建时报错 GitERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException

    --昨夜西风凋碧树,独上高楼,望尽天涯路 Jenkins + GitLab持续集成时遇到如下错误: ERROR: Error cloning remote repo 'origin' hudson.p ...

  3. jenkins构建时git报错:hudson.plugins.git.GitException: Failed to fetch from

    问题: jenkins拉取远程代码构建git报错:hudson.plugins.git.GitException: Failed to fetch from 拉不到远程分支 提示信息如下 ERROR: ...

  4. jenkins构建:ERROR: Error fetching remote repo ‘origin‘(hudson.plugins.git.GitException/does not point)

    [EnvInject] - Loading node environment variables. 构建中 在工作空间 /Users/jenkins/workspace/XXX 中> git r ...

  5. hudson.plugins.git.GitException

    使用jenkins构建工程时报错 [EnvInject] - Loading node environment variables. Building in workspace /data/jenki ...

  6. Caused by: hudson.plugins.git.GitException: Command “git fetch --tags --progress -- https://github.

    一.问题描述: 由于最近一直在搞java开发,没怎么搞cicd了,突然想搞搞自己的项目,所以跑了一下jenkins,却发现原来搭好的job执行失败,GitHub上面的代码拉不下来 ERROR: Err ...

  7. git.exe init#timeout = 10错误:克隆远程repo'origin'时出错hudson.plugins.git

    用Jenkins自动化搭建测试环境,Jenkins构建任务 关键异常抓取 git.exe init#timeout = 10错误:克隆远程repo'origin'时出错hudson.plugins.g ...

  8. yum安装Jenkins报错Error in PREIN scriptlet in rpm package jenkins-2.204.5-1.1.noarch

    个人博客站点:http://www.johnlee.ink/ 解决方案: [root@jenkins data]# rm -f /etc/sysconfig/jenkins 解决思路: 1.通过Yum ...

  9. Jenkins报错‘Gradle build daemon disappeared unexpectedly‘的问题解决

    Jenkins报错'Gradle build daemon disappeared unexpectedly'的问题解决 参考文章: (1)Jenkins报错'Gradle build daemon ...

最新文章

  1. Spring框架使用规范和IOC的开发
  2. thymeleaf基本语法
  3. vue --- 全局配置过滤函数,使用moment函数来格式化时间
  4. GoogLeNet结构
  5. python数据可视化是什么_Python数据分析:可视化
  6. 数据建模-聚类分析-K-Means算法 --聚类可视化工具TSNE
  7. mybatis里面返回list集合
  8. ATITIT 后发优势 后发劣势 vs 先发优势的思考 目录 1.1. “后发优势” 1 1.2. “后发劣势”论 1 1.3. 科技、经济界有两种矛盾的说法“后发优势”和“后发劣势” 1 2
  9. Go(Golang)编程语言
  10. 区块链java开源框架_github上的java三大开源区块链类库?
  11. Java语言的技术平台:JavaSE、JavaEE和JavaME
  12. php网页拍照并上传,HTML中网页拍照并上传照片的实现方法
  13. 高仿腾讯QQ即时通讯IM项目
  14. 来自2018年最后的瞎扯——从“空间”到“强人工智能”
  15. java 基础运算_Java 基础 运算符
  16. 2007.5 同航驾驶培训公司网站
  17. 调试oracle,如何调试Oracle ICS问题 | Soo Smart!
  18. 微信公众号无法抓包 提示请在微信客户端打开链接
  19. 全球潮汐数据API使用方法,潮汐数据查询
  20. 可选int参数“id”存在,但由于被声明为基元类型,因此无法转换为null值。考虑将其声明为对应的基元类型的对象包装器。

热门文章

  1. ARM基本接口之LCD实验
  2. Liunx userdel删除用户时提示userdel: user *** is currently used by process 12910
  3. 苹果保修期查询_查询iPhone的保修日期和激活日期
  4. DBCA启动问题 (linux)
  5. 北京房租大涨?6个维度,数万条数据帮你揭穿(附详情代码)
  6. 高等数学二从零开始学习的总结笔记(持续更新)
  7. 把int转换为char把int转换为char
  8. vue的组件内部全局变量按照使用的前端id存储历史数据
  9. 金融业务知识(2):股票交易的基本流程
  10. LED灯条亮度色温调节