Jenkins和JBoss EAP 7.1.0.GA部署问题

时间:2018-09-07 17:03:39

标签: java jenkins continuous-integration jboss6.x jboss-eap-7

我在詹金斯工作的最后阶段执行部署时遇到问题。

Caused by: org.jboss.as.cli.CommandFormatException: Undeploy failed: {"WFLYCTL0062: 
    Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1"
       => "WFLYDC0043: Cannot remove deployment abc-web-1.0.101.war from the domain as it is 
       still used by server groups [abc-demo-latest]"}}
  at org.jboss.as.cli.handlers.UndeployHandler.doHandle(UndeployHandler.java:231)
  at org.jboss.as.cli.handlers.CommandHandlerWithHelp.handle(CommandHandlerWithHelp.java:86)
  at org.jboss.as.cli.impl.CommandContextImpl.handle(CommandContextImpl.java:581)

我目前无法访问管理控制台,但希望获得任何提示或帮助,以解决我的配置可能出现的问题。

以下是gradle任务失败:

task removeUnusedArtifactsFromJbossRepository(dependsOn: ['outputTenantSettings', 'ensureValidTenant']) << {

    confirmToProceed("This command will remove unused artifacts from the Jboss Repository. Although this won't affect running systems, it may make manual rollbacks more difficult. Are you sure your wish to proceed?");

    def serverGroup = getTenantProperties('config.properties').server_group_name;

    ModelNode node = new ModelNode();
    node.get(ClientConstants.OP).set(ClientConstants.READ_RESOURCE_OPERATION);
    node.get(ClientConstants.OP_ADDR).add("/deployment");

    ModelNode result = getCommandHelper().getModelControllerClient().execute(node);

    def deployments = result.get("result").get("deployment");

    if(deployments.getType() == ModelType.UNDEFINED) {
        println "No artifacts to remove"
        return;
    }

    for(def deployment : deployments.asList()) {
        def deploymentName = deployment.asProperty().name
        if(deploymentName.contains("abc-web")) {

            println "Attempting to remove Deployment '${deploymentName}'"
            try {
                executeCliCommand("undeploy ${deploymentName}")
                println "Deployment '${deploymentName}'' removed"
            } catch(java.lang.IllegalArgumentException exception) {
                // JBAS014653 means that the file is deployed to servers and can't be removed
                // it's ok to ignore this
                if(exception.getMessage().contains("JBAS014653")) {
                    println "Deployment '${deploymentName}' cannot be removed as it's currently in use"
                } else {
                    throw exception;
                }
            }
        }
    }
}

经过进一步调查,我认为该脚本正在尝试从另一个服务器组(即abc-demo-latest)中删除一个部署,我需要保持该部署不变或取消部署。

在部署新版本之前,是否可以将脚本更改为仅从新创建的服务器组取消部署?

我尝试了以下方法:

if(serverGroup.equals("abc-demo-latest")) {
                println("Undeploying customer-abc-latest server group deployment ${deploymentName}")
                executeCliCommand("undeploy ${deploymentName}")
            }else{
                println("Undeploying customer-demo-ams-stable server group deployment ${deploymentName}")
                executeCliCommand("undeploy ${deploymentName} --server-groups=other-server-group --keep-content")
            }

但是出现以下错误:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:

在项目abc-parent上进行部署(默认部署):无法部署工件: 无法将工件abc-parent:pom:1.0.26从部署转移到部署(http://x.y.z:8080/nexus/content/repositories/releases/):  无法传输文件:http://x.y.z:8080/nexus/content/repositories/releases/abc-parent/1.0.26/abc-parent-1.0.26.pom。  返回码是:400,ReasonPhrase:错误的请求

1 个答案:

答案 0 :(得分:0)

关键在于您在此处发布的错误:

  

WFLYDC0043:无法从以下位置删除部署abc-web-1.0.101.war   域,因为服务器组[abc-demo-latest]仍在使用该域

您可能没有为所有服务器组执行 undeploy ,这就是为什么您不能从 domain 进行 undeploy 的原因。请参见 取消部署的文档。您可以使用以下命令从所有相关组中取消部署

  

取消部署* --all-relevant-server-groups

或仅一个服务器组:

  

取消部署* --server-groups = other-server-group