Skip to content

Flashlight: working env, readiness on /admin-dev/, unique artifacts, per-version PR comments, module install - #10

Merged
PrestaEdit merged 5 commits into
mainfrom
fix/flashlight-env-and-readiness
Sep 25, 2026
Merged

PrestaEdit merged 5 commits into
mainfrom
fix/flashlight-env-and-readiness

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor

Defects found while running the PrestaFlow blog series and PrestaFlow/psflowdemo#1 against the Action. Each commit fixes one defect, adds a test that failed first, and rebuilds dist/. npm run all passes: lint, 16 suites / 108 tests, ncc build.

Commit Defect → fix
6935b66 Env. With flashlight: true the Action wrote a .env.local holding only FO_URL and PS_VERSION, so phpdotenv ignored the repo's .env. The library's BO defaults (demo@prestashop.com) don't match Flashlight. Under variables_order=GPCS (setup-php's default), env: never reached $_ENV. Fix: one merged .env.local, from lowest to highest priority: Flashlight BO credentials, then the user's .env.local/.env, then the shop-derived FO_URL/BO_URL/PS_VERSION, then any PRESTAFLOW_* from the step's env:. Values are escaped for phpdotenv. An existing .env.local is restored afterwards. psflowdemo#1 failed because of this: BO URL null, locale ignored.
58b281e Readiness. Waits for 302/200 on /admin-dev/ instead of 200–399 on /. On timeout it prints docker compose logs, tears down, and fails with the URL and the last status.
cc6ee25 Artifacts. In a matrix every job uploaded under the same name and all but one got a 409. The name is now unique per run, attempt, job, PS version and suites, with one retry on conflict.
b1b25dd PR comment. The finder matched only the <!-- prestaflow-run: prefix, so matrix jobs and even different projects overwrote one another. Now one comment per (project, PS version), with an exact marker match. One comment with a section per version was rejected: parallel read-merge-write races, since GitHub has no conditional update.
1a644ee Module install. New input flashlight-install-module (default true) runs prestashop:module install for a mounted prestashop-module. Tested on 1.7.8.11, 8.1.7 and 9.0.0. Re-running on an installed module upgrades it and succeeds. Success is read from the output, because the exit code is 0 even on failure in 8.1/9.0. A failure only warns.

Behaviour changes for @v2 users

  • The Flashlight BO defaults to admin@prestashop.com / prestashop. Credentials the user sets still win.
  • env: on the step and the repo's .env now work with Flashlight.
  • The generated .env.local is removed after the run.
  • The artifact name changes.
  • One PR comment per PS version. Old comments without a version are no longer updated.
  • The mounted module is installed automatically; flashlight-install-module: false turns it off.

Releasing

After merge: tag a minor version (new input plus behaviour changes, e.g. v2.1.0), then move v2. psflowdemo uses @main, so it picks the fix up at merge.

Not changed

🤖 Generated with Claude Code

PrestaEdit and others added 5 commits September 25, 2026 09:18
The PHP library (v1.7.1) reads its settings from $_ENV only, filled by
phpdotenv from the first existing file among .env.local and .env
(short-circuit: .env is never read once .env.local exists) in immutable
mode. The action wrote a .env.local holding only FO_URL and PS_VERSION, so:

- the lib fell back to its default back-office credentials
  (demo@prestashop.com), which do not exist on Flashlight;
- the user's .env was silently ignored;
- a PRESTAFLOW_* var passed with `env:` never reached $_ENV under
  variables_order=GPCS (setup-php default). Worse, since it is visible
  in $_SERVER, immutable phpdotenv also refused to load the same key from
  .env.local: the key ended up missing and the lib used its default. The
  action itself hit this with PRESTAFLOW_FO_URL, which it passed both in
  the composer env and in .env.local.

The generated .env.local now layers, lowest to highest priority (later
assignments win within one phpdotenv file): Flashlight BO credentials
(admin@prestashop.com / prestashop), the user's dotenv file copied
verbatim (.env.local if present, else .env), the Flashlight FO/BO URLs and
PS version, then every PRESTAFLOW_* from the step env. Values are quoted
for phpdotenv (single quotes are literal, so JSON for EXTRA_HEADERS /
COOKIES is kept as is; double quotes with escapes otherwise). The keys
written there are stripped from the composer process env. A pre-existing
.env.local is restored after the run; otherwise the generated file is
removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Readiness was a 2xx/3xx on `/`. Flashlight's front answers as soon as the
web server is up, so this only proved that something listened on the port,
not that PHP and PrestaShop were serving: tests could start against a shop
still running its post-install scripts.

Flashlight renames the admin folder to the fixed `admin-dev`, which
redirects (302) to the AdminLogin page once PrestaShop really serves
(checked on the 1.7.8.11, 8.1.7 and 9.0.0 images). We now poll
`<url>/admin-dev/` for a 302 (or 200), still with the 240s timeout. On
timeout the error names the URL and the last status, and since no handle
is returned to the caller, `docker compose logs` is printed and the stack
is torn down before failing; previously the containers were left running
and no logs were shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The artifact was named prestaflow-report-<run>-<attempt>, identical for
every job of a run. Artifact names must be unique within a run and
@actions/artifact v2 has no overwrite (CreateArtifact answers 409 Conflict
and uploadArtifact throws), so in a matrix only the first leg uploaded its
results and screenshots; the others only logged a warning.

The name now appends the job id (GITHUB_JOB), the PS version when
Flashlight is on and the suites, with characters rejected by the artifact
service replaced. Matrix values are not exposed to actions, so legs that
still share all of these (e.g. a matrix on the PHP version) retry once
under a random suffix instead of losing their artifact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment finder matched any comment starting with
`<!-- prestaflow-run:` (or the legacy marker), whatever the project key:
the "per-project" marker was written but never compared. Every job of a
Flashlight matrix, and every project posting on the same PR, therefore
updated the same comment and only the last one to finish stayed visible.

The marker now includes the PS version when Flashlight is on
(`<!-- prestaflow-run:<projectKey>:ps-<version> -->`), the title shows it,
and the finder compares the whole marker line. Each version gets its own
comment. A single comment with one section per version was rejected: the
legs run concurrently and would have to read, merge and rewrite the same
comment, and the GitHub API has no conditional update to make that
race-free. Non-versioned markers can still take over the legacy
`<!-- prestaflow-report -->` comment; versioned ones do not, so that
concurrent legs never compete for it.

Also fix the README opt-out example, which used a non-existent `comment`
input instead of `pr-comment`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A composer `prestashop-module` was mounted in modules/<name> but never
installed, so every user had to write a Flashlight init-script just to run
`prestashop:module install`.

New input `flashlight-install-module` (default true): once the shop is
ready, run `php bin/console prestashop:module install <name>` in the
container. Only for a composer prestashop-module mounted under modules/
(not themes, root mounts or the modules/<repo> fallback for unknown
types). Checked on the 1.7.8.11, 8.1.7 and 9.0.0 Flashlight images: on
an already installed module (e.g. by an init-script) PrestaShop runs an
upgrade and reports the same success, so it does not break existing
setups. The exit code is 0 even on failure on 8.1/9.0, so success is read
from the output; a failure only warns, the tests then tell whether the
module was needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PrestaEdit
PrestaEdit merged commit 988efbf into main Sep 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant