Deployer 10.11 | Using Deployer Commands | Creating and Running Scripts
 
Creating and Running Scripts
You can enter Deployer commands at a command prompt or you can create scripts that execute commands automatically. If you create a script, Deployer runs the commands in the order in which they appear in the script.
To invoke Deployer from the command line and execute a script, use the command for your operating system as follows:
For...
Command
Windows or UNIX
Deployer.{bat|sh} path_to_file
Mac
deployerMac.sh path_to_file
You can also call scripts from other automated procedures, such as other scripts.
The following sample script automates these tasks on a Windows system:
*Imports a build that was exported from a test environment. Deployer automatically creates the deployment project and deployment sets.
*Displays the build contents on the console.
*Imports the deployment map.
*Imports substitute configuration values for Integration Server assets into the deployment map.
*Creates a deployment candidate.
*Generates a checkpoint, simulates the deployment, and deploys the build.
:environment
set host=%1
set port=%2
set user=%3
set pwd=%4
set project=testProject
set build=DemoBuild
set depCandidate=DemoDC
set depMap=DemoMap
rem ----clear the ERRORLEVEL system variable to avoid any side effects of
previous executions cases
set ERRORLEVEL=
:importBuild
set importB=%proj ect%_ExportedBuild_%build%
IF "% ERRORLEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO Importing Build %ImportB%
ECHO ---------------------------------------------------------------------------
call Deployer.bat --import -buildFile %importB% -host %host% -port %port% -user
%user% -pwd %pwd%
@echo off
echo.
echo.
echo.
set importB=
set nextAction=describeBuild
GOTO verifyStatus
:describeBuild
IF "%ERROR LEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO Describing %build%
ECHO ---------------------------------------------------------------------------
call Deployer. bat --describe -build %build% -project %project% -host %host% -port
%port% -user %user% -pwd %pwd%
@echo off
echo.
echo.
echo.
set nextAction=buildit
GOTO verifyStatus
:importMap
set importM=%project%_%depMap%.map
IF "%ERRORLEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO Importing Map %ImportM%
ECHO ---------------------------------------------------------------------------
call Deployer.bat --import -mapFile %importM% -project %project% -host %host%
-port
%port% -user %user% -pwd %pwd%
@echo off
echo.
echo.
echo.
set importM=
set nextAction=importVarSub
GOTO verifyStatus

:importVarSub
set importV=%project%_%depMap%.vs
IF "%ERRORLEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO Importing Varsub %ImportV%
ECHO ---------------------------------------------------------------------------
call Deployer.bat --import -varsub -vsFile %importV% -map %depMap% -project
%project% -host %host% -port %port% -user %user% -pwd %pwd%
@echo off
echo.
echo.
echo.
set importV=
set nextAction=createDC
GOTO verifyStatus

:createDC
IF "%ERRORLEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO Creating Deployment Candidate %depCandidate%
ECHO --------------------------------------------------------------------------
call Deployer.bat --create -dc %depCandidate% -build %build% -map %depMap%
-project
%project% -host %host% -port %port% -user %user% -pwd %pwd%
@echo off
echo.
echo.
echo.
set nextAction=simulate
GOTO verifyStatus
:simulate
IF "%ERRORLEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO Performaing deployment simulation on deployment candidate %depCandidate%
ECHO ---------------------------------------------------------------------------
call Deployer.bat -host %host% -port %port% -user %user% -pwd %pwd%
--simulate -project %project% -dc %depCandidate%
@echo off
echo.
echo.
echo.
set nextAction=checkpoint
GOTO verifyStatus
:checkpoint
IF "%ERRORLEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO Performing CHECKPOINT operation of %depCandidate%
ECHO ---------------------------------------------------------------------------
echo %project%
echo %depCandidate%

call Deployer.bat --checkpoint -project %project% -dc %depCandidate% -host %host%
-port %port% -user %user% -pwd %pwd%
@echo off
echo .
echo .
echo .
set nextAction=deploy
GOTO verifyStatus
:deploy
IF "%ERRORLEVEL%" == "8" GOTO FINISH
ECHO ---------------------------------------------------------------------------
ECHO DEPLOYING %depCandidate%

:VerifyStatus
IF "%ERRORLEVEL%" == "8" ECHO "<<<ERROR>>>"
IF "%ERRORLEVEL%" == "4" ECHO "<<<WARNING>>>"
IF "%ERRORLEVEL%" == "0" ECHO "<<<SUCCESS>>>"
echo.
echo.
goto %nextAction%
:FINISH
echo.
echo.
echo Completed.
set host=
set port=
set user=
set pwd=
set project=
set build=
set depCandidate=
set ERRORLEVEL=
@echo on