Skip to content

CI: add kafka_fdw CI workflow - #8

Open
tuhaihe wants to merge 13 commits into
cloudberry-contrib:mainfrom
tuhaihe:kfk_ci
Open

tuhaihe wants to merge 13 commits into
cloudberry-contrib:mainfrom
tuhaihe:kfk_ci

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added a new CI workflow that builds Apache Cloudberry, packages build artifacts, and runs kafka_fdw integration/regression tests on a demo cluster.
  • Bug Fixes
    • Improved Kafka download reliability with mirror fallback and safer handling to prevent corrupted partial archives.
    • Hardened Kafka/ZooKeeper startup by detaching daemons, logging to dedicated files, and waiting for broker readiness before tests.
  • Chores
    • Removed the older CI configuration and replaced it with the new workflow setup.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds a new Cloudberry-backed GitHub Actions workflow for kafka_fdw regression testing and updates the Kafka test script to use mirror fallback downloads, detached daemon startup, and broker readiness checks.

Changes

Kafka FDW CI Pipeline

Layer / File(s) Summary
Workflow triggers and global config
.github/workflows/cloudberry-kafka-fdw-ci.yml
Defines the workflow name, triggers, concurrency cancellation, permissions, and shared Cloudberry/kafka_fdw environment variables.
Cloudberry build and artifact packaging
.github/workflows/cloudberry-kafka-fdw-ci.yml
Builds Cloudberry in a container, packages the source tree and installation, and uploads both as artifacts.
Test job setup and cluster initialization
.github/workflows/cloudberry-kafka-fdw-ci.yml
Restores Cloudberry artifacts, initializes the environment, installs dependencies, creates the demo cluster, and prepares the test job.
Kafka regression test execution and reporting
.github/workflows/cloudberry-kafka-fdw-ci.yml, test/run_kafka.sh
Runs kafka_fdw regression tests, updates Kafka and ZooKeeper startup behavior, waits for broker readiness, records results, and uploads failure logs.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a new kafka_fdw 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 (2)
.github/workflows/cloudberry-kafka-fdw-ci.yml (2)

45-51: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

edited trigger fires on non-code PR edits.

Including edited in pull_request.types (Line 50) re-runs this expensive CI pipeline (up to 180+120 minutes) whenever the PR title/body/labels change, with no code diff involved.

♻️ Proposed fix
   pull_request:
     branches: [ main, master ]
-    types: [ opened, synchronize, reopened, edited, ready_for_review ]
+    types: [ opened, synchronize, reopened, ready_for_review ]
🤖 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/cloudberry-kafka-fdw-ci.yml around lines 45 - 51, The
pull_request trigger in the cloudberry-kafka-fdw CI workflow is too broad
because it includes the edited event, which reruns the pipeline for non-code PR
metadata changes. Update the workflow trigger definition to remove edited from
the pull_request.types list while keeping the code-relevant events such as
opened, synchronize, reopened, and ready_for_review.

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

Unpinned :latest container tag hurts reproducibility.

Both jobs use apache/incubator-cloudberry:cbdb-build-rocky9-latest. If the tag is updated upstream between the build and test job runs (or between re-runs), the toolchain used to build Cloudberry can silently drift, causing flaky/irreproducible CI results.

Also applies to: 188-188

🤖 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/cloudberry-kafka-fdw-ci.yml at line 75, The workflow jobs
use an unpinned Cloudberry container tag, which can drift and make CI
non-reproducible. Update the image reference in the affected job definitions in
cloudberry-kafka-fdw-ci so it points to a pinned, immutable
Apache/incubator-cloudberry tag or digest instead of cbdb-build-rocky9-latest,
and apply the same change to the matching job that also uses this image.
🤖 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/cloudberry-kafka-fdw-ci.yml:
- Around line 105-112: Set the Cloudberry checkout in the workflow to avoid
persisting GitHub credentials, since the checked-out `${CLOUDBERRY_DIR}` is
later archived and uploaded as an artifact. Update the `actions/checkout@v4`
step for “Checkout Cloudberry Source” to disable credential persistence, and
verify the tarball/artifact creation steps that package `cloudberry-source` do
not include `.git/config` with token data. Use the `Checkout Cloudberry Source`
job step and the `cloudberry-source` archive/upload flow to locate the fix.
- Around line 218-222: The kafka_fdw checkout in the workflow still leaves the
GitHub token persisted in .git/config, so update the actions/checkout step under
“Checkout kafka_fdw” to disable credential persistence. Keep the existing
checkout settings in place, and add persist-credentials: false to the
actions/checkout@v4 configuration so later steps cannot reuse the token.

---

Nitpick comments:
In @.github/workflows/cloudberry-kafka-fdw-ci.yml:
- Around line 45-51: The pull_request trigger in the cloudberry-kafka-fdw CI
workflow is too broad because it includes the edited event, which reruns the
pipeline for non-code PR metadata changes. Update the workflow trigger
definition to remove edited from the pull_request.types list while keeping the
code-relevant events such as opened, synchronize, reopened, and
ready_for_review.
- Line 75: The workflow jobs use an unpinned Cloudberry container tag, which can
drift and make CI non-reproducible. Update the image reference in the affected
job definitions in cloudberry-kafka-fdw-ci so it points to a pinned, immutable
Apache/incubator-cloudberry tag or digest instead of cbdb-build-rocky9-latest,
and apply the same change to the matching job that also uses this image.
🪄 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: 40c02321-f2d8-4a2e-ae29-033ec203d97a

📥 Commits

Reviewing files that changed from the base of the PR and between 2653510 and e875f95.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/cloudberry-kafka-fdw-ci.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/ci.yml

Comment on lines +105 to +112
- name: Checkout Cloudberry Source
uses: actions/checkout@v4
with:
repository: ${{ env.CLOUDBERRY_REPO }}
ref: ${{ env.CLOUDBERRY_REF }}
fetch-depth: 1
submodules: true
path: ${{ env.CLOUDBERRY_DIR }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Cloudberry source artifact can leak the job's GITHUB_TOKEN.

actions/checkout at Line 105-112 doesn't set persist-credentials: false, so the injected token remains in .git/config inside ${CLOUDBERRY_DIR}. That whole directory is then tarred (Line 159) and uploaded as the cloudberry-source artifact (Line 174-180), packaging the credential into a downloadable artifact.

🔒 Proposed fix
       - name: Checkout Cloudberry Source
         uses: actions/checkout@v4
         with:
           repository: ${{ env.CLOUDBERRY_REPO }}
           ref: ${{ env.CLOUDBERRY_REF }}
           fetch-depth: 1
           submodules: true
           path: ${{ env.CLOUDBERRY_DIR }}
+          persist-credentials: false

As per static analysis hints, zizmor flagged "credential persistence through GitHub Actions artifacts (artipacked)" at this checkout step.

Also applies to: 154-180

🧰 Tools
🪛 zizmor (1.26.1)

[warning] 105-112: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 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/cloudberry-kafka-fdw-ci.yml around lines 105 - 112, Set
the Cloudberry checkout in the workflow to avoid persisting GitHub credentials,
since the checked-out `${CLOUDBERRY_DIR}` is later archived and uploaded as an
artifact. Update the `actions/checkout@v4` step for “Checkout Cloudberry Source”
to disable credential persistence, and verify the tarball/artifact creation
steps that package `cloudberry-source` do not include `.git/config` with token
data. Use the `Checkout Cloudberry Source` job step and the `cloudberry-source`
archive/upload flow to locate the fix.

Source: Linters/SAST tools

Comment on lines +218 to +222
- name: Checkout kafka_fdw
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ env.KAFKA_FDW_DIR }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Same missing persist-credentials: false on the kafka_fdw checkout.

Not packaged into an artifact in this cohort, but the token still persists in .git/config for the remainder of the job, reachable by any later step/script.

🔒 Proposed fix
       - name: Checkout kafka_fdw
         uses: actions/checkout@v4
         with:
           fetch-depth: 0
           path: ${{ env.KAFKA_FDW_DIR }}
+          persist-credentials: false

As per static analysis hints, zizmor flagged this checkout with the same artipacked warning.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout kafka_fdw
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ env.KAFKA_FDW_DIR }}
- name: Checkout kafka_fdw
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ env.KAFKA_FDW_DIR }}
persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 218-222: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 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/cloudberry-kafka-fdw-ci.yml around lines 218 - 222, The
kafka_fdw checkout in the workflow still leaves the GitHub token persisted in
.git/config, so update the actions/checkout step under “Checkout kafka_fdw” to
disable credential persistence. Keep the existing checkout settings in place,
and add persist-credentials: false to the actions/checkout@v4 configuration so
later steps cannot reuse the token.

Source: Linters/SAST tools

@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

🤖 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 `@test/run_kafka.sh`:
- Around line 20-27: The Kafka download fallback in run_kafka.sh can leave a
partial KAFKA_ARCHIVE from the first wget, causing the retry to save a second
copy while the corrupted file still remains. Update the download logic around
the wget calls so the target archive path is always overwritten or cleaned up
before retrying, and ensure the later tar extraction uses a valid complete
archive from the KAFKA_ARCHIVE variable.
🪄 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: b59a2e77-a323-4949-a148-57350781de18

📥 Commits

Reviewing files that changed from the base of the PR and between e875f95 and cdce739.

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

Comment thread test/run_kafka.sh Resolved

@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

🤖 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/cloudberry-kafka-fdw-ci.yml:
- Around line 326-349: In the CI workflow step that runs `make installcheck` for
planner and ORCA, capture each run’s exit status instead of letting `set -euo
pipefail` abort after the first failure. Update the shell block around the
planner and ORCA `make installcheck` calls so both runs always execute, and
store their statuses for the final summary/exit decision. Also preserve separate
diff artifacts for each mode by copying or renaming `regression.diffs`/related
outputs after each run before the next one overwrites 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: f36da68a-13b7-443a-b0f8-185a0469e8f0

📥 Commits

Reviewing files that changed from the base of the PR and between 2e356ac and 1a4c653.

📒 Files selected for processing (2)
  • .github/workflows/cloudberry-kafka-fdw-ci.yml
  • test/run_kafka.sh

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.

1 participant