Jenkins_FileCenter_Beta_Deploy
@ECHO OFF
ECHO ***************************************************************************************************
ECHO ********** Deploy FileCenter For Beta Environment *************************************************
ECHO ***************************************************************************************************
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::Init environment and check before deployment
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
IF %1]==] GOTO Usage
IF %2]==] GOTO Usage
IF %3]==] GOTO Usage
SET @VersionNumber=%1
SET @BackupBuildNumber=%2
SET @IsBackup=%3
SET @AppName=FileCenter
SET @TargetAppName=%@AppName%_B
SET @PackageName=%@AppName%-%@VersionNumber%.Latest.zip
SET @AppInfo=%@AppName%/%@TargetAppName%/%@PackageName%
SET @SourcePackageDir=\\morningstar.com\shares\DMRawData\JenkinsPackageFiles\DeployPackages\GPP\%@AppName%
SET @TargetBackupDir=\\morningstar.com\shares\DMRawData\JenkinsPackageFiles\PackagesBackup
SET @TargetDir=D$\Processes\Performance
SET @TargetServerInfos=SZGFDEVAP13/1/1
SET @TargetEnvironment=Beta
SET @DependedStopServices=SZGFDEVRetrvAP11/DMWatchServices_DMBetaDownloader SZGFDEVAP11/DMWatchServices_Importer SZGFDEVAP12/DMWatchServices_Importer SZGFDEVAP11/DMWatchServices_Parser SZGFDEVAP12/DMWatchServices_Parser SZGFDEVAP13/DMWatchServices_FileCenter
SET @DependedStartServices=SZGFDEVAP13/DMWatchServices_FileCenter SZGFDEVRetrvAP11/DMWatchServices_DMBetaDownloader SZGFDEVAP11/DMWatchServices_Importer SZGFDEVAP12/DMWatchServices_Importer SZGFDEVAP11/DMWatchServices_Parser SZGFDEVAP12/DMWatchServices_Parser
ECHO ***************************************************************************************************
ECHO ***** Check current environment info
ECHO ***************************************************************************************************
ECHO ::AppName ----------------- %@AppName%
ECHO ::TargetAppName ----------- %@TargetAppName%
ECHO ::PackageName ------------- %@PackageName%
ECHO ::IsBackup ---------------- %@IsBackup%
ECHO ::PackageName ------------- %@PackageName%
ECHO ::SourcePackageDir -------- %@SourcePackageDir%
ECHO ::TargetBackupDir --------- %@TargetBackupDir%
ECHO ::TargetDir --------------- %@TargetDir%
ECHO ::TargetServerInfos ------- %@TargetServerInfos%
ECHO ::TargetEnvironment ------- %@TargetEnvironment%
ECHO ::DependedStopServices ---- %@DependedStopServices%
ECHO ::DependedStartServices --- %@DependedStartServices%
ECHO ***************************************************************************************************
ECHO ***** You can cancle it during 9 seconds
ECHO ***************************************************************************************************
FOR /l %%i in (1,1,9) DO (
ECHO ***** Cancel it ? %%i seconds past ...
PING 127.0.0.1 -n 2 > nul )
ECHO ***************************************************************************************************
ECHO ***** Stop related services
ECHO ***************************************************************************************************
FOR %%S IN (%@DependedStopServices%) DO ( CALL StopService.bat %%S IF ERRORLEVEL 1 GOTO ExitError )
ECHO ***************************************************************************************************
ECHO ***** Deploy Applications
ECHO ***************************************************************************************************
FOR %%I IN (%@TargetServerInfos%) DO (
CALL FileCenter_Deploy.bat %@AppInfo% %@SourcePackageDir% %@IsBackup% %@BackupBuildNumber% %@TargetBackupDir% %@TargetDir% %%I %@TargetEnvironment%
IF ERRORLEVEL 1 GOTO ExitError
)
ECHO ***************************************************************************************************
ECHO ***** Start related services
ECHO ***************************************************************************************************
FOR %%S IN (%@DependedStartServices%) DO ( CALL StartService.bat %%S IF ERRORLEVEL 1 GOTO ExitError )
ECHO ***************************************************************************************************
ECHO ***** Deployment finish
ECHO ***************************************************************************************************:
ECHO INFO : ## Deploy "%@AppName%" successfully
EXIT /B 0
:ExitError
ECHO ***************************************************************************************************
ECHO ***** Deployment finish
ECHO ***************************************************************************************************
ECHO Error : ** Deploy "%@AppName%" failed
EXIT /B 1
:Usage
ECHO Usage: %0 VersionNumber BUILD_NUMBER IsBackup
ECHO Example: %0 1.0.1 1 N