我在Windows上使用XLDeploy“ xl-deploy-8.2.1-server-trial-edition”以DevOps方式测试基于Spring的应用程序部署管道。 我有詹金斯(Jenkins),可以执行一些目标:
我正在使用xldeploy-maven-plugin 6.0.x版。
执行xldeploy:deploy目标时出现问题:
#mvn clean package deploy xldeploy:deploy
XLDeploy服务器抱怨“已导入版本”,更确切地说:
2018-12-05 16:00:03.540 [qtp251546027-45] {username=admin} INFO c.x.x.p.SourceArtifactEnricher - Going to scan artifact Applications/SGS/SBO/RETAIL/PI/ALPHA/market-securities-account/1.0.0-20181205-155919/market-securities-account
2018-12-05 16:00:09.722 [qtp251546027-46] {username=admin} INFO c.x.d.r.m.DeployitExceptionMapper - Already imported version 1.0.0-20181205-155919 of application SGS/SBO/RETAIL/PI/ALPHA/market-securities-account
2018-12-05 16:00:09.724 [qtp251546027-46] {username=admin} INFO c.x.d.r.m.DeployitExceptionMapper - Intercepting DeployitException
com.xebialabs.deployit.service.importer.ImporterException: Already imported version 1.0.0-20181205-155919 of application SGS/SBO/RETAIL/PI/ALPHA/market-securities-account
at com.xebialabs.deployit.service.importer.ImporterServiceImpl.checkImported(ImporterServiceImpl.java:222)
at com.xebialabs.deployit.service.importer.ImporterServiceImpl.doImport(ImporterServiceImpl.java:144)
at com.xebialabs.deployit.service.importer.ImporterServiceImpl.importPackage(ImporterServiceImpl.java:129)
at com.xebialabs.deployit.core.rest.api.PackageResource.doImport(PackageResource.java:107)
at com.xebialabs.deployit.core.rest.api.PackageResource.upload(PackageResource.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
独立Maven在部署阶段(映射到xldeploy:import目标)已经将dar导入到XLDeploy服务器,而xldeploy:deploy阶段尝试再次导入相同的dar。为什么?根据xldeploy-maven-plugin文档,部署目标仅执行部署,而不进行dar导入。
如果我之前删除导入目标调用,映射到部署阶段,则只需调用:
#mvn clean package xldeploy:deploy
我已将dar导入到XLDeploy服务器中,并在服务器控制台中看到了执行的部署计划:
# [Phased plan]
# [Plan phase]
* Register changes for market-securities-account
----------------------------------------------
1. (100) - Register deployeds (step: RepositoryUpdateStep, rule: null)
仅将应用程序注册为已部署,但在我的2个Tomcat上均未真正部署任何内容。
但是通过Web UI部署时,我在控制台中有以下计划:
# [Phased plan]
# [Plan phase] Deploy
#########################################################################
# [Serial] Deploy market-securities-account 1.0.0-20181205-165054 on DEV
#########################################################################
| * Deploy on container VirtualHost (Group default)
| -----------------------------------------------
| 1. ( 10) - Stop Tomcat2 (step: ScriptExecutionStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
| 2. ( 11) - Waiting 10 seconds for Tomcat2 to stop (step: WaitStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
| 3. ( 60) - Create war settings in market-securities-account.xml on VirtualHost (step: TemplateArtifactCopyStep, rule: tomcat.WarModule.executeCreate_CREATE)
| 4. ( 70) - Create market-securities-account on VirtualHost (step: ArtifactCopyStep, rule: tomcat.WarModule.executeCreate_CREATE)
| *checkpoint* CREATE Infrastructure/DEV/VM_ALPHA2_DEV/Tomcat2/VirtualHost/market-securities-account
| 5. ( 90) - Start Tomcat2 (step: ScriptExecutionStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
| 6. ( 91) - Waiting 10 seconds for Tomcat2 to start (step: WaitStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
|-------------------------------------------->
| * Deploy on container VirtualHost (Group 1)
| -----------------------------------------
| 1. ( 10) - Stop Tomcat1 (step: ScriptExecutionStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
| 2. ( 11) - Waiting 10 seconds for Tomcat1 to stop (step: WaitStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
| 3. ( 60) - Create war settings in market-securities-account.xml on VirtualHost (step: TemplateArtifactCopyStep, rule: tomcat.WarModule.executeCreate_CREATE)
| 4. ( 70) - Create market-securities-account on VirtualHost (step: ArtifactCopyStep, rule: tomcat.WarModule.executeCreate_CREATE)
| *checkpoint* CREATE Infrastructure/DEV/VM_ALPHA1_DEV/Tomcat1/VirtualHost/market-securities-account
| 5. ( 90) - Start Tomcat1 (step: ScriptExecutionStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
| 6. ( 91) - Waiting 10 seconds for Tomcat1 to start (step: WaitStep, rule: com.xebialabs.deployit.plugin.generic.container.LifeCycleContributor.restartContainers)
# [Plan phase]
* Register changes for market-securities-account
----------------------------------------------
1. (100) - Register deployeds (step: RepositoryUpdateStep, rule: null)
为什么会有这种区别? 是因为我的可部署应用程序没有按照以下屏幕截图所述自动定位到环境容器吗?
XLDeploy deployment plan through UI
尝试使用PetClinic战争示例时,为什么容器会自动成为目标?
最好的问候。
答案 0 :(得分:0)
关于部署计划,问题在于基础架构部分的VirtualHost CI中缺少标签“ webapp”。
答案 1 :(得分:0)
这是正确的。 /*--------------------------------------------------------------
## Menus
--------------------------------------------------------------*/
#cssmenu {
background: transparent;
margin: 0;
width: auto;
padding: 0;
line-height: 1;
display: block;
position: relative;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
#cssmenu ul {
list-style: none;
margin: 0 auto;
padding: 0;
float: none;
text-align: left;
padding-top: 15px;
}
#cssmenu ul:after,
#cssmenu:after {
content: ' ';
display: block;
font-size: 0;
height: 0;
clear: both;
visibility: hidden;
}
#cssmenu a {
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}
#cssmenu ul li {
margin: 0;
padding: 0;
display: block;
position: relative;
}
#cssmenu ul li a {
text-decoration: none;
text-transform: uppercase;
display: block;
margin: 0;
-webkit-transition: color .2s ease;
-moz-transition: color .2s ease;
-ms-transition: color .2s ease;
-o-transition: color .2s ease;
transition: color .2s ease;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#cssmenu ul li a {
display: inline-block;
}
#cssmenu ul li a:after {
content: '';
display: block;
height: 2px;
width: 0;
margin: 10px 0 0;
background: transparent;
transition: width .5s ease, background-color .5s ease;
}
#cssmenu ul li a:hover:after {
width: 100%;
background: #000;
}
#cssmenu ul li ul {
position: absolute;
left: -9999px;
top: auto;
z-index: 9999;
}
#cssmenu ul li ul li {
max-height: 0;
position: absolute;
-webkit-transition: max-height 0.4s ease-out;
-moz-transition: max-height 0.4s ease-out;
-ms-transition: max-height 0.4s ease-out;
-o-transition: max-height 0.4s ease-out;
transition: max-height 0.4s ease-out;
background: #ffffff;
}
#cssmenu ul li ul li.has-sub:after {
display: block;
position: absolute;
content: '';
height: 10px;
width: 10px;
border-radius: 5px;
background: #000000;
z-index: 1;
top: 13px;
right: 15px;
}
#cssmenu.align-right ul li ul li.has-sub:after {
right: auto;
left: 15px;
}
#cssmenu ul li ul li.has-sub:before {
display: block;
position: absolute;
content: '';
height: 0;
width: 0;
border: 3px solid transparent;
border-left-color: #ffffff;
z-index: 2;
top: 15px;
right: 15px;
}
#cssmenu.align-right ul li ul li.has-sub:before {
right: auto;
left: 15px;
border-left-color: transparent;
border-right-color: #ffffff;
}
#cssmenu ul li ul li a {
font-size: 14px;
font-weight: 400;
text-transform: none;
color: #000000;
letter-spacing: 0;
display: block;
width: 170px;
padding: 7px 7px 7px 7px;
text-align: left;
}
#cssmenu ul li ul li:hover>a,
#cssmenu ul li ul li.active>a {
color: #777;
}
#cssmenu ul li ul li:hover:after,
#cssmenu ul li ul li.active:after {
background: #eee;
}
#cssmenu ul li ul li:hover>ul {
left: 100%;
top: 0;
}
#cssmenu ul li ul li:hover>ul>li {
max-height: 72px;
position: relative;
}
#cssmenu>ul>li {
display: block;
}
#cssmenu.align-center>ul>li {
float: none;
display: inline-block;
}
#cssmenu.align-center>ul {
text-align: center;
}
#cssmenu.align-center ul ul {
text-align: left;
}
#cssmenu.align-right>ul {
float: right;
}
#cssmenu.align-right>ul>li:hover>ul {
left: auto;
right: 0;
}
#cssmenu.align-right ul ul li:hover>ul {
right: 100%;
left: auto;
}
#cssmenu.align-right ul ul li a {
text-align: right;
}
#cssmenu>ul>li:after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 1px;
top: 0;
z-index: 0;
border-bottom: 0px solid #000;
background: transparent;
-webkit-transition: border-bottom .2s;
-moz-transition: border-bottom .2s;
-ms-transition: border-bottom .2s;
-o-transition: border-bottom .2s;
transition: border-bottom .2s;
}
#cssmenu>ul>li.has-sub>a {
padding-right: 0px;
padding-left: 0px;
padding-bottom: 10px;
}
#cssmenu>ul>li.has-sub>a:after {
display: block;
content: '';
background: #ffffff;
height: 2px;
width: 12px;
margin: 10px 0 0;
position: absolute;
border-radius: 13px;
right: 0px;
left: 47px;
top: 18px;
}
#cssmenu>ul>li.has-sub>a:before {
display: block;
content: '';
border: 4px solid transparent;
border-top-color: #000;
z-index: 2;
height: 0;
width: 0;
position: absolute;
right: 0px;
left: 47px;
top: 18px;
}
#cssmenu>ul>li>a {
color: #000;
padding:15px 15px 0;
padding-left: 0;
text-transform: uppercase;
font-size: 13px;
font-weight: 500;
z-index: 2;
position: relative;
}
#cssmenu>ul>li:hover:after,
#cssmenu>ul>li.active:after {
height: 100%;
}
#cssmenu>ul>li:hover>a {
color: #000;
}
#cssmenu>ul>li.active>a {
}
#cssmenu>ul>li:hover>a:after,
#cssmenu>ul>li.active>a:after {
}
#cssmenu>ul>li:hover>a:before,
#cssmenu>ul>li.active>a:before {
border-top-color: #eee;
}
#cssmenu>ul>li:hover>ul {
left: 0;
}
#cssmenu>ul>li:hover>ul>li {
max-height: 72px;
position: relative;
}
#cssmenu #menu-button {
display: none;
}
#cssmenu>ul>li>a {
width: auto;
display: inline-block;
}
#cssmenu>ul>li {
width: auto;
}
#cssmenu>ul>li>ul {
width: 170px;
display: block;
}
#cssmenu>ul>li>ul>li {
width: 170px;
display: block;
}
.main-navigation {
margin-bottom: 0em;
}
@media all and (max-width: 767px),
{
#cssmenu>ul {
max-height: 0;
overflow: hidden;
-webkit-transition: max-height 0.35s ease-out;
-moz-transition: max-height 0.35s ease-out;
-ms-transition: max-height 0.35s ease-out;
-o-transition: max-height 0.35s ease-out;
transition: max-height 0.35s ease-out;
}
#cssmenu>ul>li>ul {
width: 100%;
display: block;
}
#cssmenu.align-right ul li a {
text-align: left;
}
#cssmenu>ul>li>ul>li {
width: 100%;
display: block;
}
#cssmenu.align-right ul ul li a {
text-align: left;
}
#cssmenu>ul>li>ul>li>a {
width: 100%;
display: block;
}
#cssmenu ul li ul li a {
width: 100%;
}
#cssmenu.align-center>ul {
text-align: left;
}
#cssmenu.align-center>ul>li {
display: block;
}
#cssmenu>ul.open {
max-height: 1000px;
border-top: 0px solid rgba(110, 110, 110, 0.25);
}
#cssmenu ul {
width: 100%;
}
#cssmenu ul>li {
float: none;
width: 100%;
}
#cssmenu ul li a {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 20%;
margin-left: 40%;
margin-right: 40%;
padding: 6px;
text-align: center;
}
#cssmenu ul>li:after {
display: none;
}
#cssmenu ul li.has-sub>a:after,
#cssmenu ul li.has-sub>a:before,
#cssmenu ul li ul li.has-sub:after,
#cssmenu ul li ul li.has-sub:before {
display: none;
}
#cssmenu ul li ul,
#cssmenu ul li ul li ul,
#cssmenu ul li ul li:hover>ul,
#cssmenu.align-right ul li ul,
#cssmenu.align-right ul li ul li ul,
#cssmenu.align-right ul li ul li:hover>ul {
left: 0;
position: relative;
right: auto;
}
#cssmenu ul li ul li,
#cssmenu ul li:hover>ul>li {
max-height: 999px;
position: relative;
background: none;
}
#cssmenu ul li ul li a {
padding: 8px 20px 8px 35px;
color: #333;
}
#cssmenu ul li ul ul li a {
padding: 8px 20px 8px 50px;
}
#cssmenu ul li ul li:hover>a {
color: #000000;
}
#cssmenu #menu-button {
display: block;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 20%;
margin-left: 40%;
margin-right: 40%;
margin-top: 20px;
padding: 10px;
text-transform: uppercase;
font-weight: 700;
font-size: 14px;
letter-spacing: 1px;
color: #000;
cursor: pointer;
border: 2px solid #000;
}
#cssmenu #menu-button:after {
display: none;
content: '';
position: absolute;
height: 3px;
width: 22px;
border-top: 2px solid #333;
border-bottom: 2px solid #000;
right: 20px;
top: 16px;
}
#cssmenu #menu-button:before {
display: none;
content: '';
position: absolute;
height: 3px;
width: 22px;
border-top: 2px solid #333;
border-bottom: 2px solid #000;
right: 20px;
top: 26px;
}
}
目标还会执行导入。这使您应该在Jenkins中添加一些逻辑,例如(pseudocode):
xldeploy:deploy