Configuring your CI for Bitbucket integration
Once you have setup Bitbucket integration, you need to set up your CI to configure the Eyes SDK with information related to the Bitbucket pull request or commit request. To allow the Eyes Batch to integrate data received from the Bitbucket server, you need to set the following Environment variables:
-
APPLITOOLS_API_KEY
- Your API key. To obtain your key see How to obtain your API key. -
APPLITOOLS_SERVER_URL
- The URL of the Eyes server. If you use the public Eyes server, the URL ishttps://eyes.applitools.com
You also need to set the following Build configuration:
-
APPLITOOLS_BATCH_ID
- The Commit SHA of the current build. This also must be set as an environment variable before running Eyes tests.
If Eyes cannot recognize the End of Build event, (for example in your CI system, Bitbucket cannot recognize identify an End of Build event, or you have multiple concurrent builds), you also need to add a cURL command to notify Eyes when all builds are complete. For details, see Notifying Eyes when a build is complete.
Below are procedures to set required variables and other required settings in common CIs.
Bitbucket CI
In the Bitbucket configuration file .bitbucket-pipelines.yml, add the following lines:
script:
- export APPLITOOLS_API_KEY=<Your Api Key>
- export APPLITOOLS_SERVER_URL=<Eyes Server URL>
- export APPLITOOLS_BATCH_ID=$BITBUCKET_COMMIT
$BITBUCKET_COMMIT
is the default environment variable for BitBucket commit SHA, which is used with the BitBucket CI/CD.
CircleCI
Build configuration
In the folder .circleci
, in the config.yml
file, add the following run command under jobs/build/steps
before running the visual UI test.
jobs:
build:
steps:
- run: "export APPLITOOLS_BATCH_ID=`echo $CIRCLE_SHA1`"
Environment variable
-
In the project dashboard, click the “gear” icon.
-
In the menu on the left, click Build Settings > Environment variable.
-
Click Add Variable.
-
In the Name field, enter the following variables:
-
APPLITOOLS_API_KEY
- Your API key. To obtain your key see How to obtain your API key. -
APPLITOOLS_SERVER_URL
- The URL of the Eyes server. If you use the public Eyes server, the URL ishttps://eyes.applitools.com
-
AppVeyor
Build configuration
In the appveyor.yml
file, add the following line in the init:
section:
init:
- ps: $env:APPLITOOLS_BATCH_ID = if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) { $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT } else { $env:APPVEYOR_REPO_COMMIT }
Environment variable
-
On your project page, click SETTINGS.
-
On the left panel, select Environment.
-
In the Environment variables section click Add variable and add the following variables:
-
APPLITOOLS_API_KEY
- Your API key. To obtain your key see How to obtain your API key. -
APPLITOOLS_SERVER_URL
- The URL of the Eyes server. If you use the public Eyes server, the URL ishttps://eyes.applitools.com
-
-
Click Save.
Jenkins
Both configuration and setting the environment variable are done by navigating to the Jenkins project configuration, and going to the Execute shell window.
Build configuration
Set the APPLITOOLS_BATCH_ID
as follows:
export APPLITOOLS_BATCH_ID=`echo ${GIT_COMMIT}`
Replace {GIT_COMMIT} with the environment variable you use to store the Commit SHA pull request.
Environment variable
Configure the API key as follows:
export APPLITOOLS_API_KEY=<Your Api Key>
export APPLITOOLS_SERVER_URL=<Eyes Server URL>