AWS CodePipeline
User Guide (API Version 2015-07-09)

A new console design is available for this service. Although the procedures in this guide were written for the older version of the console, you will find many of the concepts and basic procedures in this guide still apply.

Tutorial: Create a Pipeline That Builds and Tests Your iOS App After a Change in Your Amazon S3 Bucket

AWS CodePipeline enables you to easily configure a continuous integration flow in which your app is tested each time the source bucket changes. This tutorial shows how to create and configure a pipeline to test your built iOS app from an Amazon S3 bucket. The pipeline detects the arrival of a saved change through Amazon CloudWatch Events, and then uses Device Farm to test the built application.

You can try this out using your existing iOS app, or use the sample iOS app.

      The Step 2: Source page in the AWS CodePipeline pipeline wizard

Configure Add definitions Upload Test Report
Configure pipeline resources Add test definitions to your package Upload .zip to your bucket Test output artifact kicked off automatically View test results

Configure AWS CodePipeline to Use Your Device Farm Tests (Amazon S3 Example)

  1. Create or use an Amazon S3 bucket with versioning enabled. You can follow the instructions in Step 1: Create an Amazon S3 Bucket for Your Application to create an Amazon S3 bucket.

  2. In the Amazon S3 console for your bucket, choose Upload, and follow the instructions to upload your .zip file.

    Your sample built application must be packaged in a .zip file.

  3. To create your pipeline and add a source stage, do the following:

    1. Sign in to the AWS Management Console and open the AWS CodePipeline console at

    2. Choose Create pipeline, and then enter a name for your pipeline.

    3. In Source provider, choose Amazon S3.

    4. In Amazon S3 location, enter the file path and object key for your .zip file.

                Add an S3 source to your pipeline.
    5. Choose Next step.

  4. In Build, create a placeholder build stage for your pipeline. This allows you to create the pipeline in the wizard. After you use the wizard to create your two-stage pipeline, you will no longer need this placeholder build stage. After the pipeline is completed, this second stage is deleted and the new test stage is added in step 5.

    1. In Build provider, choose Add Jenkins. This build selection is only a placeholder. It is not used.

    2. In Provider name, enter a name. The name is only a placeholder. It is not used.

    3. In Server URL, enter text. The text is only a placeholder. It is not used.

    4. In Project name, enter a name. The name is only a placeholder. It is not used.

                Define a placeholder build stage for your pipeline.
    5. Choose Next step.

    6. In Deployment provider, choose No Deployment, and then choose Next step.

    7. In Service role name, choose AWS-CodePipeline-Service, and then choose Create role. This creates a service role for AWS CodePipeline to manage permissions to other AWS services.


      If you use an AWS CodePipeline service role that was created before July 2018, you need to add permissions for Device Farm. To do this, open the IAM console, find the role, and then add the following permissions to the role's policy. For more information, see Add Permissions for Other AWS Services.

      { "Effect": "Allow", "Action": [ "devicefarm:ListProjects", "devicefarm:ListDevicePools", "devicefarm:GetRun", "devicefarm:GetUpload", "devicefarm:CreateUpload", "devicefarm:ScheduleRun" ], "Resource": "*" }
    8. Choose Create pipeline. You should see a diagram showing your pipeline source and build stages.

                View your pipeline.
  5. Add a Device Farm test action to your pipeline as follows:

    1. In the upper left, choose Edit.

    2. Choose the X icon to delete the build stage. This deletes the placeholder stage now that you no longer need it for pipeline creation.

    3. At the bottom of the diagram, choose + Stage.

    4. Enter a stage name, and then choose + Action.

    5. In Action category, choose Test.

    6. In Action name, enter a name.

    7. In Test provider, choose AWS Device Farm.

    8. Type an Action Name and from the Test provider drop-down menu, choose AWS Device Farm.

                Add a device farm test action to your pipeline.
    9. In Project name, choose your existing Device Farm project or choose Create a new project.

    10. In Device pool, choose your existing device pool or choose Create a new device pool. If you create a device pool, you need to select a set of test devices.

    11. In App type, choose iOS.

                Configure AWS CodePipeline to use Device Farm as a test provider for stages of your pipeline.
    12. In App file path, enter the path of the compiled app package. The path is relative to the root of the input artifact for the test stage. Typically, this path is similar to ios-test.ipa.

    13. In Test type, do one of the following:

      • If you're using one of the built-in Device Farm tests, choose the type of test configured in your Device Farm project.

      • If you aren't using one of the built-in Device Farm tests, choose your type of test, and then in Test file path, enter the path of the test definition file. The path is relative to the root of the input artifact for your test.

                Device Farm test types.
    14. In the remaining fields, provide the configuration that is appropriate for your test and application type.

    15. (Optional) In Advanced, provide detailed configuration information for your test run.

                Advanced Device Farm configurations.
    16. In Input artifacts, choose MyApp.

      In the AWS CodePipeline console, you can find the name of the output artifact for each stage by hovering over the information icon in the pipeline diagram. Because your pipeline tests your app directly from the Source stage, choose MyApp.

                Advanced Device Farm configurations.
    17. At the bottom of the panel, choose Add Action.

    18. In the AWS CodePipeline pane, choose Save pipeline change, and then choose Save change. View your updated pipeline.

                Advanced Device Farm configurations.
    19. To submit your changes and start a pipeline build, choose Release change, and then choose Release.