# Jenkins

> Integrate Jenkins with Applivery to automate Build uploads and streamline your Mobile App Distribution CI/CD workflow.

Source: https://docs.applivery.com/en/app-distribution/ci-cd/jenkins/  •  Last updated: 2026-04-01

**Key topics:** Jenkins integration, Applivery API, CI/CD automation, build upload, Jenkinsfile configuration, Jenkins, Applivery, HTTP Request plugin, Applivery Upload API, iOS, Android

---

**TL;DR:** Integrate Jenkins with Applivery to automatically upload new builds after each pipeline run, streamlining your mobile app distribution process.

![jenkins](https://www.applivery.com/wp-content/uploads/2025/02/jenkins-1-1024x316.jpeg "jenkins | Applivery")

# Jenkins Integration

[Jenkins](https://www.jenkins.io/) is an open-source automation server widely used for continuous integration and delivery. It orchestrates build, test, packaging, and deployment stages of a software delivery pipeline.

The Applivery integration with Jenkins allows you to automatically upload a new Build to Applivery at the end of each pipeline run — making freshly built binaries immediately available to QA teams, stakeholders, or internal users without any manual steps.

:::info
Applivery does not have a dedicated Jenkins plugin. The integration uses Jenkins' standard [HTTP Request plugin](https://www.jenkins.io/doc/pipeline/steps/http_request/) to call the Applivery Upload API directly. This approach is simpler, more maintainable, and works with any Jenkins version.
:::

---

## Prerequisites

Before setting up the integration, make sure you have:

- A Jenkins instance with the [HTTP Request plugin](https://plugins.jenkins.io/http_request/) installed.
- An Applivery Integration API Token. Find it in **App Settings → API Tokens** in the Applivery Dashboard, or see [Integration API Token](https://docs.applivery.com/en/app-distribution/api/app-api-token/) for instructions on creating one.
- A Jenkins pipeline that produces a Build artifact (`.ipa`, `.apk`, `.aab`, or another supported format).

---

**Store the App Token as a Jenkins Credential**

Never hardcode your Applivery token directly in the `Jenkinsfile`. Store it as a secret credential in Jenkins and reference it via an environment variable.

1. Go to **Jenkins → Manage Jenkins → Credentials**.
2. Add a new **Secret text** credential.
3. Set the ID to `APPLIVERY_TOKEN` (or any name you prefer — just use it consistently).
4. Paste your Applivery App API Token as the secret value.

In your `Jenkinsfile`, expose the credential as an environment variable:

```groovy
environment {
    APPLIVERY_TOKEN = credentials('APPLIVERY_TOKEN')
}
```

**Add the Upload Stage to Your Pipeline**

Add an `Applivery Upload` stage after your Build step. The stage uses the `httpRequest` step from the HTTP Request plugin to call the Applivery Upload API with `multipart/form-data`.

```groovy
stage('Applivery Upload') {
    def response = httpRequest(
        url: 'https://upload.applivery.io/v1/integrations/builds',
        httpMode: 'POST',
        consoleLogResponseBody: true,
        wrapAsMultipart: true,
        customHeaders: [
            [
                maskValue: true,
                name: 'Authorization',
                value: "Bearer ${env.APPLIVERY_TOKEN}"
            ]
        ],
        formData: [
            // Build file
            [
                name: 'build',
                fileName: 'app.ipa',
                uploadFile: './app.ipa',
                contentType: 'application/octet-stream'
            ],
            // Build metadata
            [name: 'versionName',        value: "${env.BUILD_TAG}"],
            [name: 'changelog',          value: "${env.GIT_COMMIT_MSG}"],
            [name: 'tags',               value: 'jenkins, ci'],
            // Notifications
            [name: 'notifyCollaborators', value: 'true'],
            [name: 'notifyEmployees',     value: 'false'],
            [name: 'notifyMessage',       value: 'New build available from Jenkins'],
            [name: 'notifyLanguage',      value: 'en'],
            // Notification group filter (optional)
            // To notify users in group1 AND group2, OR group3:
            [name: 'filter[0][0]',        value: 'group1'],
            [name: 'filter[0][1]',        value: 'group2'],
            [name: 'filter[1][0]',        value: 'group3'],
            // CI/CD metadata — appears in the Applivery Dashboard
            [name: 'deployer.name',                   value: 'Jenkins'],
            [name: 'deployer.info.commitMessage',      value: "${env.GIT_COMMIT_MSG}"],
            [name: 'deployer.info.commit',             value: "${env.GIT_COMMIT}"],
            [name: 'deployer.info.branch',             value: "${env.GIT_BRANCH}"],
            [name: 'deployer.info.buildUrl',           value: "${env.BUILD_URL}"],
            [name: 'deployer.info.buildNumber',        value: "${env.BUILD_NUMBER}"],
            [name: 'deployer.info.repositoryUrl',      value: "${env.GIT_URL}"]
        ]
    )

    echo "Applivery upload response: ${response}"
}
```

---

## Complete Jenkinsfile Example

Here is a full pipeline example for an iOS build:

```groovy
pipeline {
    agent any

    environment {
        APPLIVERY_TOKEN = credentials('APPLIVERY_TOKEN')
    }

    stages {
        stage('Checkout') {
            steps {
                checkout scm
            }
        }

        stage('Build') {
            steps {
                // Replace with your actual build command
                sh 'xcodebuild -scheme MyApp -configuration Release archive -archivePath build/MyApp.xcarchive'
                sh 'xcodebuild -exportArchive -archivePath build/MyApp.xcarchive -exportPath build/ -exportOptionsPlist ExportOptions.plist'
            }
        }

        stage('Applivery Upload') {
            steps {
                script {
                    def response = httpRequest(
                        url: 'https://upload.applivery.io/v1/integrations/builds',
                        httpMode: 'POST',
                        consoleLogResponseBody: true,
                        wrapAsMultipart: true,
                        customHeaders: [
                            [
                                maskValue: true,
                                name: 'Authorization',
                                value: "Bearer ${env.APPLIVERY_TOKEN}"
                            ]
                        ],
                        formData: [
                            [
                                name: 'build',
                                fileName: 'MyApp.ipa',
                                uploadFile: './build/MyApp.ipa',
                                contentType: 'application/octet-stream'
                            ],
                            [name: 'versionName',                    value: "${env.BUILD_TAG}"],
                            [name: 'changelog',                      value: "Build #${env.BUILD_NUMBER} — ${env.GIT_BRANCH}"],
                            [name: 'notifyCollaborators',             value: 'true'],
                            [name: 'notifyMessage',                   value: 'New build ready for testing'],
                            [name: 'notifyLanguage',                  value: 'en'],
                            [name: 'deployer.name',                   value: 'Jenkins'],
                            [name: 'deployer.info.commit',            value: "${env.GIT_COMMIT}"],
                            [name: 'deployer.info.branch',            value: "${env.GIT_BRANCH}"],
                            [name: 'deployer.info.commitMessage',     value: "${env.GIT_COMMIT_MSG}"],
                            [name: 'deployer.info.buildUrl',          value: "${env.BUILD_URL}"],
                            [name: 'deployer.info.buildNumber',       value: "${env.BUILD_NUMBER}"],
                            [name: 'deployer.info.repositoryUrl',     value: "${env.GIT_URL}"]
                        ]
                    )
                    echo "Applivery upload response: ${response}"
                }
            }
        }
    }

    post {
        failure {
            echo 'Build or upload failed.'
        }
    }
}
```

---

## Key parameters reference

The `formData` array maps directly to the Applivery Upload API parameters. These are the most commonly used ones:

| Parameter | Description |
|---|---|
| `build` | The binary file to upload. Use `uploadFile` for the local path and `fileName` for the filename Applivery will record. |
| `versionName` | Human-readable label for the Build. Using `${env.BUILD_TAG}` or `${env.BUILD_NUMBER}` makes it easy to trace in Applivery. |
| `changelog` | Release notes shown in the Applivery Dashboard and notification emails. |
| `tags` | Comma-separated tags for filtering Builds. E.g. `jenkins, staging`. |
| `notifyCollaborators` | Set to `true` to email app Collaborators when the Build is uploaded. |
| `notifyEmployees` | Set to `true` to email store employees. |
| `notifyMessage` | Custom message included in the notification email. |
| `notifyLanguage` | Language for the notification email. Supported values: `en`, `es`, `fr`, `de`, `it`, `zh`, `pt`, `ru`. |
| `filter[N][M]` | Group-based notification filter. Each inner array is an AND clause; each outer index is an OR. |
| `deployer.name` | CI platform name shown in the Applivery Dashboard. E.g. `Jenkins`. |
| `deployer.info.commit` | Git commit SHA. |
| `deployer.info.branch` | Git branch name. |
| `deployer.info.buildNumber` | Jenkins build number. |
| `deployer.info.buildUrl` | Direct URL to the Jenkins build run. |
| `deployer.info.repositoryUrl` | URL of the source repository. |

For the complete parameter reference, see [POST – Upload a Build](https://docs.applivery.com/en/app-distribution/api/builds/upload-build/).

---

## Jenkins Environment Variables

The pipeline examples above use standard Jenkins built-in environment variables. These are available in any pipeline without additional configuration:

| Variable | Description |
|---|---|
| `BUILD_NUMBER` | The current build number. |
| `BUILD_TAG` | String of the format `jenkins-<job>-<number>`. Useful as a version name. |
| `BUILD_URL` | Full URL to the current build in the Jenkins UI. |
| `GIT_COMMIT` | SHA of the current Git commit (requires Git plugin). |
| `GIT_BRANCH` | Name of the current Git branch (requires Git plugin). |
| `GIT_URL` | URL of the Git repository (requires Git plugin). |

:::warning
`GIT_COMMIT_MSG` is not a built-in Jenkins variable. To use the commit message in the upload, capture it first with a shell step:
```groovy
env.GIT_COMMIT_MSG = sh(script: 'git log -1 --pretty=%B', returnStdout: true).trim()
```
:::
