AntCC is Software AG DevOps tool to support Infrastructure as Code projects for Command Central. It is based on well-known Apache Ant build automation framework.
The tool defines a typical Command Central Infrastructure project structure and provides default targets (commands) for developing and testing.
Requirements:
- Apache Ant 1.9.x
- Java 1.8.x
- Git client
git clone https://github.com/SoftwareAG/sagdevops-antcc.git antcc
cd antcc
bin/antcc client
Add to the PATH:
export ANTCC_HOME=`pwd`
export PATH=$PATH:$ANTCC_HOME/bin
If you don't Apache Ant but have Java 1.8+, you can install the tool using these commands.
On Linux and Mac OS:
curl https://raw.githubusercontent.com/SoftwareAG/sagdevops-antcc/release/104apr2019/bootstrap/install.sh | sh
On Windows:
powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/SoftwareAG/sagdevops-antcc/release/104apr2019/bootstrap/install.ps1'))"
Complete project structure looks like this:
build.xml
bootstrap/
default.properties
other.properties
clients/
default.properties
other.properties
default/
cc.properties
other/
cc.properties
environments/
default/
env.properties
other/
env.properties
templates/
template1/
template.yaml
template2/
template.yaml
tests/
suite1/
test1.xml
test2.xml
test3.xml
test4.xml
Most folders and files are optional and each of them are described below.
ANTCC tool provides generic targets to download and then bootstrap Command Central server, CC CLI or SPM. Bootstrap folder is optional and allows to customize bootstrap parameters.
bootstrap
default.properties
custom.properties
Default targets provided by bootstrap plugin:
ant -f lib/bootstrap.xml -S
Optional parameter for any target:
-Dbootstrap=other Bootstrap local Command Central server
using defaults from 'bootstrap/default.properties'
or custom 'bootstrap/other.properties'
Targets:
ant boot Bootstrap local Command Central server
ant client Bootstrap local CC CLI (client)
ant agent Bootstrap local SPM (agent)
ant installers -Dinstallers=f1,f2 Download bootstrap installers
ant upgrade Upgrade local Command Central server
ant startcc Start local Command Central server
ant stopcc Stop local Command Central server
You MUST bootstrap at least 'client' if not complete Command Central server locally in order to execute other project targets.
After Command Central server or client is bootstrapped the default client configuration is available for the current user, typically in ~/.sag/cc.properties file.
This configuration is used by default.
If you want your project to use a different client configuration file make a copy of the configuration file and store it as client/default.properties.
You can have as many client configuration files as you need.
clients
default.properties
custom.properties
Default targets provided by sagcc plugin:
ant -f lib/sagcc.xml -S
Optional parameter for any target:
-Dcc=other Connection to Command Central server
using global settings in '~/.sag/cc.properties'
or project defaults from 'clients/cc.properties'
or custom 'clients/other.properties'
Targets:
ant waitcc Wait for Command Central ready status
ant restartcc Restart local or remote Command Central server
ant jobs List recent jogs
ant killjobs Cancel active and remove completed jobs
ant log Show tail of Command Central default log
ant logs Show tail of agents default log
Project can operate with a single default environment or multiple environments.
The default environment configuration is stored in environments/default/env.properties file.
For additonal environments create a separate folder and place env.properties file there. The final structure looks like this:
environments
default
env.properties
other
env.properties
After the environments are defined you can apply existing templates
Default targets provided by sagenv plugin:
ant -f lib/sagenv.xml -S
Optional parameter for any target:
-Denv=other Environment configuration to use from
project defaults in 'environments/default/env.properties'
or custom 'environments/other/env.properties'
Targets:
ant apply -Dalias=template Apply template using its alias
Project normally provide custom templates, at least one.
The templates are placed under templates/ folder, each template in a separate folder. The template folder must have at least template.yaml file but may provide any additional files to package with the template.
templates
template1
template.yaml
template2
template.yaml
otherfolder
otherfile
After the template(s) have been created they can be imported and applied.
Default targets provided by sagenv plugin:
ant -f lib/sagenv.xml -S
Optional parameter for any target:
-Denv=other Environment configuration to use from
project defaults in 'environments/default/env.properties'
or custom 'environments/other/env.properties'
Targets:
ant up Import and apply all project 'templates/*'
ant apply -Dalias=template Apply template using its alias
ant import -Dt=templateFolder Reimport template from source folder by do not apply
ant apply -Dt=templateFolder Reimport and apply template from source folder
ant migrate -Dt=templateFolder Reimport and migrate using template from source folder
Your project should have tests
ANTCC allows you easily define tests using AntUnit framework.
Create AntUnit tests and save them as tests/test*.xml files.
tests
test1.xml
test2.xml
Default targets provided by sagtest.xml plugin:
ant -f lib/sagtest.xml -S
Optional parameter for any target:
-Dsuite=some Run only tests from 'tests/some/*' folder
Targets:
ant test Run tests/test*.xml AntUnit tests
Create the project folder or cd into existing project
mkdir ~/myproj1
cd ~/myproj1
The project does NOT have to have build.xml file in its root. In this case $ANTCC_HOME/build.xml will be used.
The project MAY extend default $ANTCC_HOME/build.xml by placing build.xml with the following content in the project root:
<?xml version="1.0"?>
<project>
<property environment="env" />
<condition property="antcc.home" value="${env.ANTCC_HOME}" else="antcc">
<isset property="env.ANTCC_HOME"/>
</condition>
<import file="${antcc.home}/build.xml" />
</project>
The import provides access to default ANTCC targets and is enough to start using the project, however more often you will add your own automation targets to this main build.xml script.
The build.xml is a standard Apache Ant script you can use all the facilities that Ant provides for writing cross-platform automation scripts by leveraging
- Generic targets imported from ANTCC
- Any Command Central REST API available via CC CLI commands
- Any generic automation facilities provided by Ant tasks and libraries
- Any 3-rd party tooling that provide CLI or API
For GIT based automation projects you MAY include ANTCC as a submodule
git submodule add https://github.com/SoftwareAG/sagdevops-antcc.git antcc
This makes the project completely independend and does not require antcc installed on the host.
mkdir -p bootstrap
cat <<EOF > bootstrap/default.properties
accept.license=true
installer=cc-def-9.12-fix2-\${platform}
install.dir=\${user.home}/sag/cc
cce.http.port=8090
cce.https.port=8091
spm.http.port=8092
spm.https.port=8093
EOF
IMPORTANT: By setting accept.license=true
property you are accepting End User License Agreement
Download the bootstrap installer from Empower and save it under ~/Downloads folder
Run bootstrap process
ant boot
Verify connection
ant jobs
Create basic template
mkdir templates/default
cat <<EOF > templates/default/template.yaml
alias: default
environments:
default:
foo: bar
EOF
Create default environment configuration
mkdir environments/default
cat <<EOF > environments/default/env.properties
foo=baz
EOF
Apply template, check logs and jobs
ant up
ant jobs log logs
Create default or custom client configuration file
mkdir -p clients/default
cat <<EOF > clients/default/cc.properties
server=http://localhost:8090
username=Administrator
password=manage
cc.cli.home=\${user.home}/sag/cc/CommandCentral/client
EOF
Any command will now execute against this remote server by default.
ant waitcc up jobs log logs
Contact us at TECHcommunity if you have any questions.
These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.