jenkins-pipelinejenkins-clijenkins-groovyxl-deploydeployit

How to disable a rollback when the deployment fails with XLDeploy


I'm searching on how to disable the rollback process when my deployment is broken ( is on error) with XLDeploy ( using the plugin within jenkinsFile).

the following possible strategies for deployment failures. The XL Deploy task can

Rollback the deployment Cancel the deployment Leave the deployment as-is ( I'm looking for this option without roll back) Is there a flag to pass to the XLDeploy ( or any approch ) to make sure that there is no need to perform a rollback when the deployment is failing?

here is my jenkins file pipeline

stage('Deploy') { 
xldDeploy serverCredentials: 'xld-admin', environmentId: 'Environments/env', packageId: 'Applications/app_new/1.0'

// where to put this option to cancel the rollback 
}

When i look to the source code I found this one on https://github.com/jenkinsci/xldeploy-plugin/blob/f11cdceb0ecb1ede28386c40a6303520f7225abe/src/main/java/com/xebialabs/deployit/ci/server/DeployCommand.java /// snippet

} catch (RuntimeException e) { 
try { 
if (deploymentOptions.rollbackOnError) { 
// perform a rollback 
listener.error("Deployment failed, performing a rollback"); 
executeTask(deploymentService.rollback(taskId)); 
} 
} finally { 
throw new DeployitPluginException(e.getMessage()); 
}

i.e as i undrestand there is this flag that control the rollback ( active or not) haw to use it on my JnekinsFile

Thank you


Solution

  • Currently these are available parameters for Deploying a package to a environment using jenkinsFile Pipeline Which doesnot have "Rollback On Error",

    xldDeploy: Step to deploy artifacts on environments in the XL Deploy server using Jenkins, Parameters:-

    serverCredentials Type: String

    packageId Type: String

    environmentId Type: String ID of the environment in XL Deploy to which the artifact should be deployed. Jenkins environment variables can be used to specify this value. For example: Environments/Dev

    overrideCredentialId (optional) Type: String

    This parameter is available through Jenkins UI only .. see below screenshot,

    enter image description here