Integrate Percy with Google Cloud Build
Integrate Percy with Google Cloud Build, a fully managed CI-CD platform on Google Cloud
Follow these steps to integrate Percy with Google Cloud Build:
Configuring Google Cloud Build environment variables
Start by configuring PERCY_TOKEN, our project-specific, write-only API token. It can be found in your Percy project settings.
Store PERCY_TOKEN in Google Secret Manager and reference it in your cloudbuild.yaml via availableSecrets and secretEnv. This keeps the token out of your build logs and source control.
Alternatively, you can export the variable as part of your build step:
Commit, branch, and pull request information
Percy auto-detects Google Cloud Build runs via the BUILD_ID and PROJECT_ID environment variables and reads the following native Cloud Build substitutions:
-
COMMIT_SHA— commit SHA -
BRANCH_NAME— branch name (when triggered by a branch push) -
_PR_NUMBER— pull request number (when triggered by a pull request)
If your trigger does not populate these substitutions, configure your environment to include PERCY_COMMIT, PERCY_BRANCH, and PERCY_PULL_REQUEST. See the environment variables docs page for more details.
Run your tests
With your environment configured, run your Percy snapshots via your test suite or another mechanism. Your Percy build will be created with the correct meta-data.
Parallelized build processes
If you parallelize your build across multiple steps or build configurations, PERCY_PARALLEL_TOTAL and PERCY_PARALLEL_NONCE need to be configured. Percy automatically uses Cloud Build’s 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
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!