Skip to content

fix(deploy): guard prepare hook install so CF staging does not fail - #2222

Merged
jung-thomas merged 1 commit into
DEVfrom
worktree-fix-prepare-hook-cf-staging
Sep 9, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
worktree-fix-prepare-hook-cf-staging

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Root cause

Both last night's PROD emergency deploy and today's DEV deploy failed at CF staging with:

> tutorials-ims@1.0.0 prepare
> npm run setup:git-hooks
> sh scripts/install-git-hooks.sh
sh: 0: cannot open scripts/install-git-hooks.sh: No such file
npm error code 2   -> BuildpackCompileFailed

The prepare hook was wired in 8febee66 (CI-structure change). prepare runs on every npm install, including the CF buildpack compile phase. cds build --production carries the prepare/setup:git-hooks scripts into gen/srv/package.json but does not copy the dev-only shell script, so staging aborts.

Fix

Guard setup:git-hooks to no-op when the dev-only install script is absent (the CF artifact), preserving local dev behavior when present.

Verification

  • File absent (CF-staging condition) → guard skips, exit 0
  • File present (local) → installs 3 hooks, exit 0
  • package.json valid JSON

Deploy-blocking. Needs to reach main too for the PROD retry (main == DEV currently).

The prepare hook (added in 8febee6) runs 'sh scripts/install-git-hooks.sh'
on every npm install, including the CF buildpack compile phase. cds build
carries the prepare/setup:git-hooks scripts into gen/srv/package.json but does
NOT copy scripts/install-git-hooks.sh, so staging aborts with
'cannot open scripts/install-git-hooks.sh: No such file' -> BuildpackCompileFailed.
This broke both last night's PROD deploy and today's DEV deploy.

Guard setup:git-hooks to no-op when the dev-only script is absent (CF artifact),
while preserving local behavior when it's present.
@jung-thomas
jung-thomas merged commit d74662d into DEV Sep 9, 2026
6 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-prepare-hook-cf-staging branch September 9, 2026 15:24
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