Skip to content

Building and Testing

Greg Schueler edited this page May 12, 2022 · 18 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 8. Make sure JAVA_HOME is set.
  • Gradle (can use gradlew wrapper script without installing gradle beforehand)
  • Docker (for test suite)
  • Nodejs 16 (for UI code)

Rundeck is composed of these components:

  • java libraries. Build system: gradle
    • core - located in core/
    • rundeck-storage/* - located in rundeck-storage/
  • plugins - located in plugins/. Build system: gradle
  • rundeckapp - located in rundeckapp/. Build system: grails. (Depends on core libs,plugins)
  • several different locations for UI modules using Vue, built with Nodejs 16

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.

Gradle and grails can be used to build the entire project, except for the docs.

Grails uses version 5.1.x

The top-level build system is gradle.

Note: RPM/deb packaging is built separately in the rundeck/packaging and rundeck/packaging-core repositories.

Performing a Full Build

To build the file rundeckapp/build/libs/rundeck-$VERSION.war:

./gradlew build

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 7/8
  • 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/rundeck/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/rundeck/rundeck/tarball/v1.3 -O - | tar xvz

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

# Run the build
# On Debian or Ubuntu:
JAVA_HOME=/usr/lib/jvm/java-7-openjdk http_proxy=http://172.16.123.1:80 ./gradlew clean build
# OR: On CentOS:
JAVA_HOME=/usr/lib/jvm/java-1.7.0 http_proxy=http://172.16.123.1:80 ./gradlew clean build

# After build completes, copy the launcher into a working directory and start it
mkdir ~/rundeck
cp rundeck-launcher/launcher/build/libs/rundeck-launcher-X.Y.0.jar ~/rundeck
cd ~/rundeck
java -jar rundeck-launcher-X.Y.0.jar

Component builds

  • core : use gradle directly: ./gradlew -p core clean build
  • plugins: use gradle: ./gradlew -p plugins. (Depends on core)
  • rundeckapp: use gradle, or use grails directly.
    • gradle: ./gradlew -p rundeckapp build

Building Documentation

Documentation is in the rundeck/docs github repo.

Testing

To perform tests on the components:

  • core: use gradle check: ./gradlew -p core check
    • to test a single test class, use ./gradlew -Dtest.single=classname test
  • rundeckapp:
    • with gradle: ./gradlew -p rundeckapp check
    • grails directly: 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.

Verify Artifacts

Verify that the built artifacts contain all of the expected components by using the testbuild.groovy script:

groovy testbuild.groovy -gradle -debug

The -debug is optional, and will print all verification info. Otherwise only failures will be printed. The exit code will indicate success 0 or failure (non-zero).

API Testing

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

Requirements: curl, xmlstarlet and jq (on mac os x, these can both be easily installed with homebrew)

If you have previously performed the full build of the launcher, a script named run-api-tests.sh can be used to run the launcher in a test mode, and execute all of the api test scripts:

./gradlew clean build && bash run-api-tests.sh

To run the API test scripts manually against an already-running Rundeck installation:

export RDECK_BASE=/path/to/rdeck/base
export PATH=$PATH:$RDECK_BASE/tools/bin # if using launcher
bash 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.

Specifying a single API Test

As done in the run-api-tests.sh script, export an environment variable TEST_NAME with the name of a single api test file to run:

TEST_NAME=test-job-run.sh bash test/test.sh http://myhost:4440 admin admin