Bitbucket Integration
In order to integrate with Bitbucket, you can either use our CLI Tools or our Shell Scripts:
Prerequisites
- Create a Pipeline for your Bitbucket repository.
- Create a Test Suite on https://protect.lumar.io
- Generate Lumar API key and secret on https://accounts.lumar.io/api-access
How to Use (Shell Script)
In the Bitbucket Pipeline editor, add the following environment variables:
TEST_SUITE_ID
: The ID of your Test SuiteAUTOMATOR_USER_KEY_ID
: The key for Lumar API accessAUTOMATOR_USER_KEY_SECRET
: The secret for Lumar API access
Then add the following step to the pipeline yaml
file:
- step:
name: "Lumar Protect"
script:
- curl -L -o ./lumar-protect.sh https://raw.githubusercontent.com/deepcrawl/automator-sdk/master/ci.sh
- chmod +x lumar-protect.sh
- ./lumar-protect.sh $TEST_SUITE_ID false bitbucket-build-$BITBUCKET_BUILD_NUMBER
The pipeline step will wait for all tests to complete and succeed if all tests passed.
Additional Shell Script Options
Lumar Protect shell script accepts the following input arguments:
lumar-protect.sh TEST_SUITE_ID START_ONLY CI_BUILD_ID
To make the Bitbucket pipeline trigger your Lumar Protect Test Suite without waiting for all tests to complete, set the START_ONLY
argument to true
:
- step:
name: "Lumar Protect"
script:
- curl -L -o ./lumar-protect.sh https://raw.githubusercontent.com/deepcrawl/automator-sdk/master/ci.sh
- chmod +x lumar-protect.sh
- ./lumar-protect.sh $TEST_SUITE_ID true bitbucket-build-$BITBUCKET_BUILD_NUMBER
How to Use (CLI Tool)
In the Bitbucket Pipeline editor, add the following environment variables:
TEST_SUITE_ID
: The ID of your Test SuiteDEEPCRAWL_TEST_USER_KEY_ID
: The key for Lumar API accessDEEPCRAWL_TEST_USER_KEY_SECRET
: The secret for Lumar API access
Then add the following step to the pipeline yaml
file:
- step:
name: "Lumar Protect"
script:
- curl -L -o ./lumar-protect https://github.com/deepcrawl/deepcrawl-test/releases/download/v1.1.3/deepcrawl-test-linux
- chmod +x ./lumar-protect
- ./lumar-protect --testSuiteId=$TEST_SUITE_ID --ciBuildId=bitbucket-build-$BITBUCKET_BUILD_NUMBER | grep -i "tests passed"
- if [[ $? -ne 0 ]]; then echo "Tests Failed"; exit 1; fi
The pipeline step will wait for all tests to complete and succeed if all tests passed.
Additional CLI Tool Options
Lumar Protect CLI tool accepts the following input parameters:
--testSuiteId [string]
The Lumar Protect Test Suite ID.--ciBuildId [string] (OPTIONAL)
The corresponding build ID in your CI/CD pipeline.--startOnly [boolean] (OPTIONAL)
Start the Test Suite without waiting for all tests to finish.
To make the Bitbucket pipeline trigger your Lumar Protect Test Suite without waiting for all tests to complete, set the startOnly
parameter to true
:
- step:
name: "Lumar Protect"
script:
- curl -L -o ./lumar-protect https://github.com/deepcrawl/deepcrawl-test/releases/download/v1.1.3/deepcrawl-test-linux
- chmod +x ./lumar-protect
- ./lumar-protect --testSuiteId=$TEST_SUITE_ID --ciBuildId=bitbucket-build- --startOnly=true
See the official Lumar Protect CLI reference for the full list of parameters.