Bitbucket Pipe
On this page
#Bitbucket Pipe
#Introduction
The PrestaFlow Bitbucket Pipe runs your PrestaFlow test suites inside a Bitbucket Pipelines step. It is a companion of the GitHub Action and the GitLab CI/CD component — same behavior, same backend, different CI idiom. Optionally boot a PrestaShop Flashlight instance, execute your suite, upload results (plus error and visual-regression screenshots), and comment the summary on the pull request.
#Requirements
- Bitbucket Pipelines with Docker enabled on the step (
services: [docker]) wheneverFLASHLIGHT=true. - Two repository variables (Repository settings → Repository variables):
PRESTAFLOW_TOKEN(Secured) — PrestaFlow API token.PRESTAFLOW_BITBUCKET_TOKEN(Secured, optional) — Bitbucket Repository Access Token withpullrequest:writescope, used to post PR comments.
#Quick start
The minimal bitbucket-pipelines.yml below runs the pipe on every pull
request:
1image: php:8.3-cli 2 3pipelines: 4 pull-requests: 5 '**': 6 - step: 7 name: PrestaFlow 8 services: [docker] 9 script:10 - pipe: docker://prestaflow/pipe-push:1.0.011 variables:12 TOKEN: $PRESTAFLOW_TOKEN13 PROJECT_ID: pk_01ABC...14 FLASHLIGHT: 'true'15 PS_VERSION: '9.0.0'16 BITBUCKET_ACCESS_TOKEN: $PRESTAFLOW_BITBUCKET_TOKEN
#Variables reference
| Name | Default | Description |
|---|---|---|
TOKEN |
(required) | PrestaFlow API token. |
PROJECT_ID |
"" |
PrestaFlow project Product Key (e.g. pk_01ABC…). |
API_URL |
https://api.prestaflow.io |
PrestaFlow API base URL. |
EXECUTE |
true |
Run composer run prestaflow:json:file before upload. Set to false if a previous step already produced results.json. |
SUITES |
"" |
Comma-separated suites to run (e.g. BackOffice,FrontOffice). Empty runs all. |
FLASHLIGHT |
false |
Boot a PrestaShop Flashlight Docker container to test against. Requires services: [docker]. |
PS_VERSION |
latest |
Flashlight image tag when FLASHLIGHT=true. |
FLASHLIGHT_MOUNT |
auto |
Where to mount the workspace inside the Flashlight container: auto, root, modules, or themes. auto reads composer.json type (prestashop-module / prestashop-theme). |
FLASHLIGHT_INIT_SCRIPTS |
"" |
Path (absolute or relative to the workspace) to a directory of Flashlight init scripts, mounted read-only at /tmp/init-scripts. |
PR_COMMENT |
auto | Post/update a PR summary comment. Defaults to true on pull-request pipelines, false otherwise. |
UPLOAD_ARTIFACTS |
true |
Copy results.json (and prestaflow.env) into $BITBUCKET_PIPE_SHARED_STORAGE_DIR. |
VISUAL |
true |
Enable visual-regression round-trip (baseline download before the run, actual/diff upload after). |
BITBUCKET_ACCESS_TOKEN |
"" |
Access token used to post PR comments. See PR comments. |
#Outputs
After the pipe runs, it writes prestaflow.env into the workspace and
into $BITBUCKET_PIPE_SHARED_STORAGE_DIR/prestaflow.env (when available).
The file contains:
1PRESTAFLOW_REPORT_ID=… # PrestaFlow report ID2PRESTAFLOW_REPORT_URL=… # https://prestaflow.io/reports/…3PRESTAFLOW_PASSED=424PRESTAFLOW_FAILED=05PRESTAFLOW_SKIPPED=36PRESTAFLOW_TOTAL=457PRESTAFLOW_DURATION_MS=1854328PRESTAFLOW_STATUS=success # or "failure"
Consume it in a later step by declaring artifacts: [prestaflow.env] on the
pipe step and sourcing it downstream:
1- step: 2 name: PrestaFlow 3 services: [docker] 4 artifacts: [prestaflow.env] 5 script: 6 - pipe: docker://prestaflow/pipe-push:1.0.0 7 variables: 8 TOKEN: $PRESTAFLOW_TOKEN 9 PROJECT_ID: pk_01ABC...10 11- step:12 name: Notify13 script:14 - . prestaflow.env15 - echo "Report ready → $PRESTAFLOW_REPORT_URL ($PRESTAFLOW_STATUS)"
#PR comments
When the pipe runs on a pull-request pipeline and BITBUCKET_ACCESS_TOKEN
is set, it posts (or updates) a summary comment via the
Bitbucket Cloud API.
Idempotency is done via a hidden marker
(<!-- prestaflow-run:<project-key> -->) inside the comment body, so
subsequent pushes update the existing comment rather than appending a new
one.
To create the token:
- Repository settings → Access tokens → Create Repository Access Token.
- Grant it Pull requests: write.
- Add it as a Secured repository variable (e.g.
PRESTAFLOW_BITBUCKET_TOKEN) and pass it asBITBUCKET_ACCESS_TOKEN.
If the token is missing, the pipe warns and continues — PR comments are non-fatal.
#Flashlight
Setting FLASHLIGHT: 'true' boots a
prestashop/prestashop-flashlight:<PS_VERSION> container plus a
mariadb:lts sidecar, waits for the storefront to answer, and exports
PRESTAFLOW_FO_URL into .env.local for your test suite. The step needs
services: [docker].
FLASHLIGHT_MOUNT:
auto(default): readscomposer.jsontypeand mounts undermodules/<name>orthemes/<name>; falls back tomodules/<repo-basename>with a warning.root: mount workspace at/var/www/html(custom PrestaShop distributions).modules/themes: force the location.
The compatibility rules that apply to the GitHub Action's Flashlight guide
apply here as well: match PS_VERSION at least at the major.minor level to
the code you are mounting. See the
GitHub Action guide
for the full compatibility notes.
#What the pipe does
The container's entrypoint runs these scripts in order — each is a small self-contained bash script:
flashlight.sh— boot Flashlight (opt-in).visual-download.sh— pull visual baselines for the current branch.runner.sh—composer run prestaflow:json:file(unlessEXECUTE=false).upload.sh— POSTresults.json+ error/visual PNGs to the PrestaFlow API.comment-pr.sh— post/update the PR comment.outputs.sh— aggregate final counters and exit non-zero on any test failure.
#Publishing
The pipe is distributed as prestaflow/pipe-push:<version> on Docker Hub:
1docker build -t prestaflow/pipe-push:1.0.0 \2 -t prestaflow/pipe-push:1 \3 -t prestaflow/pipe-push:latest .4docker push prestaflow/pipe-push:1.0.05docker push prestaflow/pipe-push:16docker push prestaflow/pipe-push:latest
To submit the pipe on the Bitbucket Marketplace, register the repository at
https://bitbucket.org/product/features/pipelines/integrations. Marketplace
listings point to the same pipe.yml / Docker image; there is no separate
artifact to publish.
#Troubleshooting
services: [docker]missing / Docker daemon not available — required wheneverFLASHLIGHT=true. Addservices: [docker]on the step.- PR comment not posted — the pipe needs
BITBUCKET_ACCESS_TOKEN(Repository Access Token withpullrequest:write). Without it, the pipe logs a warning and continues. Flashlight not ready after 240000ms— the shop container failed to respond within four minutes. See the GitHub Action troubleshooting section — the same causes and remedies apply.
#Links
- Pipe repository: PrestaFlow/bitbucket-pipe
- Companion GitHub Action: PrestaFlow/github-action
- Companion GitLab component: PrestaFlow/gitlab-component
- PrestaShop Flashlight: PrestaShop/prestashop-flashlight