Bitbucket Pipelines
Integrate BrowserStack’s Low Code Automation API with Bitbucket Pipelines to trigger test suites and monitor build statuses within your CI/CD process.
Insert the provided script into your Bitbucket Pipelines YAML file within a step, ensuring to replace placeholders with actual BrowserStack credentials.
Copy
pipelines:
default:
- step:
name: Trigger Test Suite
script:
- apt-get update && apt-get install -y jq
- |
response=$(curl -u YOUR_USERNAME:YOUR_ACCESS_KEY -X POST https://lcnc-api.browserstack.com/api/v1/test-suite/${TEST_SUITE_ID}/run)
BUILD_ID=$(echo $response | jq -r '.build_id')
echo "Build ID: $BUILD_ID"
echo $BUILD_ID > build_id.txt
artifacts:
- build_id.txt
- step:
name: Check Build Status
script:
- apt-get update && apt-get install -y jq
- BUILD_ID=$(cat build_id.txt)
- |
buildStatus=""
retryInterval=30
while [[ "$buildStatus" != "passed" && "$buildStatus" != "failed" ]]; do
response=$(curl -u YOUR_USERNAME:YOUR_ACCESS_KEY -s https://lcnc-api.browserstack.com/api/v1/builds/$BUILD_ID/status)
echo "Response: $response"
buildStatus=$(echo $response | jq -r '.build_status')
echo "Build Status: $buildStatus"
sleep $retryInterval
done
if [[ "$buildStatus" == "passed" ]]; then
echo "Build passed"
# Add further steps for actions to be taken if build passed
elif [[ "$buildStatus" == "failed" ]]; then
echo "Build failed"
exit 1
else
echo "Build status unknown"
exit 1
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!