cram is a utility to support multi-site/multi-facility development and deployment of EPICS IOC and HLA (High level applications) software to multiple sites/facilities/accelerator programs/beamlines. cram allows one to build once in a development environment and then deploy multiple times into different IOCs on different sites.
EPICS IOC applications have these features.
HLA applications have these features.
To see more details on the folder structure of IOC and HLA apps, please see this document.
A typical development/deployment cycle using cram is as follows
cram is a command line tool written in Python (targeting Python 2.4+). cram syntax is similar to CVS and GIT in that cram takes a command as a first argument. To get a list of commands that cram supports, simple type cram in a Linux command prompt:
sh-3.2$ cram
Usage: cram <action> <args>.
cram is the main script for the multi site/facility release management system
To do something with cram, please specify the action that you'd like to perform.
For a list of actions, just type cram.
To get help for a particular action, use cram <action> --help.
For example, to get help on cram ls, do cram ls --help or cram ls -h
Actions currently supported are --
ls List the releases currently being used by IOC/HLA/other.
...
For example, to list the current release(s), type cram ls in a folder containing your software package in your development system:
sh-3.2$ cram ls
Current versions on facility: FACET
Current release v3
IOC: sioc-ms-002 => v3
...
Note, one does not necessarily have to be in a folder containing your software package. There are enough options to run cram from anywhere in the file system on development. However, cram is meant to be used principally from the development systems.
You do not need to type in the complete command when using cram. As long as cram has enough information to determine unambiguously what you mean, partial commands are acceptable. For example, given the list of commands above, cram up is an acceptable substitute for cram upgrade. However, it is recommended that the full command name be used in automation scripts to guard against new commands being added to cram.
For all the commands, cram uses the ${PWD}/.cram/packageinfo to determine the name of the software package and its type. If cram is being executed from a folder that does not contain a .cram/packageinfo and you do not want to create one in the current working folder, you can specify the name and type using command line options.
cram has support for specifying rsync include and exclude files as part of your software package. These can also be specified on a per facility basis. The files .cram/push_exclude and .cram/push_include are included when pushing to all facilities. The files .cram/<facility_name>_push_exclude and .cram/<facility_name>_push_include are included when pushing to facility with name <facility_name>. At a very high level, these are files with lists of patterns, one pattern per line. Patterns can be files, folders or entire trees. For more details of how these files work, please see the documentation for rsync for the --include and --exclude commands. Also see http://masstransmit.com/garage_blog/rsync-quirks/ for some useful patterns.
Some examples
Add *.o to .cram/push_exclude to exclude all .o files
Add configure/** to .cram/push_exclude to exclude all content from the configure folder.
Add mgntApp/** to .cram/FACET_push_exclude to exclude all content from the mgntApp folder when pushing to FACET.
cram has support for running custom scripts during the upgrade and revert processes. The file bin/preDeploy is automatically executed (if it exists) in the target facility before the upgrade process. The file bin/postDeploy is automatically executed (if it exists) in the target facility after the upgrade process. These can be bash or python scripts or any file that can be executed in a Linux environment. Please do remember to make these files executable. Note that when cram is used to upgrade ALL IOCs in a facility, these custom scripts will be called once when switching the MASTER link and once for each IOC. Before calling these scripts, cram sets several environment variables that can be used to switch on or switch off functionality.
In addition to these custom scripts, cram also runs some internal scripts as part of a push.
Currently, cram has support for