> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-mobile/en/using-autify-nocode-mobile/integrations/jenkins-integration.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# Jenkins integration

Autify provides [the official Jenkins plugin](https://plugins.jenkins.io/autify/) to upload a build and run a test plan easily from your Jenkins workflow.

## Getting started

This document describes how to use our [Autify Jenkins plugin](https://plugins.jenkins.io/autify/) step-by-step.

### Prerequisites

First, we assume you already have Jenkins Project or Pipeline to build your application. We'll add an Autify test step right after the build step to confirm the newly built application doesn't break the end-to-end experience.

Secondly, you need to create a test plan on [Autify for Mobile](https://mobile-app.autify.com). Please note the URL of your test plan e.g. `https://mobile-app.autify.com/projects/AAA/test_plans/BBB` and we'll use it later.

You also need to [create a personal access token](https://help.autify.com/nocode-mobile/en/using-autify-nocode-mobile/integrations/api-integration.md#api-authentication-token-generation-method) of Autify for Mobile. Please note the generated token somewhere so that we can store the value on Jenkins Secrets later.

*Note: Since the personal access token is associated with a single user, we recommend you to create a machine user in your organization and use its personal access token for CI/CD integration.*

Lastly, we currently only support Jenkins running on Linux or macOS platform. Windows is planned.

### Install plugin

Open the [Autify Plugin page](https://plugins.jenkins.io/autify/) and click **How to install** on the top right. You'll see the installation options like below:

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-d8c069b8cf6f659c252e77e5ef9c8167160e92fd%2FScreen%20Shot%202022-08-12%20at%209.46.25%20AM.png?alt=media)

### Store personal access token on Jenkins Secrets

Store the personal access token you generated above on Secrets by following [Jenkins's document](https://www.jenkins.io/doc/book/using/using-credentials/). **Use "Secret text"** for "Kind" and you can name an arbitrary "ID". Assuming you named it `autifyMobileAccessToken` here:

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-4ddd9bf63fa67a3654c7d74521ecdd9e035e1434%2FScreen%20Shot%202022-09-15%20at%206.46.30%20PM.png?alt=media)

### Add a build step to upload a build and run Autify for Mobile

Finally, let's add a new step to your existing Jenkins Project or Pipeline.

#### Jenkins Project

Go to configuration of your Project and click **Add build step** under "Build" and select **Run test on Autify for Mobile**:

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-b924561e75fc78f9f436705f60b6a003e80d7d37%2FScreen%20Shot%202022-09-15%20at%207.56.45%20PM\(1\).png?alt=media)

Then, select the ID of the Secret you created above e.g. `autifyMobileAccessToken` from the select box of "Personal Access Token of Autify for Mobile" and paste the URL noted above e.g. `https://mobile-app.autify.com/projects/AAA/test_plans/BBB` to "Autify for Mobile test URL".

See the examples below.

***

Upload a new build file and start a test (no waiting for the finish of the test):

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-7c8c7b14a63ba4e59ff0d5c9f2bdb14c64d1bbf8%2FScreen%20Shot%202022-09-15%20at%206.47.50%20PM.png?alt=media)

If you want to wait until the test finishes or timed out:

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-55593bc5237d62afea9ed28c2a25772d8cafae03%2FScreen%20Shot%202022-09-15%20at%206.48.05%20PM.png?alt=media)

To just upload a new build file, you can use "Upload build to Autify for Mobile" build step ("Workspace id" is the id right after `/projects/` in the URL you noted above):

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-b3bb24f0df037afd7d6ad7417fb802b10e13850b%2FScreen%20Shot%202022-09-15%20at%207.58.02%20PM.png?alt=media)

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-6edb4a6864551f5495e9a360cdf6f37a1b3dd1d8%2FScreen%20Shot%202022-09-15%20at%207.57.47%20PM.png?alt=media)

#### Jenkins Pipeline

Open your `Jenkinsfile` or Pipeline configuration page and insert the step below right after your deployment step.

***

Upload a new build file and start a test (no waiting for the finish of the test):

```groovy
autifyMobile credentialsId: 'autifyMobileAccessToken', autifyUrl: 'https://mobile-app.autify.com/projects/AAA/test_plans/BBB', buildPath: 'path/to/your-[ios.app|android.apk]'
```

If you want to wait until the test finishes or timed out:

```groovy
autifyMobile credentialsId: 'autifyMobileAccessToken', autifyUrl: 'https://mobile-app.autify.com/projects/AAA/test_plans/BBB', buildPath: 'path/to/your-[ios.app|android.apk]', wait: true
```

Just upload a new build file (`workspaceId` is the id right after `/projects/` in the URL you noted above):

```groovy
autifyMobileUpload credentialsId: 'autifyMobileAccessToken', workspaceId: 'AAA', buildPath: 'path/to/your-[ios.app|android.apk]'
```

### (Not recommended) Using "Execute shell" step

{% hint style="warning" %}
**If you don't want to use our Jenkins plugin or it has an issue, you can use "Execute shell" step instead.**
{% endhint %}

Here is the summary of the process:

1. Install the following plugins if you don't have yet:
   * [Credentials](https://plugins.jenkins.io/credentials/)
   * [Plain Credentials](https://plugins.jenkins.io/plain-credentials/)
   * [Credentials Binding](https://plugins.jenkins.io/credentials-binding/)
2. Store the personal access token as described above.
3. Add "Execute shell" build step:
   * Jenkins Project:

     1. Add the Secret to "Build Environment" > "Bindings" (Use `AUTIFY_MOBILE_ACCESS_TOKEN` as "Variable")
     2. Add "Execute shell" build step e.g.:

     ```shell
     curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-cicd.bash | bash -xe
     ./autify/bin/autify mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-path path/to/your-[ios.app|android.apk]
     ```
   * Jenkins Pipeline:

     1. Add `sh` step surrounded by `withCredentials` e.g.:

     ```groovy
     withCredentials([string(credentialsId: 'autifyMobileAccessToken', variable: 'AUTIFY_MOBILE_ACCESS_TOKEN')]) {
         sh '''
         curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-cicd.bash | bash -xe
         ./autify/bin/autify mobile test run https://mobile-app.autify.com/projects/AAA/test_plans/BBB --build-path path/to/your-[ios.app|android.apk]
         '''
     }
     ```

Note: You can customize the Autify CLI command in the shell step as you like. See [Autify CLI's documentation](https://help.autify.com/nocode-web/en/autify-university/integrations/autify-command-line-interface.md) for more details.

## Conclusion

By using [Autify's Jenkins plugin](https://plugins.jenkins.io/autify/) (or shell step), you can automatically run a test plan or scenario after deployments so that you can detect regressions right away and take an appropriate actions without wasting time.


---

# 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://help.autify.com/nocode-mobile/en/using-autify-nocode-mobile/integrations/jenkins-integration.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.
