--- title: "Jenkins integration" slug: "jenkins-integration" updated: 2022-09-22T16:58:45Z published: 2022-09-22T16:58:45Z canonical: "help.autify.com/jenkins-integration" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # 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/mobile/docs/ja/api-integration#api-%E8%AA%8D%E8%A8%BC%E3%83%88%E3%83%BC%E3%82%AF%E3%83%B3%E7%94%9F%E6%88%90%E6%96%B9%E6%B3%95)必要があります。後ほどJenkins Secrets に保存するために、生成されたトークンはどこかにメモしておいて下さい。 *注: パーソナルアクセストークンは1人のユーザに紐づいてしまうので、CI/CD 連携のために組織にマシンユーザを作って、そのパーソナルアクセストークンを使うことをお勧めします。* ### Plugin をインストールする [Autify Plugin のページ](https://plugins.jenkins.io/autify/) を開き、右上の"How to install" をクリックします。以下の様なインストールの選択肢が表示されます: ![Screen Shot 2022-08-12 at 9.46.25 AM.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202022-08-12%20at%209.46.25%20AM.png?sv=2026-02-06&spr=https&st=2026-11-06T21%3A38%3A08Z&se=2026-11-06T22%3A38%3A08Z&sr=c&sp=r&sig=WKbIVFKQOEssk7yBZ3FTOzankY3EKLe%2FAUJEwJEeHfI%3D) ### パーソナルアクセストークンをJenkins Secrets に保存 上で生成したパーソナルアクセストークンを[Jenkins のドキュメント](https://www.jenkins.io/doc/book/using/using-credentials/)に従って、Secrets に保存します。"Kind" には **"Secret text" を使って**、"ID" には任意の名前を付けられます。ここでは`autifyMobileAccessToken` と命名したと仮定しておきます: ![Screen Shot 2022-09-15 at 6.46.30 PM.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202022-09-15%20at%206.46.30%20PM.png?sv=2026-02-06&spr=https&st=2026-11-06T21%3A38%3A08Z&se=2026-11-06T22%3A38%3A08Z&sr=c&sp=r&sig=WKbIVFKQOEssk7yBZ3FTOzankY3EKLe%2FAUJEwJEeHfI%3D) ### Autify for Mobile にビルドをアップロードしたりテストを実行するbuild step を追加 それではお手持ちのJenkins Project またはPipeline に新しいstep を追加しましょう。 #### Jenkins Project お手持ちのProject のconfiguration に行き、"Build" の下にある"Add build step"をクリックし、"Run test on Autify for Mobile" を選択します: ![Screen Shot 2022-09-15 at 7.56.45 PM.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202022-09-15%20at%207.56.45%20PM%281%29.png?sv=2026-02-06&spr=https&st=2026-11-06T21%3A38%3A08Z&se=2026-11-06T22%3A38%3A08Z&sr=c&sp=r&sig=WKbIVFKQOEssk7yBZ3FTOzankY3EKLe%2FAUJEwJEeHfI%3D) そうしたら、"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`) を貼り付けます。 以下の例をご覧ください。 --- 新しいビルドファイルをアップロードしてテストを開始する (テストの完了は待たない) ![Screen Shot 2022-09-15 at 6.47.50 PM.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202022-09-15%20at%206.47.50%20PM.png?sv=2026-02-06&spr=https&st=2026-11-06T21%3A38%3A08Z&se=2026-11-06T22%3A38%3A08Z&sr=c&sp=r&sig=WKbIVFKQOEssk7yBZ3FTOzankY3EKLe%2FAUJEwJEeHfI%3D) もしテストが完了するか、タイムアウトするまで待つ場合: ![Screen Shot 2022-09-15 at 6.48.05 PM.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202022-09-15%20at%206.48.05%20PM.png?sv=2026-02-06&spr=https&st=2026-11-06T21%3A38%3A08Z&se=2026-11-06T22%3A38%3A08Z&sr=c&sp=r&sig=WKbIVFKQOEssk7yBZ3FTOzankY3EKLe%2FAUJEwJEeHfI%3D) 新しいビルドファイルをアップロードするだけであれば、"Upload build to Autify for Mobile" ビルドstep が使えます (`workspace-id` は上でメモしたURL の`/projects/` のすぐ後ろのidです): ![Screen Shot 2022-09-15 at 7.58.02 PM.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202022-09-15%20at%207.58.02%20PM.png?sv=2026-02-06&spr=https&st=2026-11-06T21%3A38%3A08Z&se=2026-11-06T22%3A38%3A08Z&sr=c&sp=r&sig=WKbIVFKQOEssk7yBZ3FTOzankY3EKLe%2FAUJEwJEeHfI%3D) ![Screen Shot 2022-09-15 at 7.57.47 PM.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202022-09-15%20at%207.57.47%20PM.png?sv=2026-02-06&spr=https&st=2026-11-06T21%3A38%3A08Z&se=2026-11-06T22%3A38%3A08Z&sr=c&sp=r&sig=WKbIVFKQOEssk7yBZ3FTOzankY3EKLe%2FAUJEwJEeHfI%3D) #### Jenkins Pipeline お手持ちの`Jenkinsfile` またはPipeline のconfiguration ページを開き、以下の様なstep をデプロイのstep の直後に追加します。 --- 新しいビルドファイルをアップロードしてテストを開始する (テストの完了は待たない) ``` autifyMobile credentialsId: 'autifyMobileAccessToken', autifyUrl: 'https://mobile-app.autify.com/projects/AAA/test_plans/BBB', buildPath: 'path/to/your-[ios.app|android.apk]' ``` もしテストが完了するか、タイムアウトするまで待つ場合: ``` 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): ``` autifyMobileUpload credentialsId: 'autifyMobileAccessToken', workspaceId: 'AAA', buildPath: 'path/to/your-[ios.app|android.apk]' ``` ### (非推奨) "Execute shell" step を利用 **もしAutifyが提供する Jenkins plugin を利用したくないか、plugin に問題がある場合は、代わりに"Execute shell" step を利用することができます。** 以下に手順をまとめています: 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: ``` 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] ``` 1. Secret を"Build Environment" > "Bindings" に追加します ("Variable" には`AUTIFY_MOBILE_ACCESS_TOKEN` を使います) 2. "Execute shell" build step を以下の様に追加します: - Jenkins Pipeline: ``` 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] ''' } ``` 1. `sh` を`withCredentials` で囲んで以下の様に追加します: 注: shell step 内のAutify CLI のコマンドはお好きな様にカスタマイズできます。詳しくは[Autify CLI のドキュメント](https://help.autify.com/docs/ja/autify-command-line-interface) をご覧ください。 ## まとめ [Autify のJenkins plugin](https://plugins.jenkins.io/autify/) (またはshell step)を使うことで、ビルド後にテストプランの実行を自動化できるので、無駄な時間を使うことなくリグレッションをすぐに検知して適切な行動を取ることができるようになります。