fix(cd): re-land lefthook hooks + override better-sqlite3 for Node 24 CD build - #281
Merged
Merged
Conversation
…-land, git-less build safe) Re-applies #278, which broke the Cloud Build CD image build: that image has no git binary, so lefthook's postinstall and the repo's prepare script both failed with 'exec: git: executable file not found in $PATH'. - prepare: 'lefthook install || exit 0' so a missing git/.git never fails an install - pnpm-workspace.yaml: lefthook: false (skip its postinstall; prepare handles hook install locally)
…in CD) @nuxt/content@3.4.0 pins better-sqlite3 11.9.1, which predates Node 24. On the node:24-alpine CD image it is compiled from source and nuxt generate aborts at @nuxt/content init with 'node::RemoveEnvironmentCleanupHook ... Assertion failed: (env) != nullptr' (exit 134). Verified on CD: crashed 3/3 without the override, passed and deployed to dev with it.
Collaborator
Author
|
/gcbrun |
Collaborator
|
Temporary Url for review: https://yfthig-dev--pr-281-wc36mjh9.web.app |
panish16
added a commit
to panish16/ppr
that referenced
this pull request
Sep 21, 2026
The root prepare script ran 'lefthook install' unconditionally, which fails in environments without git/.git (e.g. Cloud Build images). Same guard as bcgov/bcregistry#281.
panish16
pushed a commit
to panish16/connect
that referenced
this pull request
Sep 23, 2026
Adds the secret-scan command from the Git Hooks RFC (discussion bcgov#23) to the lefthook config already on main (lint + typecheck only, no secret scanning yet). Matches the pattern now live on bcgov/bcregistry and bcgov/ppr: bare 'npx gitleaks-secret-scanner', no custom install script. Also guards 'prepare' with '|| exit 0' so a missing git binary (e.g. a git-less CD build image) can't fail the install - this bit bcregistry after it merged the same lefthook setup without the guard: bcgov/bcregistry#281
This was referenced Sep 23, 2026
panish16
added a commit
to panish16/namex
that referenced
this pull request
Sep 24, 2026
lefthook's own npm postinstall already skips itself under CI=true by default (only installs if LEFTHOOK=1/true is explicitly set - see https://lefthook.dev/usage/envs/LEFTHOOK.html). Our prepare script called 'lefthook install' directly though, which bypasses that and always runs - that's what broke bcgov/bcregistry#281's CD build (no git in the image). '|| exit 0' (the fix used on bcregistry/ppr) stops the failure from crashing the install, but still attempts the install in CI every time. This skips it outright when CI is set, since hooks have no purpose in a non-interactive build anyway.
This was referenced Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-lands #278 (reverted in da2cf56) and fixes two separate reasons the CD image build fails. CD is currently red on
mainfor the second one.1. lefthook breaks the CD install (caused by #278)
CD build image (
node:24-alpine, Cloud Build) has nogit/.git:prepare:lefthook install || exit 0pnpm-workspace.yaml:lefthook: false(skip its own postinstall;prepareinstalls hooks locally)2.
nuxt generatecore-dumps in CD (independent of lefthook, hitsmaintoo)happens right at
@nuxt/contentinit.@nuxt/content@3.4.0pinsbetter-sqlite3@11.9.1, which predates Node 24; there is no musl prebuild so CD compiles it from source.overrides: better-sqlite3: 12.11.1(engines include Node 24). Lockfile diff is limited to better-sqlite3.Evidence: 3/3 CD runs failed without the override, including a
maindeploy on da2cf56 which has no lefthook (run 35617976139); same commit had been green on 09-18, so the crash is intermittent-to-consistent, not tied to toolchain (gcc/musl/python and the node:24-alpine source build were identical in green and red logs).Verification
The PR checks do not exercise the CD image (GitHub runners and the
node:24bcregistry-ui-ci-prtrigger both have git; that trigger is alsoCOMMENTS_ENABLEDso it stays "fail 0s" until an owner comments/gcbrun). The real test is CD: both fixes together ran throughBCREGISTRY UI CDfrom afeature-*branch (run 35622407773): install OK,nuxt generateOK, "Deploy complete" to yfthig-dev.web.app.