简体   繁体   中英

Jenkins and JBoss EAP 7.1.0.GA deployment Issue

I am having problem executing the deployment at the final stage of my jenkins job.

 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) 

I do not have access to the admin console at the moment, but will appreciate any hints or help to what could possibly be wrong with my configuration.

Below is the gradle task failing:

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;
                }
            }
        }
    }
}

After further investigation, I think the script is trying to delete a deployment from another server group ieabc-demo-latest, which I need to remain untouched or undeployed.

Is there a way I can change the script to only undeploy from the newly created server group, before deploying the new release?

I have tried the following:

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")
            }

But got the following error:

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

deploy (default-deploy) on project abc-parent: Failed to deploy artifacts: Could not transfer artifact abc-parent:pom:1.0.26 from/to deployment ( http://xyz:8080/nexus/content/repositories/releases/ ): Failed to transfer file: http://xyz:8080/nexus/content/repositories/releases/abc-parent/1.0.26/abc-parent-1.0.26.pom . Return code is: 400, ReasonPhrase: Bad Request

The key is in the error you posted there:

WFLYDC0043: Cannot remove deployment abc-web-1.0.101.war from the domain as it is still used by server groups [abc-demo-latest]

You might not have undeploy ed for all of the server groups and that's why you can't undeploy from the domain . See the docs for undeploy ing . There is a command where you can undeploy from all of the relevant groups:

undeploy * --all-relevant-server-groups

Or just one server group:

undeploy * --server-groups=other-server-group

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM