Skip to content

Essential features of OpenTestFactory orchestrator

The orchestrator is designed to help you build robust and dynamic automations. This guide will show you how to craft workflows that include environment variables, customized scripts, and more.

Overview

The OpenTestFactory orchestrator allow you to customize your workflows to meet the unique needs of your application and team. In this guide, we’ll discuss some essential customization techniques such as using variables, running scripts, and sharing data and artifacts between jobs.

Using variables in your workflows

The orchestrator include default environment variables for each workflow run. If you need to use custom environment variables, you can set these in your YAML workflow file. This example demonstrates how to create custom variables named POSTGRES_HOST and POSTGRES_PORT. These variables are then available to the node client.js script.

jobs:
  example-job:
      steps:
        - name: Connect to PostgreSQL
          run: node client.js
          variables:
            POSTGRES_HOST: postgres
            POSTGRES_PORT: 5432

For more information, see “Using environment variables.

Adding scripts to your workflow

You can use steps to run scripts and shell commands, which are then executed on the assigned execution environment. This example demonstrates how a step can use the run keyword to execute npm install -g bats on the execution environment.

jobs:
  example-job:
    steps:
      - run: npm install -g bats

For example, to run a script, you can store the script in your repository and supply the path and shell type.

jobs:
  example-job:
    steps:
      - name: Run build script
        run: ./scripts/build.sh
        shell: bash

It is also possible to include your script in your workflow, for a selection of shells.

variables:
  SERVER: production
jobs:
  shell-driven:
    runs-on: windows
    steps:
    - run: |
        print("a python step")
        import os
        print("1+2=", 1+2)
        foo = 5
        print(foo)
        print(os.environ.get('SERVER'))
      shell: python
    - run: |
        echo a default shell step
        dir /s
        echo %SERVER%
    - run: |
        echo "a pwsh step"
        Get-ChildItem .
        $PSVersionTable
        echo $Env:SERVER
      shell: pwsh

For more information, see “Workflow syntax for OpenTestFactory orchestrator.