> 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/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 連携

Autify ではお手持ちのJenkins workflow から簡単にビルドをアップロードしたりテストプランを実行できる[公式のJenkins plugin](https://plugins.jenkins.io/autify/) を提供しています。

## Getting started

## はじめてみよう

このドキュメントでは、どのように[Autify Jenkins plugin](https://plugins.jenkins.io/autify/) を利用するかを順に説明していきます。

### 前提条件

まず、すでにJenkins Project やPipeline を使ってアプリケーションのビルドを行なっているものとします。そのビルドstep のすぐ後にAutify のテストを実行するstep を追加することで、新しくビルドされたアプリケーションがエンドツーエンドのユーザ体験を損ねていないことを確認できるようにします。

次に、[Autify for Mobile](https://mobile-app.autify.com) でテストプランを作成する必要があります。テストプランまたはシナリオのURL (例: `https://mobile-app.autify.com/projects/AAA/scenarios/BBB`) をメモしておいてください、後ほど利用します。

さらに、[パーソナルアクセストークンを生成する](https://help.autify.com/nocode-mobile/using-autify-nocode-mobile/integrations/api-integration.md#api-authentication-token-generation-method)必要があります。後ほどJenkins Secrets に保存するために、生成されたトークンはどこかにメモしておいて下さい。

*注: パーソナルアクセストークンは1人のユーザに紐づいてしまうので、CI/CD 連携のために組織にマシンユーザを作って、そのパーソナルアクセストークンを使うことをお勧めします。*

### Plugin をインストールする

[Autify Plugin のページ](https://plugins.jenkins.io/autify/) を開き、右上の"How to install" をクリックします。以下の様なインストールの選択肢が表示されます:

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

### パーソナルアクセストークンをJenkins Secrets に保存

上で生成したパーソナルアクセストークンを[Jenkins のドキュメント](https://www.jenkins.io/doc/book/using/using-credentials/)に従って、Secrets に保存します。"Kind" には **"Secret text" を使って**、"ID" には任意の名前を付けられます。ここでは`autifyMobileAccessToken` と命名したと仮定しておきます:

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

### Autify for Mobile にビルドをアップロードしたりテストを実行するbuild step を追加

それではお手持ちのJenkins Project またはPipeline に新しいstep を追加しましょう。

#### Jenkins Project

お手持ちのProject のconfiguration に行き、"Build" の下にある"Add build step"をクリックし、"Run test on Autify for Mobile" を選択します:

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

そうしたら、"Personal Access Token of Autify for Mobile" のセレクトボックスから上で作成したSecret のID (例: `autifyMobileAccessToken`)を選択し、"Autify for Mobile test URL" には上で記録したURL (例: `https://mobile-app.autify.com/projects/AAA/scenarios/BBB`) を貼り付けます。

以下の例をご覧ください。

***

新しいビルドファイルをアップロードしてテストを開始する (テストの完了は待たない)

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

もしテストが完了するか、タイムアウトするまで待つ場合:

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

新しいビルドファイルをアップロードするだけであれば、"Upload build to Autify for Mobile" ビルドstep が使えます (`workspace-id` は上でメモしたURL の`/projects/` のすぐ後ろのidです):

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

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

#### Jenkins Pipeline

お手持ちの`Jenkinsfile` またはPipeline のconfiguration ページを開き、以下の様なstep をデプロイのstep の直後に追加します。

***

新しいビルドファイルをアップロードしてテストを開始する (テストの完了は待たない)

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

もしテストが完了するか、タイムアウトするまで待つ場合:

```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
```

新しいビルドファイルをアップロードするだけ (`workspaceId` は上でメモしたURL の`/projects/` のすぐ後ろのid):

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

### (非推奨) "Execute shell" step を利用

{% hint style="warning" %}
**もしAutifyが提供する Jenkins plugin を利用したくないか、plugin に問題がある場合は、代わりに"Execute shell" step を利用することができます。**
{% endhint %}

以下に手順をまとめています:

1. もしまだであれば、以下のplugin をインストールします:
   * [Credentials](https://plugins.jenkins.io/credentials/)
   * [Plain Credentials](https://plugins.jenkins.io/plain-credentials/)
   * [Credentials Binding](https://plugins.jenkins.io/credentials-binding/)
2. パーソナルアクセストークンを上に書いてあるように保存します。
3. "Execute shell" build step を追加します:
   * Jenkins Project:

     1. Secret を"Build Environment" > "Bindings" に追加します ("Variable" には`AUTIFY_MOBILE_ACCESS_TOKEN` を使います)
     2. "Execute shell" build step を以下の様に追加します:

     ```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. `sh` を`withCredentials` で囲んで以下の様に追加します:

     ```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]
         '''
     }
     ```

注: shell step 内のAutify CLI のコマンドはお好きな様にカスタマイズできます。詳しくは[Autify CLI のドキュメント](https://help.autify.com/nocode-web/autify-university/integrations/autify-command-line-interface.md) をご覧ください。

## まとめ

[Autify のJenkins plugin](https://plugins.jenkins.io/autify/) (またはshell step)を使うことで、ビルド後にテストプランの実行を自動化できるので、無駄な時間を使うことなくリグレッションをすぐに検知して適切な行動を取ることができるようになります。


---

# 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/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.
