Covered in this doc
Integrating Percy with your Jenkins CI environment
Start by configuring
PERCY_TOKEN, our project-specific, write-only API token. It can be found in your Percy project settings.
Depending on how you have Jenkins configured, there are a few options for configuring environment variables. Two Jenkins plugins that allow you to configure environment variables include the Build Env Propagator Plugin and the EnvInject plugin.
Alternatively, you could export the variables as part of the build script:
export PERCY_TOKEN=<your token> npm install npm test
If you're using the default GitHub Branch Source Plugin or the equivalent Bitbucket Branch Source Plugin Percy will auto-detect the commit, branch, and pull request details for you from the environment variables the plugins provide.
If you're not using one of these plugins, please review our environment variables docs page, and configure your environment to include PERCY_COMMIT, PERCY_BRANCH, and PERCY_PULL_REQUEST.
Now with your environment configured, when you run your Percy snapshots via your test suite or another mechanism, your Percy build will be created with the correct meta-data.
npm install npm test
If you parallelize your build across multiple processes or nodes, PERCY_PARALLEL_TOTAL and PERCY_PARALLEL_NONCE will need to be configured too. If you're using one of the Branch Source plugins mentioned above, PERCY_PARALLEL_NONCE will automatically be configured to the BUILD_TAG. Please contact us to discuss how to set these variables to support parallelized build processes.
Keep your Percy token secret
Anyone with access to your 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.
Updated 2 years ago