> For the complete documentation index, see [llms.txt](https://docs.harmony.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.harmony.io/integrations/saas-applications/jenkins.md).

# Jenkins

Trigger Jenkins CI/CD pipelines and automation jobs directly from Harmony workflows

Jenkins is an open-source automation server widely used for CI/CD pipelines and IT automation jobs. Connecting Jenkins to Harmony allows IT workflows to trigger Jenkins jobs as part of ticket resolution - enabling self-service provisioning, infrastructure automation, and deployment workflows without leaving Harmony.

### What the Jenkins Integration Enables

| Capability                 | Description                                                                                                           |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| Pipeline Triggering        | Trigger Jenkins jobs and pipelines directly from Harmony workflows and agent steps                                    |
| Self-Service Automation    | Let employees request IT actions that execute Jenkins jobs automatically                                              |
| Multi-Instance Support     | Connect multiple Jenkins servers for different teams or environments, and target each independently per workflow step |
| Secure On-Premises Access  | Connect on-premises Jenkins servers via a secure Cloudflare tunnel without exposing them to the public internet       |
| Custom Agent Builder Steps | Add a dedicated Trigger Jenkins Job step inside any custom agent workflow                                             |

### Prerequisites

* **Jenkins Account**: User account with permissions to trigger jobs
* **Jenkins API Token**: Generated from your Jenkins profile (recommended over password)
* **Tunnel connector host**: The Jenkins server, or a machine that can reach it, where you can install Harmony's tunnel connector (`cloudflared`). It needs outbound internet access; Jenkins does not need to be reachable from the internet
* **Harmony Account**: Active Harmony workspace

{% hint style="warning" %}
Harmony connects to every Jenkins instance through a secure Cloudflare tunnel that it creates for the instance. After you connect, you install the tunnel connector on your Jenkins server (see [Connecting an On-Premises Jenkins Instance via Secure Tunnel](#connecting-an-on-premises-jenkins-instance-via-secure-tunnel)); until it is running, Harmony cannot reach Jenkins. Harmony supports both HTTP and HTTPS origins, including self-signed certificates.
{% endhint %}

### Connect Jenkins to Harmony

#### Step 1: Generate an API Token in Jenkins

1. Log in to your Jenkins instance
2. Click your username in the top-right corner
3. Select **Security** from the dropdown (on older Jenkins versions, **Configure**)
4. Scroll to the **API Token** section
5. Click **Add new token** and enter a name (e.g. `Harmony`)
6. If Jenkins shows an **Expiration** field (Jenkins 2.548 and later), choose how long the token stays valid. The default is **30 Days**; when the token expires, Harmony can no longer trigger jobs on this Jenkins instance until you connect it with a new token. Choose **No Expiration** if your security policy allows it
7. Click **Generate**
8. Copy the generated token - it will not be shown again

#### Step 2: Navigate to Integrations

1. Log in to your Harmony dashboard
2. Go to **Settings** > **Integrations**
3. Find **Jenkins** under **SaaS Applications** (or search for it by name) and click its card

#### Step 3: Enter Credentials

1. If a Jenkins instance is already connected, click **+ Create instance**
2. Enter an **Instance name** (required), for example `jenkins-production`
3. Enter your **Jenkins Address** - full URL including scheme and port (e.g. `http://10.0.1.100:8080`), as reached from the server where you will install the tunnel connector
4. Enter your **Username**
5. Enter your **Password or API token** (paste the token generated in Step 1; an API token is recommended)
6. Click **Connect**
7. Install the tunnel connector as described in the next section

{% hint style="info" %}
To add additional Jenkins instances, repeat this process for each server. Each instance is identified by a unique name and hostname, and can be managed, tested, and targeted independently.
{% endhint %}

#### Connecting an On-Premises Jenkins Instance via Secure Tunnel

Harmony connects to every Jenkins instance through a secure Cloudflare tunnel, so your Jenkins server does not need to be exposed to the public internet.

1. After you click **Connect**, the Jenkins instance stays open and shows **Installation Instructions**. You can find them again any time by clicking the **Jenkins** card under **Settings** > **Integrations** and opening the instance
2. On your Jenkins server, run the command under **Step 1: Download & install Cloudflare**. The command shown is for Windows (PowerShell); on other operating systems, use the **Download Cloudflare manually** link to install `cloudflared`
3. Run the command under **Step 2: Install the Harmony Jenkins connector**. Use its copy button: the command shown on screen is partly masked
4. Click **Test connection** to verify that Harmony can reach Jenkins through the tunnel. **Successfully connected** confirms it

Harmony provisions a unique secure tunnel hostname for each instance.

Harmony supports both HTTP and HTTPS origins for tunnel connections, including self-signed certificates.

### Managing Multiple Jenkins Instances

You can connect as many Jenkins instances as your organisation needs from a single Harmony account. Each instance:

* Gets its own unique name and secure tunnel hostname
* Can be tested independently using the per-instance **Test connection** button
* Is immediately available for selection in any workflow or agent step once connected

When building a workflow, use the integration selector on any Jenkins step to choose which specific instance that step should target. This gives teams running more than one Jenkins environment full control over routing across workflows.

{% hint style="info" %}
Existing workflows that do not have a specific instance selected will continue to use the first available Jenkins instance automatically - there is no disruption to current automations.
{% endhint %}

### Triggering Jenkins Jobs from Workflows

#### AI Agent Workflows

You can trigger Jenkins jobs as a step inside your AI agent workflows using the Jenkins integration block. This lets you kick off CI/CD pipelines, builds, or any parameterized Jenkins job automatically as part of a support or operations workflow.

* Specify the **job path** and pass a custom **parameters dictionary** to the job at trigger time
* Use the integration selector to choose which Jenkins instance the step should target
* Jenkins errors are surfaced as clear, readable messages within the workflow

#### Custom Agent Builder

You can add a dedicated **Trigger Jenkins Job** step to any workflow in the Custom Agent Builder.

1. Open your agent workflow in the Custom Agent Builder
2. Add a **Trigger Jenkins Job** step
3. Select the **Jenkins Integration** (the instance to target) and enter the **Job Path** of the job (e.g. `folder/job-name`)
4. Optionally add **Parameters** as key-value pairs to pass to the job at trigger time
5. Save and test the workflow

Any Jenkins server you have already connected to Harmony is immediately available for selection in the Custom Agent Builder.

### What Harmony Uses

**From Jenkins:**

* The list of jobs on your Jenkins server
* The queue ID of each build it triggers. Harmony starts the build and does not wait for it, so it does not read build status, results, or logs

### Use Cases

<details>

<summary>Self-Service Provisioning</summary>

Employees request infrastructure or environment setup via Slack; Harmony triggers the relevant Jenkins job automatically after approval

</details>

<details>

<summary>Automated Remediation</summary>

Harmony workflows detect an issue and trigger a Jenkins remediation job without requiring manual intervention

</details>

<details>

<summary>Deployment on Ticket Resolution</summary>

When an IT ticket is resolved, Harmony triggers a Jenkins deployment job to apply the fix to production

</details>

<details>

<summary>Multi-Environment CI/CD Routing</summary>

Teams running separate Jenkins instances for staging and production can route workflow steps to the correct environment using the per-step instance selector, keeping automation precise and environment-safe

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.harmony.io/integrations/saas-applications/jenkins.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
