Skip to content

CI: add pgvector CI workflow#14

Merged
tuhaihe merged 3 commits into
cloudberry-contrib:mainfrom
tuhaihe:pgvector-ci-2.x
Jul 3, 2026
Merged

CI: add pgvector CI workflow#14
tuhaihe merged 3 commits into
cloudberry-contrib:mainfrom
tuhaihe:pgvector-ci-2.x

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Jul 2, 2026

Copy link
Copy Markdown
Member

fix #ISSUE_Number


Change logs

Describe your change clearly, including what problem is being solved or what document is being added or updated.

Contributor's checklist

Here are some reminders before you submit your pull request:

  • Make sure that your Pull Request has a clear title and commit message. You can take the Git commit template as a reference.
  • Sign the Contributor License Agreement as prompted for your first-time contribution (One-time setup).
  • Learn the code contribution and doc contribution guides for better collaboration.
  • List your communications in the GitHub Issues or Discussions (if has or needed).
  • Feel free to ask for the cloudberrydb team to help review and approve.

Summary by CodeRabbit

  • Tests

    • Added automated, container-based SQL regression testing for pgvector using a fresh Cloudberry demo cluster.
    • Test runs now capture logs and regression diffs, provide a clear pass/fail summary, and upload test artifacts when failures occur.
  • Chores

    • Introduced a new CI workflow to build Cloudberry from source, package build outputs as artifacts, and orchestrate the isolated regression test jobs per target.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 47f262df-0933-453d-ab8c-e399b7f23ec4

📥 Commits

Reviewing files that changed from the base of the PR and between f87e889 and 7b0679f.

📒 Files selected for processing (1)
  • .github/workflows/pgvector-cloudberry-ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pgvector-cloudberry-ci.yml

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that builds Apache Cloudberry, packages build artifacts, and runs pgvector regression tests against a fresh Cloudberry demo cluster.

Changes

CI Workflow for Cloudberry + pgvector

Layer / File(s) Summary
Workflow header, triggers, and global config
.github/workflows/pgvector-cloudberry-ci.yml
Adds workflow metadata, triggers, concurrency, permissions, and shared environment variables for the Cloudberry build and test jobs.
Cloudberry build and artifact packaging
.github/workflows/pgvector-cloudberry-ci.yml
Builds Cloudberry in a container, initializes the environment, and uploads separate source and install tarball artifacts.
pgvector regression test job
.github/workflows/pgvector-cloudberry-ci.yml
Restores Cloudberry artifacts, creates a demo cluster, builds and installs pgvector, runs regression tests, collects logs, and uploads failure artifacts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant build_cloudberry
  participant test_pgvector
  participant CloudberryCluster

  GitHubActions->>build_cloudberry: checkout and build Cloudberry
  build_cloudberry->>GitHubActions: upload source and install artifacts
  GitHubActions->>test_pgvector: download Cloudberry artifacts
  test_pgvector->>CloudberryCluster: create demo cluster
  test_pgvector->>CloudberryCluster: build and install pgvector via pg_config
  test_pgvector->>CloudberryCluster: run make installcheck for regression
  test_pgvector->>GitHubActions: write PASS/FAIL summary
  test_pgvector->>GitHubActions: upload test-logs on failure
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is mostly template text and lacks actual change details, issue context, or a meaningful changelog. Replace the placeholder text with a real changelog, link the related issue if any, and explain what the workflow adds and why.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a pgvector CI workflow.
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 unit tests (beta)
  • Create PR with unit tests

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

@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 (4)
.github/workflows/pgvector-cloudberry-ci.yml (4)

59-67: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Pin the container image away from :latest.

Both jobs use apache/incubator-cloudberry:cbdb-build-rocky9-latest. An unpinned latest tag can change underneath the workflow and silently break CI builds without any change in this repo.

Please check whether apache/incubator-cloudberry publishes dated/versioned tags (or digests) suitable for pinning here.

Also applies to: 172-179

🤖 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 @.github/workflows/pgvector-cloudberry-ci.yml around lines 59 - 67, The
workflow jobs are using the mutable
apache/incubator-cloudberry:cbdb-build-rocky9-latest image, which should be
pinned to a stable version or digest. Update the container.image in both
affected jobs to a dated/versioned tag (or an explicit digest) published by
apache/incubator-cloudberry, and keep the existing job setup unchanged.

31-42: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Reconsider edited PR trigger with cancel-in-progress: false.

pull_request triggers on edited (title/body/base changes, not just new commits) while cancel-in-progress: false means each trigger queues a full (up to 180-minute) build rather than replacing an in-flight one. Repeated PR metadata edits can pile up long-running, redundant jobs.

♻️ Suggested tweak
   pull_request:
     branches: [ main ]
-    types: [ opened, synchronize, reopened, edited, ready_for_review ]
+    types: [ opened, synchronize, reopened, ready_for_review ]
   workflow_dispatch:
 
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: false
+  cancel-in-progress: true
🤖 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 @.github/workflows/pgvector-cloudberry-ci.yml around lines 31 - 42, The
workflow trigger configuration is queuing redundant long-running PR builds
because the `pull_request` event includes `edited` while
`concurrency.cancel-in-progress` is set to false. Update the trigger rules in
the workflow so metadata-only edits do not start a fresh full run, or change the
concurrency behavior so a new run replaces the in-flight one; keep the fix
centered on the existing `pull_request` and `concurrency` settings in the
workflow file.

59-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Substantial duplication between build_cloudberry and test_pgvector jobs.

The container definition, "Free Disk Space" step, and "Cloudberry Environment Initialization" step are duplicated verbatim across both jobs. Consider extracting these into a composite action (or a reusable workflow) to avoid drift when one copy is updated but not the other.

Also applies to: 69-89, 99-116, 172-179, 187-207, 234-251

🤖 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 @.github/workflows/pgvector-cloudberry-ci.yml around lines 59 - 67, The
`build_cloudberry` and `test_pgvector` jobs duplicate the same container setup,
Free Disk Space step, and Cloudberry Environment Initialization step, which
risks drift. Extract the shared setup into a reusable composite action or
reusable workflow, then have both jobs call that shared logic instead of keeping
separate copies. Use the existing job sections and the duplicated step names as
the main locations to refactor.

300-326: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Unreachable code after case statement.

Both regression) and the default *) branch call exit directly, so test_status=${PIPESTATUS[0]}, set -e, popd, and the trailing exit ${test_status} (lines 322-326) can never execute. popd never runs either, though it's harmless since the process exits first. Harmless today but confusing if another test target is added later without noticing exits bypass the fallthrough path.

♻️ Suggested cleanup
-            set +e
             case "${TEST_TARGET}" in
               regression)
                 echo "=== Running pgvector regression tests (make installcheck) ==="
                 # pg_regress connects to the running demo cluster via PG* env vars.
+                set +e
                 make PG_CONFIG=$(which pg_config) installcheck 2>&1 | tee "${TEST_LOG_ROOT}/pgvector-installcheck.log"
                 rc=${PIPESTATUS[0]}
+                set -e
                 # Preserve regression diffs / results for debugging.
                 cp -a regression.diffs "${TEST_LOG_ROOT}/regression.diffs" 2>/dev/null || true
                 cp -a regression.out "${TEST_LOG_ROOT}/regression.out" 2>/dev/null || true
                 cp -a results "${TEST_LOG_ROOT}/results" 2>/dev/null || true
                 if [ "${rc}" -ne 0 ]; then
                   echo "=== regression.diffs ==="
                   cat regression.diffs 2>/dev/null || true
                 fi
                 exit ${rc}
                 ;;
               *)
                 echo "unknown test target: ${TEST_TARGET}"
                 exit 2
                 ;;
             esac
-            test_status=${PIPESTATUS[0]}
-            set -e
           popd
-
-          exit ${test_status}
           SCRIPT
🤖 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 @.github/workflows/pgvector-cloudberry-ci.yml around lines 300 - 326, The
`case` block in the workflow step exits from every branch, so the `test_status`
assignment, `set -e`, `popd`, and trailing `exit` are unreachable and should be
removed or restructured. Update the shell logic around the `case
"${TEST_TARGET}"` handling so `regression)` and `*)` do not bypass the shared
cleanup path, and keep the flow centered on the existing `test_status`/`popd`
section if you need post-case cleanup.
🤖 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/pgvector-cloudberry-ci.yml:
- Around line 90-97: The checkout steps for Cloudberry and pgvector are leaving
persisted Git credentials in .git/config, which can be packaged into the tarred
workspace and uploaded artifact. Update both actions/checkout usages in the
workflow to set persist-credentials: false so the token is not written into the
checked-out repositories. Use the existing checkout steps that reference
env.CLOUDBERRY_REPO, env.CLOUDBERRY_REF, and the pgvector checkout block to
apply the fix consistently.
- Around line 335-338: The coordinator log collection block is unreachable
because MASTER_DATA_DIRECTORY is only set inside the child gpadmin shell, not in
this outer workflow step. Update the log collection logic in the workflow so it
runs in the same shell/session that sources gpdemo-env.sh or otherwise captures
MASTER_DATA_DIRECTORY from that context, and keep the copy step tied to the
existing Cloudberry log collection block so gpdb-log is actually populated on
failures.

---

Nitpick comments:
In @.github/workflows/pgvector-cloudberry-ci.yml:
- Around line 59-67: The workflow jobs are using the mutable
apache/incubator-cloudberry:cbdb-build-rocky9-latest image, which should be
pinned to a stable version or digest. Update the container.image in both
affected jobs to a dated/versioned tag (or an explicit digest) published by
apache/incubator-cloudberry, and keep the existing job setup unchanged.
- Around line 31-42: The workflow trigger configuration is queuing redundant
long-running PR builds because the `pull_request` event includes `edited` while
`concurrency.cancel-in-progress` is set to false. Update the trigger rules in
the workflow so metadata-only edits do not start a fresh full run, or change the
concurrency behavior so a new run replaces the in-flight one; keep the fix
centered on the existing `pull_request` and `concurrency` settings in the
workflow file.
- Around line 59-67: The `build_cloudberry` and `test_pgvector` jobs duplicate
the same container setup, Free Disk Space step, and Cloudberry Environment
Initialization step, which risks drift. Extract the shared setup into a reusable
composite action or reusable workflow, then have both jobs call that shared
logic instead of keeping separate copies. Use the existing job sections and the
duplicated step names as the main locations to refactor.
- Around line 300-326: The `case` block in the workflow step exits from every
branch, so the `test_status` assignment, `set -e`, `popd`, and trailing `exit`
are unreachable and should be removed or restructured. Update the shell logic
around the `case "${TEST_TARGET}"` handling so `regression)` and `*)` do not
bypass the shared cleanup path, and keep the flow centered on the existing
`test_status`/`popd` section if you need post-case cleanup.
🪄 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: 68e2a379-75b1-4b24-aac1-e334c2e1482e

📥 Commits

Reviewing files that changed from the base of the PR and between 7ca8c09 and f87e889.

📒 Files selected for processing (1)
  • .github/workflows/pgvector-cloudberry-ci.yml

Comment thread .github/workflows/pgvector-cloudberry-ci.yml
Comment thread .github/workflows/pgvector-cloudberry-ci.yml Outdated
@tuhaihe tuhaihe merged commit ba8a9b3 into cloudberry-contrib:main Jul 3, 2026
4 checks passed
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