DeployJob - undoDeployByDBKeyAndRunId
DeployJob - undoDeployByDBKeyAndRunId
Description :
This command performs an undo (that is, a rollback) of a specific successful run of a Deploy Job. For an undo to succeed, rollback must have been enabled on the job when it was originally executed.
This command creates an undo job and waits until the undo job completes, before returning a run key. You can use the run key to view the real status of the undo job by using commands in the JobRun namespace.
The argument deployJobKey is the handle to the Deploy Job you want to undo. To find the jobKey, you can use the getDBKeyByGroupAndName command.
The argument jobRunId is the ID of the specific job run of the Deploy Job you want to undo. To find the jobRunId, use the command DeployJobRun:findLastRunIdByJobKey. This command returns the undo job run key.
Return type : com.bladelogic.om.infra.model.job.jobrun.JobRun
Command Input :
Variable Name |
Variable Type |
Description |
---|---|---|
deployJobKey |
DBKey |
Handle of the Deploy Job you want to undo. |
jobRunId |
Integer |
ID of the specific job run to undo. If (as shown in the example) you are using the DeployJobRun:findLastRunIdByJobKey command to get the job run ID, this is the latest run associated with the specific version of the job that the jobKey represents. |
Example
The following example shows how to use the undoDeployByDBKeyAndRunId command.
Script
# Obtain the DBKey of the Deploy Job you want to undo.
# Obtaining the JOB_KEY in this way provides you with the latest version of the job.
JOB_KEY=`blcli DeployJob getDBKeyByGroupAndName "/sample_deploys" "test_undo_deploy_job"`
# Get the ID of the last run of the Deploy Job you want to undo.
JOB_RUN_ID=`blcli DeployJobRun findLastRunIdByJobKey $JOB_KEY`
# Undo the last run of the Deploy Job.
UNDO_RUN_KEY=`blcli DeployJob undoDeployByDBKeyAndRunId $JOB_KEY $JOB_RUN_ID`
blcli JobRun getJobRunHadErrors $UNDO_RUN_KEY
# This command returns true if errors occurred, and false otherwise. You can also use additional JobRun commands to get more status information.
Comments
Log in or register to comment.