> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# quali/torque

This orb integrates Torque into your CI/CD pipeline. You can use the available build tasks to create a sandbox from any blueprint, start your tests and end the sandbox when finished. To use this orb you need to have an account in Torque and API token


## Commands

### end-sandbox

Stops Torque sandbox environment


| Parameter | Type | Default | Description |
|---|---|---|---|
| `sandbox-id` | env_var_name | SANDBOX_ID | Environment variable with the ID of the sandbox
 |
| `space` | env_var_name | TORQUE_SPACE | Name of Torque space
 |
| `torque-token` | env_var_name | TORQUE_TOKEN | Name of environment variable containing Torque API Token
 |
| `torque-url` | env_var_name | TORQUE_SERVER | URL of Torque Server
 |

### start-sandbox

Launches Torque Sandbox from a blueprint


| Parameter | Type | Default | Description |
|---|---|---|---|
| `blueprint` | string |  | Name of the blueprint used for creating a Torque sandbox.
 |
| `duration` | string | PT2H | Duration (ISO 8601), after which Torque will stop the deployment
 |
| `inputs` | string | {} | String with the list of inputs.
Json format {'key1': 'value1', ..., 'keyN': 'valueN'}
 |
| `sandbox-details-variable` | string | SANDBOX_DETAILS | The name of environment variable which will be used to store full information about sandbox
 |
| `sandbox-id-variable` | string | SANDBOX_ID | The name of environment variable which will be used to store sandbox id
 |
| `sandbox-name` | string | circleci-orb-sandbox | Name of sandbox.
 |
| `space` | env_var_name | TORQUE_SPACE | Name of Torque space
 |
| `timeout` | integer | 30 | Timeout for this step in minutes. If the sandbox will not be ready when the timeout is reached, Torque will abort the deployment
 |
| `torque-token` | env_var_name | TORQUE_TOKEN | Name of environment variable containing Torque API Token
 |
| `torque-url` | env_var_name | TORQUE_SERVER | URL of Torque Server
 |

## Jobs

### sandbox

Run your build scenario once sandbox environment is ready.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `blueprint` | string |  | Name of the blueprint used for creating a Torque sandbox.
 |
| `image` | string | circleci/python | The name of image |
| `inputs` | string | {} | String with the list of inputs.
Json format {'key1': 'value1', ..., 'keyN': 'valueN'}
 |
| `sandbox-name` | string | circleci-orb-sandbox | Name of sandbox.
 |
| `space` | env_var_name | TORQUE_SPACE | Name of Torque space
 |
| `steps` | steps |  | Steps to execute once the Torque Sandbox is available |
| `tag` | string | latest | The image version tag |
| `torque-token` | env_var_name | TORQUE_TOKEN | Name of environment variable containing Torque API Token
 |
| `torque-url` | env_var_name | TORQUE_SERVER | URL of Torque Server
 |

## Executors

### default

The sample executor.
Any executor with curl pre-installed can be used instead


| Parameter | Type | Default | Description |
|---|---|---|---|
| `image` | string | circleci/python | The name of image |
| `tag` | string | latest | The image version tag |

## Examples

### fetch-info

Start sandbox, echo its full description, stop sandbox


```yaml
version: '2.1'
orbs:
  torque: quali/torque@1.1
jobs:
  build:
    docker:
      - image: circleci/ruby:2.4.1
    steps:
      - torque/start-sandbox:
          blueprint: my-application
          inputs: '{''AWS_INSTANCE_TYPE'': ''m5.large''}'
          sandbox-name: test-sandbox
      - run:
          command: echo "Sandbox ID is ${SANDBOX_ID}"
          name: Fetch Details
      - torque/end-sandbox:
          sandbox-id: SANDBOX_ID
workflows:
  easy:
    jobs:
      - build
```

### test-app

This example demonstrates how you can build and test your app using Torque Orb.
First build app and publish it to s3 bucket. Than deploy Torque Sandbox
with your new application as an artifact parameter and do some testing against the endpoint
of your deployed application.


```yaml
version: '2.1'
orbs:
  aws-s3: circleci/aws-s3@1.0.11
  torque: quali/torque@1.1
jobs:
  build-and-publish:
    docker:
      - image: circleci/ruby:2.4.1
    steps:
      - checkout
      - run:
          command: |
            mkdir -p workspace
            tar -zcf my-webapp.latest.tar.gz -C my_app/ .
          name: Archive app
      - aws-s3/copy:
          from: my-webapp.latest.tar.gz
          to: s3://my-webapp-artifacts/latest/
workflows:
  leadeasy:
    jobs:
      - build-and-publish
      - torque/sandbox:
          blueprint: my-web-application
          inputs: '{''AWS_INSTANCE_TYPE'': ''m5.large''}'
          name: Test Application
          requires:
            - build-and-publish
          sandbox-name: test-sandbox
          steps:
            - run: echo "Do some testing here"
            - run:
                command: |
                  echo "Getting sandbox details"
                  echo "You can process the json with jq and perform some tests"
                  echo "${SANDBOX_DETAILS}"
```