Run PrestaFlow tests inside Bitbucket Pipelines: optionally boot a PrestaShop Flashlight instance, execute your suite, upload results (plus error and visual‑regression screenshots) to PrestaFlow, and comment the summary back on the pull request.
Companion of PrestaFlow/github-action and PrestaFlow/gitlab-component — same behaviour, same backend, different CI idioms.
# bitbucket-pipelines.yml
image: php:8.3-cli
pipelines:
pull-requests:
'**':
- step:
name: PrestaFlow
services: [docker]
script:
- pipe: docker://prestaflow/pipe-push:1.0.0
variables:
TOKEN: $PRESTAFLOW_TOKEN
PROJECT_ID: pk_01ABC...
FLASHLIGHT: 'true'
PS_VERSION: '9.0.0'
BITBUCKET_ACCESS_TOKEN: $PRESTAFLOW_BITBUCKET_TOKENFull sample: examples/bitbucket-pipelines.yml.
Add these in Repository settings → Repository variables:
| Variable | Required | Purpose |
|---|---|---|
PRESTAFLOW_TOKEN |
yes | PrestaFlow API token. Mark as Secured. |
PRESTAFLOW_BITBUCKET_TOKEN |
optional | Bitbucket Repository Access Token with pullrequest:write scope. Only needed if you want the pipe to post PR summary comments. Mark as Secured. |
| Name | Default | Description |
|---|---|---|
TOKEN |
— | PrestaFlow API token. Required. |
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] on the step. |
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. |
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:
PRESTAFLOW_REPORT_ID=… # PrestaFlow report ID
PRESTAFLOW_REPORT_URL=… # https://prestaflow.io/reports/…
PRESTAFLOW_PASSED=42
PRESTAFLOW_FAILED=0
PRESTAFLOW_SKIPPED=3
PRESTAFLOW_TOTAL=45
PRESTAFLOW_DURATION_MS=185432
PRESTAFLOW_STATUS=success # or "failure"Consume it in a later step by declaring artifacts: [prestaflow.env] on the pipe step and sourcing it downstream:
- step:
name: PrestaFlow
services: [docker]
artifacts: [prestaflow.env]
script:
- pipe: docker://prestaflow/pipe-push:1.0.0
variables:
TOKEN: $PRESTAFLOW_TOKEN
PROJECT_ID: pk_01ABC...
- step:
name: Notify
script:
- . prestaflow.env
- echo "Report ready → $PRESTAFLOW_REPORT_URL ($PRESTAFLOW_STATUS)"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.
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.
Setting FLASHLIGHT: 'true' boots a prestashop/prestashop-flashlight:<PS_VERSION> container plus a mariadb:lts, 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 container's entrypoint runs these scripts in order — each is a small self‑contained bash script under scripts/:
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.
- Docker Hub: the pipe is distributed as
prestaflow/pipe-push:<version>. Build & push:docker build -t prestaflow/pipe-push:1.0.0 -t prestaflow/pipe-push:1 -t prestaflow/pipe-push:latest . docker push prestaflow/pipe-push:1.0.0 docker push prestaflow/pipe-push:1 docker push prestaflow/pipe-push:latest - Bitbucket Marketplace: submit this repository at https://bitbucket.org/product/features/pipelines/integrations. Marketplace listings point to the same
pipe.yml/Docker image; there's no separate artifact to publish.
MIT — see LICENSE.