Favicon

You are here: Home > App Distribution > CI/CD > Jenkins

Jenkins

Learn how to integrate Jenkins with Applivery to automate build uploads for seamless CI/CD. Streamline your mobile app distribution workflow.

10 min read

TL;DR

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

jenkins

Jenkins Integration

Jenkins 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.

Note

Applivery does not have a dedicated Jenkins plugin. The integration uses Jenkins' standard HTTP Request plugin 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 installed.
  • An Applivery Integration API Token. Find it in App Settings → API Tokens in the Applivery Dashboard, or see Integration API Token for instructions on creating one.
  • A Jenkins pipeline that produces a build artifact (.ipa, .apk, .aab, or another supported format).

1
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:

environment {
    APPLIVERY_TOKEN = credentials('APPLIVERY_TOKEN')
}
2
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.

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:

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.


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:

env.GIT_COMMIT_MSG = sh(script: 'git log -1 --pretty=%B', returnStdout: true).trim()

Key Takeaways

  • Automate build uploads to Applivery using Jenkins.
  • Use the HTTP Request plugin to interact with the Applivery API.
  • Store your Applivery API token securely as a Jenkins credential.
  • Configure your Jenkinsfile to upload builds and metadata to Applivery.
  • Leverage Jenkins environment variables for dynamic build information.