Skip to main content
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

Integrate App percy with AWS CodeBuild

Integrate App percy with AWS CodeBuild, a fully managed CI-CD service

Follow these steps to integrate App percy with AWS CodeBuild:

Configuring AWS CodeBuild environment variables

Start by configuring PERCY_TOKEN, our project-specific, write-only API token. It can be found in your App percy project settings.

In your CodeBuild project, go to Edit > Environment > Additional configuration > Environment variables and add PERCY_TOKEN. For sensitive values, store the token in AWS Systems Manager Parameter Store or AWS Secrets Manager and reference it by type.

Alternatively, you can export the variable as part of your buildspec:

bash
Copy icon Copy

Commit, branch, and pull request information

App percy auto-detects AWS CodeBuild builds via the CODEBUILD_BUILD_ID environment variable and reads the following native CodeBuild variables:

  • CODEBUILD_RESOLVED_SOURCE_VERSION — commit SHA.
  • CODEBUILD_WEBHOOK_HEAD_REF — full git ref of the source branch in the form refs/heads/<branch> (for example, refs/heads/main). App percy strips the refs/heads/ prefix before using the value for PERCY_BRANCH. Set only when triggered by a webhook.
  • CODEBUILD_WEBHOOK_TRIGGER — populated for pull request triggers in the form pr/<number> (for example, pr/42). App percy extracts the number for PERCY_PULL_REQUEST. Other webhook trigger types (branch/..., tag/...) do not populate the PR field.

If your build is not triggered via a webhook, branch and pull request data are not auto-populated. In that case, configure your environment to include PERCY_BRANCH and PERCY_PULL_REQUEST. See the environment variables docs page for more details.

Run your tests

With your environment configured, run your App percy snapshots via your test suite or another mechanism. Your App percy build will be created with the correct meta-data.

bash
Copy icon Copy

Parallelized build processes

If you run multiple CodeBuild jobs in parallel as part of a single CI run (for example, via a batch build), PERCY_PARALLEL_TOTAL and PERCY_PARALLEL_NONCE need to be configured. App percy automatically uses CodeBuild’s CODEBUILD_BUILD_ID as the parallel build nonce. Set PERCY_PARALLEL_TOTAL to the total number of parallel builds.

Keep your Percy token secret.

Anyone with access to your Percy token can add builds to your project, though they cannot read data. If your code is public, do not commit the PERCY_TOKEN to your code.

Reference Topic

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle