What's new?

Please see Tools - Version Organizer - Release Notes for more information.

Purpose

The purpose of the Version Organizer is to free some disk space from the delivery folder :

  • By archiving all application versions that have been accepted and deployed, except for "Current Version" and a given number of previous ones
  • Or destroying all application versions that have not yet been accepted
  • Or both at the same time



For more information on Version Status, refer to DMT - Version status

The Version Organizer may be used for a single application, or in an automated multi-application mode.

Its main component is a Groovy script that can be used in many different ways. Hence the following file tree:

File Tree
  • Main Component : PmcCleanUpVersions.cgroovy:  
  • Folder SingleApplication:
    • Batch for archiving only : SingleApplicationArchiveDeployedVersions.bat
    • Batch for destroying only : DestroyedUnacceptedVersions.bat
    • Batch for doing both: SingleApplicationDestroyAndArchive.bat
  • Folder MultiApplications:
    • Folder generator:
      • Tool generate_batch_for_version_archiver.py
      • Generator Batch for archiving only : GenerateBatchArchiveDeployedVersions.bat
      • Generator Batch for destroying only : GenerateBatchDestroyUnacceptedVersions.bat 
      • Generator Batch for doing both: GenerateBatchDestroyAndArchive.bat 

This tool is provided by Maintenance Team, and published as an extension com.castsoftware.labs.tools.versionorganizer

Applicable in CAST Version
Release
Yes/No
8.3.x(tick) 
Applicable RDBMS
RDBMS
Yes/No
CSS3(tick)
CSS2(tick)

Prerequisites

 Follow the below prerequisites before running the tool:

CAST-AIP

CAST-AIP must be installed on the server where you launch the scripts.

Delivery Folder

The delivery folder should be accessible from the server where you launch the scripts.

BACKUPS

Take a backup of the triplet before proceeding.
Take a zip of the delivery folder before proceeding

Single-Application Mode

If you mean to process one application only, configure one of the batch files in subfolder SingleApplication, depending on the operation you mean to run:

  • SingleApplicationArchiveDeployedVersions.bat : Archive all versions that have been accepted and deployed, except for "Current Version" and a given number of previous ones
  • SingleApplicationDestroyUnacceptedVersions.bat : Destroy all version that have not yet been accepted
  • SingleApplicationDestroyAndArchive.bat : Both at the same time

Configuration

The batch file must be configured with the following mandatory variables : FLATDIR, LOGDIR, CONNECTION_PROFILE, APP_NAME

There are optional variables : TEMPDIR, NUMBER

Configuration - Single-Application Mode

REM Mandatory
set "FLATDIR=<CAST AIP Installation PATH>"
set "LOGDIR=<Path to the log folder>"
set "CONNECTION_PROFILE=<Connection Profile>"
set "APP_NAME=<Application Name>"

REM Optional
set "TEMPDIR=%TEMP%"
set NUMBER=2

FLATDIR must be set to the CAST Installation path
LOGDIR must be set to the folder where the log file of the Main Component should be generated
CONNECTION_PROFILE must be set to the connection profile to the application
APP_NAME must be set to the application name

TEMPDIR is a temporary folder. Your user must have read, write and execute rights on it.  Default is %TEMP%
NUMBER is the number of deployed versions to keep (including "Current Version"). Default is 2 (ie Current Version and its previous version)

Simulate then execute

Usage

First launch the batch you have configured with no argument. It will run in Simulation mode, and write to the log file what it would do in Execution mode

cmd

C:\ProgramData\CAST\CAST\Extensions\com.castsoftware.versionorganizer.1.0.0\SingleApplication> SingleApplicationDestroyAndArchive.bat

DestroyAndArchive-20191212174634.log
Running action: Executes a groovy script
	
	Version Manager - version 1.0
	Using CAST-AIP version 8.3.16
		
	Script running in SIMULATION MODE
	
	Application Hopefully Last Test found
	
	Keeping Current Version : 10.0 (dmtid:41917dd8-3424-40c0-9a22-a557239889f9)
	Keeping version 8.0 (dmtid:4dc4df21-c622-4161-ac4b-932d4b394960)
	
	Examining 9.0; entry = dmtid:c06763f3-1d6b-4c1b-b926-b5d9f00e1f0f
	Version 9.0 (dmtid:c06763f3-1d6b-4c1b-b926-b5d9f00e1f0f) is already purged
	
	Examining 7.0; entry = dmtid:4224e9f7-cef6-41d7-9464-74a7bebda7b6
	Adding 7.0 (dmtid:4224e9f7-cef6-41d7-9464-74a7bebda7b6) to archive
	
	Examining 10.0; entry = dmtid:41917dd8-3424-40c0-9a22-a557239889f9
	Version 10.0 (dmtid:41917dd8-3424-40c0-9a22-a557239889f9) must be kept
	
	Examining 8.0; entry = dmtid:4dc4df21-c622-4161-ac4b-932d4b394960
	Version 8.0 (dmtid:4dc4df21-c622-4161-ac4b-932d4b394960) must be kept
	
	Simulation finished
Saving document: Executes a groovy script

If you are satisfied with the simulation, then run the batch with argument doit. It will run in Execution mode.

cmd

C:\ProgramData\CAST\CAST\Extensions\com.castsoftware.versionorganizer.1.0.0\SingleApplication> SingleApplicationDestroyAndArchive.bat doit

DestroyAndArchive-20191212175235.log
Running action: Executes a groovy script
	
	Version Manager - version 1.0
	Using CAST-AIP version 8.3.16
	
	Script running in EXECUTION MODE
	
	Application Hopefully Last Test found
	
	Cleaning-up Management Base
	Done cleaning-up Management Base : removed 0 entries
	
	Keeping Current Version : 10.0 (dmtid:41917dd8-3424-40c0-9a22-a557239889f9)
	Keeping version 8.0 (dmtid:4dc4df21-c622-4161-ac4b-932d4b394960)
	
	Examining 9.0; entry = dmtid:c06763f3-1d6b-4c1b-b926-b5d9f00e1f0f
	Version 9.0 (dmtid:c06763f3-1d6b-4c1b-b926-b5d9f00e1f0f) is already purged
		
	Examining 7.0; entry = dmtid:4224e9f7-cef6-41d7-9464-74a7bebda7b6
	Adding 7.0 (dmtid:4224e9f7-cef6-41d7-9464-74a7bebda7b6) to archive
		
	Examining 8.0; entry = dmtid:4dc4df21-c622-4161-ac4b-932d4b394960
	Version 8.0 (dmtid:4dc4df21-c622-4161-ac4b-932d4b394960) must be kept
		
	Examining 10.0; entry = dmtid:41917dd8-3424-40c0-9a22-a557239889f9
	Version 10.0 (dmtid:41917dd8-3424-40c0-9a22-a557239889f9) must be kept
		
	Start processing...
	Archiving 7.0 (dmtid:4224e9f7-cef6-41d7-9464-74a7bebda7b6)
	starting Task Delete source code from Delivery
	Remaining iterations : 1
	Done !
Saving document: Executes a groovy script
Document saved: Executes a groovy script (Duration: 1829 ms)
Return value: 0
[ ... ]
Running action: Executes a groovy script
	
	Version Manager - version 1.0
	Using CAST-AIP version 8.3.16
	
	Script running in EXECUTION MODE
	
	Application Hopefully Last Test found
	
	Cleaning-up Management Base
	Done cleaning-up Management Base : removed 0 entries
	
	Keeping Current Version : 10.0 (dmtid:41917dd8-3424-40c0-9a22-a557239889f9)
	Keeping version 8.0 (dmtid:4dc4df21-c622-4161-ac4b-932d4b394960)
	
	Examining 7.0; entry = dmtid:4224e9f7-cef6-41d7-9464-74a7bebda7b6
	Version 7.0 (dmtid:4224e9f7-cef6-41d7-9464-74a7bebda7b6) is already purged
	
	Examining 9.0; entry = dmtid:c06763f3-1d6b-4c1b-b926-b5d9f00e1f0f
	Version 9.0 (dmtid:c06763f3-1d6b-4c1b-b926-b5d9f00e1f0f) is already purged
	
	Examining 8.0; entry = dmtid:4dc4df21-c622-4161-ac4b-932d4b394960
	Version 8.0 (dmtid:4dc4df21-c622-4161-ac4b-932d4b394960) must be kept
	
	Examining 10.0; entry = dmtid:41917dd8-3424-40c0-9a22-a557239889f9
	Version 10.0 (dmtid:41917dd8-3424-40c0-9a22-a557239889f9) must be kept
	
	Start processing...
	Final run
	Done !
Saving document: Executes a groovy script
Document saved: Executes a groovy script (Duration: 1829 ms)
Return value: 0

You can now reopen CAST-MS and check the results :

Multi-Application Mode

Running the Version Organizer on several applications in a row requires a multi-application batch file.
The multi-application batch file depends on the connection profiles defined for the CAST AIP Installation you are running.
This is why a generator tool needs to be launched on the machine to generate it.
The generator tool is located in the generator subfolder, and can be launched with different options, depending on the operation you mean to run.
That is why there are three different generator batch files in the generator subfolder.

Configure one of the generator batch files in subfolder MultiApplications\generator, depending on the operation you mean to run:

  • GenerateBatchArchiveDeployedVersions.bat: Archive all versions that have been accepted and deployed, except for "Current Version" and a given number of previous ones
  • GenerateBatchDestroyUnacceptedVersions.bat: Destroy all version that have not yet been accepted
  • GenerateBatchDestroyAndArchive.bat:  Both at the same time

Generator Configuration 

The generator batch file must be configured with the following mandatory variables : FLATDIR, LOGDIR, CAST_VERSION

There are optional variables : TEMPDIR, NUMBER, DB_USERNAME, DB_PASSWORD

Generator Configuration - Multi-Application Mode

REM Mandatory
set "FLATDIR=<CAST AIP Installation PATH>"
set "LOGDIR=<Path to the log folder>"
set CAST_VERSION=<CAST Version>

REM Optional
set "TEMPDIR=%TEMP%"
set NUMBER=2
set DB_USERNAME=operator
set DB_PASSWORD=CastAIP

FLATDIR must be set to the CAST Installation path
LOGDIR must be set to the folder where the log file of the Main Component should be generated
CAST_VERSION must be set to the version of CAST AIP

TEMPDIR is a temporary folder. Your user must have read, write and execute rights on it.  Default is %TEMP%
NUMBER is the number of deployed versions to keep (including "Current Version"). Default is 2 (ie Current Version and its previous version)
DB_USERNAME should be the username to connect to your DB servers (here we assume it is the same for all connection profiles) Default is operator
DB_PASSWORD should be the password to connect to your DB servers (here we assume it is the same for all connection profiles) Default is CastAIP

Generate batch file

Launch the generator batch file you have configured. The output will be a multi-application batch file located in subfolder MutliApplications

  • GenerateBatchArchiveDeployedVersions.bat will generate ArchiveDeployedVersions.bat
  • GenerateBatchDestroyUnacceptedVersions.bat will generate DestroyUnacceptedVersions.bat
  • GenerateBatchDestroyAndArchive.bat will generate DestroyAndArchive.bat

Simulate then execute

Usage

First launch the multi-application batch you have generated, with no argument. It will run in Simulation mode, and write to the log file what it would do in Execution mode

cmd

C:\ProgramData\CAST\CAST\Extensions\com.castsoftware.versionorganizer.1.0.0\MultiApplications> DestroyAndArchive.bat

If you are satisfied with the simulation, then run the multi-application batch with argument doit. It will run in Execution mode.

cmd

C:\ProgramData\CAST\CAST\Extensions\com.castsoftware.versionorganizer.1.0.0\MultiApplications> DestroyAndArchive.bat doit

Related Pages



Notes