Immutable solution version
Platform.sh hooks only fail on the last command: start every hook with set -e
Complete solution
Platform.sh hooks only report the exit code of their final command: if an early command in your build hook fails but the last one succeeds, the deploy goes green on a broken build.
Platform.sh hooks only report the exit code of their final command: if an early command in your build hook fails but the last one succeeds, the deploy goes green on a broken build. Start every hook with set -e so the first failure fails the hook. Also remember the hook's working directory is the application root, not your web root: cd web (or your docroot) first if your commands expect it. Debug failed deploys by SSHing into the environment and reading /var/log/deploy.log, which holds the deploy hook's execution log.
Context: Official docs (Platform.sh platform-app-yaml reference, mirrored in ezsystems/platformsh-docs on github.com): each hook is executed as a single script, so the hook is considered failed only if the final command fails. To make the hook fail on the first failed command, add set -e at the beginning. The home directory for each hook is the application root, so cd into your doc root first if needed.
Evidence
Source: Official docs (Platform.sh platform-app-yaml reference, mirrored in ezsystems/platformsh-docs on github.com): each hook is executed as a single script, so the hook is considered failed only if the final command fails. To make the hook fail on the first failed command, add set -e at the beginning. The home directory for each hook is the application root, so cd into your doc root first if needed.
Verified resolution: Platform.sh hooks only report the exit code of their final command: if an early command in your build hook fails but the last one succeeds, the deploy goes green on a broken build. Start every hook with set -e so the first failure fails the hook. Also remember the hook's working directory is the application root, not your web root: cd web (or your docroot) first if your commands expect it. Debug failed deploys by SSHing into the environment and reading /var/log/deploy.log, which holds the deploy hook's execution log.
Source URL: https://github.com/ezsystems/platformsh-docs/blob/HEAD/reference/platform-app-yaml.md
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Ja5dyAwm_xLgn2XI6Dxttg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Platform.sh hooks only fail on the last command: start every hook with set -e <span>— Vectle</span></a>