Skip to content

Building and Testing

gschueler edited this page Jun 22, 2012 · 5 revisions

There are several top-level targets for a full RunDeck build, but there are also ways to only build the lower-level components during development or testing.

Requirements:

  • Java 5. Make sure JAVA_HOME is set.
  • GNU Make, or maven2

RunDeck is composed of these components:

  • core - located in core/. Build system: gradle or maven2
  • plugins - located in plugins/. Build system: gradle or maven2 (Depends on core)
  • rundeckapp - located in rundeckapp/. Build system: grails or maven2/grails. (Depends on core,plugins)
  • docs - located in docs/. Build system: GNU Make, pandoc. optional
  • rundeck-laucher - located in rundeck-launcher/. Build system: gradle or maven2

Gradle based build components already include the "gradle wrapper" so they do not require a local gradle installation. You can use the gradlew or gradlew.bat scripts that are included.

Maven2 can be used to build the entire project, except for the docs.

Grails uses version 1.3.7.

The top-level build system is GNU Make or maven2. The Makefile separately invokes gradle to build the subcomponents as well as the docs. The top-level maven2 pom.xml will build the entire project except for the docs.

Performing a Full Build

To build the rundeck-launcher:

make

To build the rpm

make rpm

To build the .deb

make deb

To use Maven2, make sure you set the MAVEN_OPTS environment variable to allocate enough RAM:

MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=192m" mvn clean package

Building using an HTTP proxy

Building RunDeck requires access to the internet, but it is possible to use an HTTP proxy instead of direct internet access.

  • Requires: UNIX or Linux system, bash, GNU make, wget, Java 6
  • no git required

In a nutshell, set the http_proxy and https_proxy environment variables appropriately, then download a tarball from github (which sidesteps the need to use a proxy for git), then build.

In more detail:

# Download and unpack the tarball. Replace Proxy URLs appropriately.
# You can also use a tarball from a different revision or tag.
http_proxy=http://172.16.123.1:80 https_proxy=http://172.16.123.1:80 wget https://github.com/dtolabs/rundeck/tarball/v1.3 -O - | tar xvz
# NOTE: on CentOS 5 add --no-check-certificate because github's CA is not in the
# (quite old) root cert set in CentOS 5. Or, update the root certs.
http_proxy=http://172.16.123.1:80 https_proxy=http://172.16.123.1:80 wget --no-check-certificate https://github.com/dtolabs/rundeck/tarball/v1.3 -O - | tar xvz

# At this point there should be a directory called: dtolabs-rundeck-<git revision>
cd dtolabs-rundeck-*

# Run the build
# On Debian or Ubuntu:
JAVA_HOME=/usr/lib/jvm/java-6-openjdk http_proxy=http://172.16.123.1:80 make
# OR: On CentOS:
JAVA_HOME=/usr/lib/jvm/java-1.6.0 http_proxy=http://172.16.123.1:80 make

# After build completes, copy the launcher into a working directory and start it
mkdir ~/rundeck
cp rundeckapp/target/rundeck-launcher-1.3.0.jar ~/rundeck
cd ~/rundeck
java -jar rundeck-launcher-1.3.0.jar

Component builds

  • core : use gradle directly: cd core; ./gradlew clean build
  • plugins: use gradle: cd plugins; ./gradlew. (Depends on core)
  • rundeckapp: use grails directly. Set your GRAILS_HOME env variable to a Grails 1.3.7 installation. Then perform: cd rundeckapp; grails prod war. (Depends on core,plugins)
  • rundeck-launcher: use gradle. cd rundeck-launcher; ./gradlew clean build (Depends on core,plugins,rundeckapp)

Maven can also be used for all of the component directories.

Building Documentation

Documentation requires pandoc to build. This is only required for the rpm/deb targets. Set your PATH to include the location of pandoc. e.g. export PATH=$PATH:$HOME/.cabal/bin. Then use GNU Make:

make clean docs

After that you can build the launcher/rpm/deb and it will include the docs.

Testing

To perform tests on the components:

  • core: use gradle check: cd core; ./gradlew check
    • to test a single test class, use ./gradlew -Dtest.single=classname test
  • rundeckapp: use grails test-app: cd rundeckapp; grails test-app
    • to test a single unit or integration test such as "MyDomainTests", use: grails test-app MyDomain :unit or grails test-app MyDomain :integration.

Maven can also be used for all of the component directories.

API Testing

The RunDeck CLI tools and HTTP API can be tested against a running RunDeck server instance.

export RDECK_BASE=/path/to/rdeck/base
sh test/test.sh [http://server:port] [username] [password]

This test assumes the server is running at http://localhost:4440 if not specified, and the default admin:admin username and password if they are not specified. It will create a test project and perform tests of the API endpoints.

If you wish to add a new API endpoint test, see the examples under test/api/test-*.sh.