# Bamboo CI

### What You’ll Achieve

By the end of this guide, your Bamboo build will:

* Run Scandium test suites as part of your build plan.
* Display test output in your Bamboo build logs.

***

### Prerequisites

Before you begin, make sure you have:

* A [Scandium](https://getscandium.com) account with:
  * Your `API_TOKEN`
  * A `PROJECT_ID` and `SUITE_ID`
* Bamboo CI installed and running
* Administrator access to create/edit build plans
* An agent that has `curl`, `bash`, and `jq` installed

***

### Step 1: Define Variables in Bamboo

In your build plan:

1. Navigate to your plan configuration.
2. Click **Actions** > **Configure Plan**.
3. Go to **Variables** and define the following:

| Variable Name  | Value / Description                                  |
| -------------- | ---------------------------------------------------- |
| `API_TOKEN`    | Your Scandium API token                              |
| `PROJECT_ID`   | Your Scandium project ID                             |
| `SUITE_ID`     | Your Scandium test suite ID                          |
| `HUB_URL`      | *(Optional)* Selenium Grid URL                       |
| `STARTING_URL` | *(Optional)* Starting URL for the tests              |
| `BROWSER`      | *(Optional)* `chrome` *(default)*                    |
| `SCREENSHOT`   | *(Optional)* `true` or `false`                       |
| `VARIABLES`    | *(Optional)* `'{}'` *(as JSON string)*               |
| `RETRY`        | *(Optional)* Number of retries on failure, e.g. `0`  |
| `MAX_ATTEMPTS` | *(Optional)* Max polling attempts, e.g. `30`         |
| `WAIT_PERIOD`  | *(Optional)* Polling interval in seconds, e.g. `120` |

***

### Step 2: Add Script Tasks to Run Scandium

In your build stage:

1. Add a **Script** task named `Install Dependencies`
   * Script Body:

```
sudo apt-get update && sudo apt-get install -y jq
```

2. Add another **Script** task named `Download Scandium Script`
   * Script Body:

```
SCRIPT_URL="https://raw.githubusercontent.com/GetScandium/files/refs/heads/main/scandium_script.sh"
curl -o scandium_script.sh $SCRIPT_URL
chmod +x scandium_script.sh
```

3. Add a **Script** task named `Run Scandium Script`
   * Script Body:

```
./scandium_script.sh
```

***

### Step 3: Trigger a Build

You can now trigger your Bamboo plan manually or via a VCS change. Watch the build logs for test output and status.

***

### Troubleshooting Tips

| Problem                       | Solution                                                                              |
| ----------------------------- | ------------------------------------------------------------------------------------- |
| ❌ `Missing required variable` | Make sure required plan variables are defined (`API_TOKEN`, `PROJECT_ID`, `SUITE_ID`) |
| ❌ `Permission denied`         | Ensure the script has execute permission (`chmod +x`)                                 |
| 🕒 `Stuck waiting`            | Adjust `WAIT_PERIOD` and `MAX_ATTEMPTS` plan variables                                |

***

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getscandium.com/integrations/bamboo-ci.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
