Quali Torque

The Torque Jenkins Plugin provides an easy way to consume Torque sandboxes through Jenkins for a variety of use cases. The plugin allows you to build jobs that create on-demand sandboxes in Torque based on pre-defined blueprints.

Note: The Torque Jenkins plugin does not support production environments.

Prerequisites

  • Jenkins server 2.3 and above with internet access
  • Port connection between Jenkins and the Torque API Server

Installation

  1. Download the hpi package from the Releases tab

  2. Navigate to the advanced section under the plugins tab in jenkins

  3. Upload the hpi file into the "upload plugin" section

  4. Restart jenkins

Configuring Torque in Jenkins

  1. Log in to Jenkins as administrator.
  2. From the left pane, click Manage Jenkins, and then select Configure System.
  3. Scroll down to the Torque Connection section. The Domain name or IP should already be filled with your Torque account URL.
  4. Specify the Token.
  5. In Torque, go to Settings > Integrations > Jenkins and create a New Token.
  6. Copy the token.
  7. Click Change Password and paste the new token.
  8. Click Save.

Creating pipelines

  1. Create a new pipeline.
  2. Click Advanced Project Options and create a Pipeline script. Feel free to use our pipeline script examples for reference. Note that the Integration Tests section (shown in the above image) is the main section of the ‘start sandbox’ pipeline as it defines the details of the sandbox to be launched, and then the .startSandbox() line launches it, any deployment errors are caught using the catch(Exception e) element, and the finally part is triggered when the sandbox is active.
  3. Click Save.

Pipeline support (Workflow)

How to use Torque plugin:

Blueprint:

  • Use torque.blueprint to define a Blueprint object that can then be used to perform operations on a blueprint.
blueprint = torque.blueprint('blueprint_name', ['appname1': 'version', 'appname2': 'version'])
  • Use blueprint.startSandbox to starts a sandbox and returns a sandbox object which you could stop later.
sandbox = blueprint.startSandbox()
  • Use blueprint.doInsideSandbox to starts a sandbox for the duration of the body
blueprint.doInsideSandbox{
   //code block
}

Sandbox:

  • Use sandbox.end() to stop the sandbox
sandbox.end()

Enjoy