Skip to content

Calling the Squash Orchestrator from a Jenkins pipeline

Configuring a Squash Orchestrator in Jenkins

To access the configuration of the Squash Orchestrator, you first need to go the Configure System page accessible in the System Configuration space of Jenkins, through the Manage Jenkins tab:

jenkins-system-configuration

A block named OpenTestFactory Orchestrator servers will then be available:

jenkins-orchestrator-server

  • Server id: This ID is automatically generated and can't be modified. It is not used by the user.

  • Server name: This name is defined by the user. It is the one that will be mentioned in the pipeline script of the workflow to be executed.

  • Receptionist endpoint URL: The address of the receptionist micro-service of the orchestrator, with its port as defined at the launch of the orchestrator. Please refer to the Squash Orchestrator documentation for further details.

  • Workflow Status endpoint URL: The address of the observer micro-service of the orchestrator, with its port as defined at the launch of the orchestrator. Please refer to the Squash Orchestrator documentation for further details.

  • Credential: Secret text type Jenkins credential containing a JWT Token allowing authentication to the orchestrator. Please refer to the OpenTestFactory Orchestrator documentation for further details on secure access to the orchestrator.

  • Workflow Status poll interval: This parameter sets the interval between each update of the workflow status.

  • Workflow creation timeout: Timeout used to wait for the workflow status to be available on the observer after reception by the receptionist.

Call to the Squash Orchestrator from a Jenkins pipeline

Once there is at least one Squash Orchestrator configured in Jenkins, it is possible to call the Squash Orchestrator from a pipeline type job in Jenkins thanks to a dedicated pipeline method.

Below is an example of a simple pipeline using the calling method to the orchestrator:

node {
   stage 'Stage 1: sanity check'
   echo 'OK pipelines work in the test instance'
   stage 'Stage 2: steps check'
   configFileProvider([configFile(
fileId: '600492a8-8312-44dc-ac18-b5d6d30857b4',
targetLocation: 'testWorkflow.json'
)]) {
    def workflow_id = runOTFWorkflow(
        workflowPathName:'testWorkflow.json',
        workflowTimeout: '300S',
        serverName:'defaultServer'
    )
    echo "We just ran The Squash Orchestrator workflow $workflow_id"
   }
}

The runOTFWorkflow method allows the transmission of a PEaC to the orchestrator for an execution.

It uses 3 parameters:

  • workflowPathName: The path to the file containing the PEaC. In the present case, the file is injected through the Config File Provider plugin, but it is also possible to get it through other means (retrieval from a SCM, on the fly generation in a file, ...).

  • workflowTimeout: Timeout on workflow execution. This timeout will trigger if workflow execution takes longer than expected, for any reason. This aims to end stalled workflows (for example due to unreachable environments or unsupported action calls). It is to be adapted depending on the expected duration of the execution of the various tests in the PEaC.

  • serverName: Name of the Squash Orchestrator server to use. This name is defined in the OpenTestFactory Orchestrator servers space of the Jenkins configuration.

Call for a PEaC execution using inception execution environment

When the goal is to use Squash Orchestrator for execution of a PEaC using inception execution environment, as described in the documentation, the pipeline must be changed according to the following template:

node {
   stage 'Stage 1: sanity check'
   echo 'OK pipelines work in the test instance'
   stage 'Stage 2: steps check'
   configFileProvider([
            configFile(fileId: 'inception_peac.yaml', targetLocation: 'testWorkflow.yaml'),
            configFile(fileId: 'TEST-ForecastSuite.xml', targetLocation: 'TEST-ForecastSuite.xml')
    ]) {
       def workflow_id = runOTFWorkflow(
           workflowPathName:'testWorkflow.yaml',
           workflowTimeout: '300S',
           serverName:'defaultServer',
           fileResources: [ref('name':'myfile','path':'TEST-ForecastSuite.xml')]
       )

       echo "We just ran The Squash Orchestrator workflow $workflow_id"
   }
}

A new parameter appears for runOTFWorkflow method:

  • fileResources: the parameter allows to specifies additional files to send to the orchestrator. These files must match the ones of the files section of the PEaC. It consists of an array of ref elements. A ref element consists of two attributes:
    • name: name of the file as specified in the PEaC.
    • path: path of the file in Jenkins job workspace.

Backward compatibility with the squash-devops.hpi plugin

To support its transition to open-source, this plugin is changing its name to version 1.3.1 We go from squash-devops-1.3.0.hpi to opentestfactory-orchestrator-1.3.1.hpi. In order to facilitate the transition for users, the following backward compatibility is ensured in version 1.3.1:

  • If you uninstall the squash-devops.hpi plugin and install, the opentestfactory-orchestrator.hpi plugin, your servers installed with the legacy plugin will be restored.

  • Pipelines using the runSquashWorkflow method are still supported. However, this method is deprecated and will no longer be supported in future versions; you should use now the runOTFWorkflow method instead.

  • Environment variables using the SQUASHTF_ prefix are still supported. However, they are deprecated and will no longer be supported in future versions, you should use now the OPENTF_ prefix instead.

Back to top