perf: stop reinstalling psql, which the runner image already has - #61
Merged
Merged
Conversation
Both workflows ran `apt-get update && apt-get install -y postgresql-client` before touching the database. The ubuntu-24.04 runner image already ships PostgreSQL 16.15 -- only the service is disabled, so psql is on PATH already -- and the install cost about 9 seconds of index refresh for nothing. In the reset job that was most of the wall clock. Install only when psql is genuinely missing, rather than deleting the step, so this still works if a future image drops PostgreSQL. The fallback also gains --no-install-recommends. Verified both branches of the guard: with psql present it prints the version and exits 0; with it off PATH it takes the install path. Both workflows still parse and their shell is valid. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P1CCcrx5fDKuAGsNh8DUFG
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.
Both workflows ran this before touching the database:
The
ubuntu-24.04runner image (whatubuntu-latestresolves to) already ships PostgreSQL 16.15 — only the service is disabled by default, sopsqlis onPATHalready. The step was installing something that was already there, at the cost of anapt-get updateindex refresh.In the last reset run that was ~9 seconds (
20:36:32.66→20:36:41.46), which was most of that job's wall clock — the actual work takes about a second. Indeploy.ymlit's the same 9 seconds against a multi-minute job, so the saving there is real but minor.The change
Install only when
psqlis genuinely missing:Deleting the step outright would be shorter, but it would make the job depend silently on a property of the runner image we don't control. The guard keeps that dependency soft for the price of one conditional, and is free in the normal case. The fallback also picks up
--no-install-recommends.Applied in
reset-data.yml(its own step, renamedEnsure psql) and inline indeploy.yml's Load Workshop Data step.Verification
Both branches of the guard exercised locally:
psql (PostgreSQL) 14.13, exit 0PATH→psql not on the runner image; installing, exit 0Both workflows still parse as YAML and their shell steps pass
bash -n.Testing this before #60 merges
This branches from
main, so it still carries therefinput that #60 removes. To dispatch the reset workflow from this branch, set ref toperf/skip-redundant-psql-installso the checkout matches the dispatched branch — otherwise it checks outmainand fails on the missingscripts/fixture_collections.py, exactly as in the run that prompted #60.Once #60 merges this branch can be rebased and that caveat disappears.
Honest sizing: this saves seconds, not minutes. Worth it because it is nearly free, not because the job was slow.
🤖 Generated with Claude Code
https://claude.ai/code/session_01P1CCcrx5fDKuAGsNh8DUFG