chore(githooks): remove pre-push hook (#22956)

## Summary
- remove the `pre-push` git hook script from the repository
- remove the `make pre-push` target and related Makefile documentation
- update contributor and agent docs so they only describe the remaining
`pre-commit` hook

## Validation
- `make pre-commit`
- `git diff --check`

---
_Generated with [`mux`](https://github.com/coder/mux) • Model:
`openai:gpt-5.4` • Thinking: `high`_
This commit is contained in:
Thomas Kosiewski
2026-03-11 17:44:19 +01:00
committed by GitHub
parent 77d53d2955
commit e96cd5cbb2
5 changed files with 20 additions and 90 deletions
+3 -7
View File
@@ -50,7 +50,6 @@ Only pause to ask for confirmation when:
| **Format** | `make fmt` | Auto-format code |
| **Clean** | `make clean` | Clean build artifacts |
| **Pre-commit** | `make pre-commit` | Fast CI checks (gen/fmt/lint/build) |
| **Pre-push** | `make pre-push` | All CI checks including tests |
### Documentation Commands
@@ -119,16 +118,13 @@ no matter how long they take.
git config core.hooksPath scripts/githooks
```
Two hooks run automatically:
One hook runs automatically:
- **pre-commit**: `make pre-commit` (gen, fmt, lint, typos, build).
Fast checks that catch most CI failures. Allow at least 5 minutes.
- **pre-push**: `make pre-push` (full CI suite including tests).
Runs before pushing to catch everything CI would. Allow at least
15 minutes (race tests are slow without cache).
`git commit` and `git push` will appear to hang while hooks run.
This is normal. Do not interrupt, retry, or reduce the timeout.
`git commit` will appear to hang while the hook runs. This is normal.
Do not interrupt, retry, or reduce the timeout.
NEVER run `git config core.hooksPath` to change or disable hooks.
+17 -55
View File
@@ -20,9 +20,9 @@ SHELL := bash
.ONESHELL:
# When MAKE_TIMED=1, replace SHELL with a wrapper that prints
# elapsed wall-clock time for each recipe. pre-commit and pre-push
# set this on their sub-makes so every parallel job reports its
# duration. Ad-hoc usage: make MAKE_TIMED=1 test
# elapsed wall-clock time for each recipe. pre-commit sets this on
# its sub-makes so every parallel job reports its duration. Ad-hoc
# usage: make MAKE_TIMED=1 test
ifdef MAKE_TIMED
SHELL := $(CURDIR)/scripts/lib/timed-shell.sh
.SHELLFLAGS = $@ -ceu
@@ -113,9 +113,9 @@ VERSION := $(shell ./scripts/version.sh)
POSTGRES_VERSION ?= 17
POSTGRES_IMAGE ?= us-docker.pkg.dev/coder-v2-images-public/public/postgres:$(POSTGRES_VERSION)
# Limit parallel Make jobs in pre-commit/pre-push. Defaults to
# nproc/4 (min 2) since test and lint targets have internal
# parallelism. Override: make pre-push PARALLEL_JOBS=8
# Limit parallel Make jobs in pre-commit. Defaults to nproc/4
# (min 2) since lint and build targets have internal parallelism.
# Override: make pre-commit PARALLEL_JOBS=8
PARALLEL_JOBS ?= $(shell n=$$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 8); echo $$(( n / 4 > 2 ? n / 4 : 2 )))
# Use the highest ZSTD compression level in release builds to
@@ -713,37 +713,18 @@ lint/typos: build/typos-$(TYPOS_VERSION)
build/typos-$(TYPOS_VERSION) --config .github/workflows/typos.toml
.PHONY: lint/typos
# pre-commit and pre-push mirror CI "required" jobs locally.
# See the "required" job's needs list in .github/workflows/ci.yaml.
# pre-commit mirrors the fast local CI checks.
#
# pre-commit runs checks that don't need external services (Docker,
# Playwright). This is the git pre-commit hook default since test
# and Docker failures in the local environment would otherwise block
# It runs checks that don't need external services (Docker,
# Playwright). This is the git pre-commit hook default since Docker
# and browser issues in the local environment would otherwise block
# all commits.
#
# pre-push runs the full CI suite including tests. This is the git
# pre-push hook default, catching everything CI would before pushing.
#
# pre-push uses two-phase execution: gen+fmt+test-postgres-docker
# first (writes files, starts Docker), then lint+build+test in
# parallel. pre-commit uses two phases: gen+fmt first, then
# lint+build. This avoids races where gen's `go run` creates
# temporary .go files that lint's find-based checks pick up.
# Within each phase, targets run in parallel via -j. Both fail if
# any tracked files have unstaged changes afterward.
#
# Both pre-commit and pre-push:
# gen, fmt, lint, lint/typos, slim binary (local arch)
#
# pre-push only (need external services or are slow):
# site/out/index.html (pnpm build)
# test-postgres-docker + test (needs Docker)
# test-js, test-e2e (needs Playwright)
# sqlc-vet (needs Docker)
# offlinedocs/check
#
# Omitted:
# test-go-pg-17 (same tests, different PG version)
# pre-commit uses two phases: gen+fmt first, then lint+build. This
# avoids races where gen's `go run` creates temporary .go files that
# lint's find-based checks pick up. Within each phase, targets run in
# parallel via -j. It fails if any tracked files have unstaged
# changes afterward.
define check-unstaged
unstaged="$$(git diff --name-only)"
@@ -777,27 +758,6 @@ pre-commit:
echo "$(BOLD)$(GREEN)=== pre-commit passed in $$(( $$(date +%s) - $$start ))s ===$(RESET)"
.PHONY: pre-commit
pre-push:
start=$$(date +%s)
echo "=== Phase 1/2: gen + fmt + postgres ==="
$(MAKE) -j$(PARALLEL_JOBS) --output-sync=target MAKE_TIMED=1 gen fmt test-postgres-docker
$(check-unstaged)
echo "=== Phase 2/2: lint + build + test ==="
$(MAKE) -j$(PARALLEL_JOBS) --output-sync=target MAKE_TIMED=1 \
lint \
lint/typos \
build/coder-slim_$(GOOS)_$(GOARCH)$(GOOS_BIN_EXT) \
site/out/index.html \
test \
test-js \
test-e2e \
test-race \
sqlc-vet \
offlinedocs/check
$(check-unstaged)
echo "$(BOLD)$(GREEN)=== pre-push passed in $$(( $$(date +%s) - $$start ))s ===$(RESET)"
.PHONY: pre-push
offlinedocs/check: offlinedocs/node_modules/.installed
cd offlinedocs/
pnpm format:check
@@ -1475,3 +1435,5 @@ dogfood/coder/nix.hash: flake.nix flake.lock
count-test-databases:
PGPASSWORD=postgres psql -h localhost -U postgres -d coder_testing -P pager=off -c 'SELECT test_package, count(*) as count from test_databases GROUP BY test_package ORDER BY count DESC'
.PHONY: count-test-databases
.PHONY: count-test-databases
-1
View File
@@ -71,7 +71,6 @@ Use the following `make` commands and scripts in development:
- `make install` installs binaries to `$GOPATH/bin`
- `make test`
- `make pre-commit` runs gen, fmt, lint, typos, and builds a slim binary
- `make pre-push` runs the full CI suite including tests
Install the git hooks to run these automatically:
-1
View File
@@ -3,7 +3,6 @@
# Pre-commit hook that runs CI-equivalent checks locally.
# Runs `make pre-commit` (gen, fmt, lint, typos, build) which
# catches most CI failures without needing Docker or Playwright.
# The full CI suite (including tests) runs via the pre-push hook.
#
# Installation (worktree-compatible):
#
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
#
# Pre-push hook that runs the full CI suite locally.
# Runs `make pre-push` (gen, fmt, lint, typos, build, tests)
# to catch issues before they reach CI.
#
# The pre-commit hook already runs the lite checks on each commit.
# This hook adds the heavier checks (test-postgres, test-js,
# test-e2e, sqlc-vet, offlinedocs) before pushing.
#
# Installation (worktree-compatible):
#
# git config core.hooksPath scripts/githooks
#
# Bypass: git push --no-verify
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
unset GIT_DIR
# In linked worktrees, set worktree-scoped hooksPath to override shared config.
if [[ "$(git rev-parse --git-dir)" != "$(git rev-parse --git-common-dir)" ]]; then
git config --worktree core.hooksPath scripts/githooks
fi
exec make pre-push