Skip to content

Centralize CI PostgreSQL ref selection via postgres-build.conf#543

Merged
mason-sharp merged 1 commit into
mainfrom
ci-branch-config
Jul 24, 2026
Merged

Centralize CI PostgreSQL ref selection via postgres-build.conf#543
mason-sharp merged 1 commit into
mainfrom
ci-branch-config

Conversation

@mason-sharp

@mason-sharp mason-sharp commented Jul 23, 2026

Copy link
Copy Markdown
Member

Resolve the PG source ref (tag | branch | pin) per major from one config plus resolver script, used by all three build sites: Dockerfile-step-1.el9, pg-stable-test.yml, and run-single-pg18-installcheck.sh. Default 15-19 to "tag".

The purpose is to build against the most recent release tag most of the time, but allow for building against HEAD of Postgres major stable branches as we near new releases (before they have been stamped) by modifying tests/postgres-build.conf. The default values in that file are:

pg15_ref=tag
pg16_ref=tag
pg17_ref=tag
pg18_ref=tag
pg19_ref=tag

To build against the head of branches, replace tag with branch here. As mentioned above, one can also pin to a certain commit/ref.

Also, Dockerfile keeps an optional PG_REF build-arg so ref resolution can later move to the runner for layer caching without further Dockerfile changes. It also allows for flexible building locally.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The PR centralizes PostgreSQL ref selection in configuration and a resolver script, adds resolver tests, and updates CI, Docker, and PostgreSQL 18 installcheck source acquisition to use configurable refs.

PostgreSQL ref resolution

Layer / File(s) Summary
Resolver configuration and validation
tests/postgres-build.conf, tests/resolve-pg-ref.sh
Defines per-version ref modes and resolves branches, newest tags, or explicit refs with validation and diagnostics.
Resolver behavior tests
tests/resolve-pg-ref.test.sh
Tests parsing, branch and pin resolution, validation, output cleanliness, tag lookup, failure handling, and credential redaction.

Build entrypoints

Layer / File(s) Summary
CI and Docker source acquisition
.github/workflows/pg-stable-test.yml, tests/docker/Dockerfile-step-1.el9
Updates PostgreSQL source acquisition to use resolved refs, detached checkouts, commit logging, and an optional Docker PG_REF override.
Installcheck ref and remote selection
tests/run-single-pg18-installcheck.sh
Resolves PG_REF, selects a reachable remote, refreshes mismatched cached sources, and checks out the selected ref.

Poem

I’m a rabbit with refs in my hat,
Branches and tags, imagine that!
Pins hop along through config so neat,
CI and Docker clone what they meet.
Tests thump their paws: “All paths are clear!” 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: centralizing PostgreSQL ref selection in postgres-build.conf.
Description check ✅ Passed The description matches the changeset and explains the new resolver/config flow and its use sites.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci-branch-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pg-stable-test.yml:
- Line 7: Update the comment in the workflow header to remove the duplicated
“builds spock per the README” phrase, while preserving the surrounding
description about running regression tests.

In `@tests/run-single-pg18-installcheck.sh`:
- Around line 251-261: Update clone_pg to resolve PG_REF before the
cached-source early return, then validate the existing checkout’s HEAD against
that resolved ref. Only skip cloning when the source is valid and matches the
desired revision; otherwise refresh or re-clone it so config changes and moved
branches are applied.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 59e83bf2-a3be-433e-8083-61939392641c

📥 Commits

Reviewing files that changed from the base of the PR and between db380dd and abc9709.

📒 Files selected for processing (6)
  • .github/workflows/pg-stable-test.yml
  • tests/docker/Dockerfile-step-1.el9
  • tests/postgres-build.conf
  • tests/resolve-pg-ref.sh
  • tests/resolve-pg-ref.test.sh
  • tests/run-single-pg18-installcheck.sh

Comment thread .github/workflows/pg-stable-test.yml Outdated
Comment thread tests/run-single-pg18-installcheck.sh Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/resolve-pg-ref.sh`:
- Line 55: Update the no-tag error message in the ref-resolution flow around the
`die` call so it does not include `PG_GIT_REMOTE` or any unredacted remote URL.
Use a generic failure message while preserving the existing error condition and
`${major}` context.
- Around line 49-54: Update the tag-resolution logic assigning ref to capture
git ls-remote output in a separate tags variable and immediately fail closed
when that command returns a nonzero status. Then feed tags through printf '%s\n'
before the existing sed, tr, sort, tail, and final tr filters, preserving normal
successful tag resolution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 48ef912a-ddeb-4232-a5b0-d14a4cb6c44d

📥 Commits

Reviewing files that changed from the base of the PR and between abc9709 and c004732.

📒 Files selected for processing (6)
  • .github/workflows/pg-stable-test.yml
  • tests/docker/Dockerfile-step-1.el9
  • tests/postgres-build.conf
  • tests/resolve-pg-ref.sh
  • tests/resolve-pg-ref.test.sh
  • tests/run-single-pg18-installcheck.sh
🚧 Files skipped from review as they are similar to previous changes (5)
  • tests/postgres-build.conf
  • .github/workflows/pg-stable-test.yml
  • tests/run-single-pg18-installcheck.sh
  • tests/docker/Dockerfile-step-1.el9
  • tests/resolve-pg-ref.test.sh

Comment thread tests/resolve-pg-ref.sh Outdated
Comment thread tests/resolve-pg-ref.sh Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
tests/resolve-pg-ref.test.sh (1)

29-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make tag and commit-pin success paths deterministic.

Any resolver failure for tag is currently reported as a network skip, masking parser/selection regressions. Also, REL_16_9 does not exercise the promised raw commit-SHA path. Stub a successful git ls-remote response with multiple REL_17_* tags and assert the newest is selected; set pg16_ref to a full hexadecimal commit ID and assert it is emitted verbatim.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/resolve-pg-ref.test.sh` around lines 29 - 108, Update the test fixture
and assertions in the resolver test: replace pg16_ref with a full hexadecimal
commit SHA and keep asserting that the resolver emits it verbatim. Make the pg17
tag test deterministic by stubbing the resolver’s git ls-remote dependency with
multiple REL_17_* tags, assert the newest tag is selected, and remove the
network-dependent skip path so any resolver failure is reported as a test
failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/docker/Dockerfile-step-1.el9`:
- Around line 141-145: Update the PostgreSQL checkout flow around PG_REF so it
supports raw commit SHAs as well as branches and tags: initialize the
destination repository, fetch the resolved PG_REF into it, and checkout
FETCH_HEAD instead of using git clone --branch. Preserve the existing PG_REF
default resolution and logging, including reporting the checked-out short commit
and resolved reference.

In `@tests/resolve-pg-ref.sh`:
- Around line 66-70: Update the wildcard branch of the mode case in
resolve-pg-ref.sh so unsupported reference modes are rejected instead of copied
into ref. Accept only values matching the documented pinned-commit format, emit
those verbatim, and return a failure for unknown values while preserving the
existing branch and tag handling.

---

Nitpick comments:
In `@tests/resolve-pg-ref.test.sh`:
- Around line 29-108: Update the test fixture and assertions in the resolver
test: replace pg16_ref with a full hexadecimal commit SHA and keep asserting
that the resolver emits it verbatim. Make the pg17 tag test deterministic by
stubbing the resolver’s git ls-remote dependency with multiple REL_17_* tags,
assert the newest tag is selected, and remove the network-dependent skip path so
any resolver failure is reported as a test failure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e3039079-a4e9-4376-ac89-ba51f8234ba7

📥 Commits

Reviewing files that changed from the base of the PR and between c004732 and 4a955df.

📒 Files selected for processing (6)
  • .github/workflows/pg-stable-test.yml
  • tests/docker/Dockerfile-step-1.el9
  • tests/postgres-build.conf
  • tests/resolve-pg-ref.sh
  • tests/resolve-pg-ref.test.sh
  • tests/run-single-pg18-installcheck.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/postgres-build.conf
  • .github/workflows/pg-stable-test.yml
  • tests/run-single-pg18-installcheck.sh

Comment thread tests/docker/Dockerfile-step-1.el9 Outdated
Comment thread tests/resolve-pg-ref.sh
Resolve the PG source ref (tag | branch | pin) per major from one config
plus resolver script, used by all three build sites: Dockerfile-step-1.el9,
pg-stable-test.yml, and run-single-pg18-installcheck.sh. Default 15-19 to
tag: spock's patches track the release tags, so tags apply cleanly today
while REL_*_STABLE tips have drifted. Flip a major to branch alongside a
patch refresh.

Dockerfile keeps an optional PG_REF build-arg so ref resolution can later
move to the runner for layer caching without further Dockerfile changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/resolve-pg-ref.test.sh (1)

116-125: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make tag-mode verification deterministic.

Any resolver failure is currently reported as a network skip, and the regex does not verify newest-tag selection. Add a successful stubbed git ls-remote case (for example, REL_17_9 and REL_17_10) that must resolve to REL_17_10; retain this as an optional network smoke test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/resolve-pg-ref.test.sh` around lines 116 - 125, Make the tag-mode
checks in the test script deterministic by adding a successful stubbed git
ls-remote scenario with tags such as REL_17_9 and REL_17_10, asserting the
resolver returns REL_17_10. Keep the existing live network invocation as an
optional smoke test, but distinguish resolver failures from network
unavailability instead of always skipping them.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/resolve-pg-ref.sh`:
- Around line 58-63: Update the tag-selection pipeline assigning ref so
release-candidate tags matching REL_${major}_RC* cannot be chosen when final
numeric release tags are available. Filter out RC/prerelease tags before sort -V
and tail, while preserving the existing underscore/dot normalization and
final-release selection behavior.

---

Nitpick comments:
In `@tests/resolve-pg-ref.test.sh`:
- Around line 116-125: Make the tag-mode checks in the test script deterministic
by adding a successful stubbed git ls-remote scenario with tags such as REL_17_9
and REL_17_10, asserting the resolver returns REL_17_10. Keep the existing live
network invocation as an optional smoke test, but distinguish resolver failures
from network unavailability instead of always skipping them.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e41f2585-2541-49c6-a3fb-1617c316f911

📥 Commits

Reviewing files that changed from the base of the PR and between 4a955df and 89632c5.

📒 Files selected for processing (6)
  • .github/workflows/pg-stable-test.yml
  • tests/docker/Dockerfile-step-1.el9
  • tests/postgres-build.conf
  • tests/resolve-pg-ref.sh
  • tests/resolve-pg-ref.test.sh
  • tests/run-single-pg18-installcheck.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/pg-stable-test.yml
  • tests/run-single-pg18-installcheck.sh
  • tests/postgres-build.conf

Comment thread tests/resolve-pg-ref.sh
@mason-sharp
mason-sharp merged commit 75012fd into main Jul 24, 2026
18 checks passed
@mason-sharp
mason-sharp deleted the ci-branch-config branch July 24, 2026 14:52
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.

2 participants