DeployJob - createDeployJob_3
DeployJob - createDeployJob
Description :
This command creates either an advanced or basic Deploy Job for a BLPackage. Advanced Deploy Jobs provide greater flexibility than basic Deploy Jobs. Advanced Deploy Jobs let you schedule phases individually, control the flow of the job by server or phase, and manage the job's state after it executes by retrying or undoing the job. If a basic deploy job is create the advance scheduling options will not be available
This command also lets you set the option for following symlinks.
See a similar command, createDeployJob , to create a basic Deploy Job. Also, see the command createDeployJob to create an advanced Deploy Job with fewer options. createDeployJob to create an advanced Deploy Job without symlink following.
The argument groupId is the ID of the parent depot group containing the Deploy Job. Use a command like groupNameToId to determine this ID. The group ID used must be a job group, otherwise a group not found error will occur.
The argument packageKey provides the handle to the BLPackage to be deployed. Use the command getDBKeyByGroupAndName to get this handle.
The other arguments correspond to choices you can make when defining a Deploy Job in Configuration Manager. Note that for a basic Deploy Job, the values of isStagingAfterSimulate and isCommitAfterStaging should be false while for an advanced Deploy Job, these values are typically set to true. In addition, for a basic Deploy Job, isResetOnFailure should be set to true while for an advanced Deploy Job, isResetOnFailure can be either true or false.
The argument singleUserMode specifies the user mode option and it accepts one of the following values:
- 0: Use item defined user mode setting
- 1: Ignore item defined user mode setting
- 2: Use single-user mode without reboot
- 3: Reboot into single-user mode
The singleUserMode argument is valid on UNIX-style systems only. In addition, the argument isSUMEnabled has to be true for it to take effect.
The argument rebootMode specifies the reboot option and it accepts one of the following values:
- 0 - Use item defined reboot setting
- 1 - Ignore item defined reboot setting
- 2 - Use item defined reboot setting and reboot at end of job
- 3 - Ignore item defined reboot setting and reboot at end of job
- 4 - Consolidate any "After item deployment" reboots until end of job
The argument overrideItemReconfigReboot specifies the reconfigure reboot option for items and it accepts one of the following values:
- 0 - Use item defined reconfigure setting
- 1 - Ignore item defined reconfigure setting
Return type : DBKey
Command Input :
Variable Name | Variable Type | Description |
---|---|---|
deployJobName | String | Name assigned to this Deploy Job. |
groupId | Integer | ID of the job group where this job is saved. |
packageKey | DBKey | Handle associated with the BLPackage for this Deploy Job. |
deployType | Integer | Specifies whether this is a basic (0) or advanced (1) Deploy Job. |
serverName | String | Server where you want to run this job. |
isSimulateEnabled | Boolean | True indicates the job should include a Simulate phase, during which a dry run is performed without actually deploying the package. |
isCommitEnabled | Boolean | True indicates the job should include a Commit phase, during which the package is actually applied to the target server. |
isStagedIndirect | Boolean | True indicates the package is delivered to a server functioning as a repeater. During the Commit phase, the package is actually applied to the target server. |
logLevel | Integer | Specifies the level of logging to display for the job (0 - ERROR_ONLY, 1 - ERROR_AND_WARNING, 2 - ALL_INFO) |
isExecuteByPhase | Boolean | True indicates the flow of the job should be controlled by phase; false indicates the flow is controlled by server. This argument should be set to false for a basic Deploy Job. |
isResetOnFailure | Boolean | True indicates the job is automatically reset on failure. This argument should be set to true for a basic Deploy Job. |
isRollbackAllowed | Boolean | True indicates that rollback files are left on the target for later use. |
isRollbackOnFailure | Boolean | True indicates the job should automatically roll back on failure. |
isRebootIfRequired | Boolean | True indicates the server should automatically reboot if necessary. |
isCopyLockedFilesAfterReboot | Boolean | True indicates locked files are copied after reboot; false indicates locked files are treated as errors. |
isStagingAfterSimulate | Boolean | True indicates staging should start immediately after the Simulate phase is complete. Set this value to false for a basic Deploy Job. For an advanced Deploy Job, this value is typically set to true. |
isCommitAfterStaging | Boolean | True indicates the Commit phase should start immediately after staging is complete. This value should be set to false for a basic Deploy Job. For an advanced Deploy Job, this value is typically set to true. |
isSingleDeployModeEnabled | Boolean | True indicates the job should run in single deploy mode. Default is false. |
isSUMEnabled | Boolean | True indicates that single user mode is enabled, false otherwise. Default is true. |
singleUserMode | Integer | If isSUMEnabled is set to true, this variable indicates the setting of the single user mode. Default is 0. |
rebootMode | Integer | Indicates which reboot mode to use. Default is 0. |
isMaxWaitTimeEnabled | Boolean | True indicates the Max. Wait Time in Deploy Queue option is enabled. Default is false. |
maxWaitTime | String | How long a job can wait in the deploy queue before it is declared failed. Expressed in seconds. Default is 30. This variable takes effect only when isMaxWaitTimeEnabled is set to true. |
isMaxAgentConnectionTimeEnabled | Boolean | True indicates the Max. Agent Connection Time option is enabled. Default is false. |
maxAgentConnectionTime | Integer | The maximum time (in seconds) to try to establish a connection to an agent. This variable takes effect only if isMaxAgentConnectionTimeEnabled is set to true. Default is 60. |
isFollowSymlinks | Boolean | True indicates that the Deploy Job should follow symlinks on remote repositories, and copy source files if copying at staging. (To specify copying at staging, set urlTypeName to AGENT_COPY_AT_STAGING in whatever DepotSoftware command you are using to create the software object.) Default is false. |
useReconfigRebootAtEndOfJob | Boolean | True if the final reboot on a Solaris system should use a reconfiguration reboot. This value will be ignored unless the reboot option is set >=2. Default is false. |
overrideItemReconfigReboot | Integer | This argument indicates whether or not an item based reconfigure reboot on Solaris is allowed. Default is 0 (use item based reconfigure setting). If you set this argument to 1 (ignore item defined reconfigure setting), then the items that request a reconfigure reboot will only do a reboot. |
Example
In the following example, an advanced Deploy Job includes a Simulate phase, which runs first, followed by a Commit phase. This job specifies a server group as its target.
Script
#
# script constants
#deploy type
ADVANCED=1
BASIC=0
#logging level
ERROR_ONLY=0
ERROR_AND_WARNING=1
ALL_INFO=2
JOB_GROUP_NAME=/deploys
TARGET_SERVER=scavmnode30
TARGET_GROUP="/east/windows servers"
DEPLOY_JOB_NAME="deploy base files"
DEPLOY_TYPE=$ADVANCED
SIMULATE=true
COMMIT=true
INDIRECT=false
LOG_LEVEL=$ERROR_AND_WARNING
EXECUTE_BY_PHASE=true
RESET_ON_FAILURE=false
ALLOW_ROLLBACK=true
ROLLBACK_ON_FAILURE=true
REBOOT_IF_REQUIRED=true
COPY_LOCKED_FILES=true
STAGE_AFTER_SIMULATE=true
COMMIT_AFTER_STAGE=true
SINGLE_DEPLOY_MODE=false
ENABLE_SINGLE_USER_MODE=true
SINGLE_USER_MODE=0
REBOOT_MODE=0
ENABLE_MAX_DEPLOY_WAIT_TIME=true
MAX_DEPLOY_WAIT_TIME=30
ENABLE_AGENT_CONN_TIMEOUT=true
AGENT_CONN_TIMEOUT=60
FOLLOW_SYMLINKS=true
IS_RECONFIGURE_REBOOT_AT_JOB_LEVEL=true
ITEM_RECONFIGURE_REBOOT=0
BASIC_DEPLOY_OPTS="$SIMULATE $COMMIT $INDIRECT"
ADVANCED_OPTS="$LOG_LEVEL"
ADVANCED_OPTS="${ADVANCED_OPTS} $EXECUTE_BY_PHASE"
ADVANCED_OPTS="${ADVANCED_OPTS} $RESET_ON_FAILURE"
ADVANCED_OPTS="${ADVANCED_OPTS} $ALLOW_ROLLBACK"
ADVANCED_OPTS="${ADVANCED_OPTS} $ROLLBACK_ON_FAILURE"
ADVANCED_OPTS="${ADVANCED_OPTS} $REBOOT_IF_REQUIRED"
ADVANCED_OPTS="${ADVANCED_OPTS} $COPY_LOCKED_FILES"
ADVANCED_OPTS="${ADVANCED_OPTS} $STAGE_AFTER_SIMULATE"
ADVANCED_OPTS="${ADVANCED_OPTS} $COMMIT_AFTER_STAGE"
ADVANCED_OPTS="${ADVANCED_OPTS} $SINGLE_DEPLOY_MODE"
ADVANCED_OPTS="${ADVANCED_OPTS} $ENABLE_SINGLE_USER_MODE"
ADVANCED_OPTS="${ADVANCED_OPTS} $SINGLE_USER_MODE"
ADVANCED_OPTS="${ADVANCED_OPTS} $REBOOT_MODE"
ADVANCED_OPTS="${ADVANCED_OPTS} $ENABLE_MAX_DEPLOY_WAIT_TIME"
ADVANCED_OPTS="${ADVANCED_OPTS} $MAX_DEPLOY_WAIT_TIME"
ADVANCED_OPTS="${ADVANCED_OPTS} $ENABLE_AGENT_CONN_TIMEOUT"
ADVANCED_OPTS="${ADVANCED_OPTS} $AGENT_CONN_TIMEOUT"
ADVANCED_OPTS="${ADVANCED_OPTS} $FOLLOW_SYMLINKS"
ADVANCED_OPTS="${ADVANCED_OPTS} $IS_RECONFIGURE_REBOOT_AT_JOB_LEVEL"
ADVANCED_OPTS="${ADVANCED_OPTS} $ITEM_RECONFIGURE_REBOOT"
DEPLOY_OPTS="${BASIC_DEPLOY_OPTS} ${ADVANCED_OPTS}"
PACKAGE_KEY=`blcli BlPackage [getDBKeyByGroupAndName|DeployJob - getDBKeyByGroupAndName] /basefiles "base files"`
GROUP_ID=`blcli JobGroup [groupNameToId|JobGroup - groupNameToId] "${JOB_GROUP_NAME}"`
DEPLOY_JOB_KEY=`blcli DeployJob [createDeployJob|DeployJob - createDeployJob_1] "${DEPLOY_JOB_NAME}" $GROUP_ID $PACKAGE_KEY $DEPLOY_TYPE $TARGET_SERVER $DEPLOY_OPTS`
DEPLOY_JOB_KEY=`blcli Job [addTargetGroup|Job - addTargetGroup] $DEPLOY_JOB_KEY "${TARGET_GROUP}"`