Skip to content

packaging: add packages index generator and release CI#12150

Open
lecaros wants to merge 1 commit into
masterfrom
lecaros-packages-index
Open

packaging: add packages index generator and release CI#12150
lecaros wants to merge 1 commit into
masterfrom
lecaros-packages-index

Conversation

@lecaros

@lecaros lecaros commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Add a generator for packages.fluentbit.io that produces index.html, versions.json, and latest-version.txt from a local mirror or S3 listing.

Wire the generator into the staging release workflow so the release bucket is updated after Linux, Windows, and macOS package syncs. Add a PR workflow that runs the offline regression test with jq and tree.


Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • New Features
    • Added a generated packages catalog (HTML index, versions metadata, latest-version indicator) for publishing.
    • Added scripts to generate an S3-backed preview of the catalog and to build the catalog JSON.
    • Added a staging release job to publish catalog files to the release bucket with cache headers.
    • Added a PR workflow to test the packages catalog index generator.
  • Bug Fixes
    • Strengthened validation, deduplication, and cross-platform artifact mapping during catalog generation.
  • Tests
    • Added integration tests covering local generation, S3 listing, error handling, and preview output.
  • Chores
    • Updated test gitignore rules for preview/ and fixture/ directories.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ba70d50-903e-47ca-8981-8df71fe99f56

📥 Commits

Reviewing files that changed from the base of the PR and between 94d7084 and 3e30b80.

📒 Files selected for processing (7)
  • .github/workflows/pr-packages-index.yaml
  • .github/workflows/staging-release.yaml
  • packaging/build-catalog.awk
  • packaging/generate-packages-index.sh
  • packaging/testing/.gitignore
  • packaging/testing/generate-preview-from-s3.sh
  • packaging/testing/test-packages-index.sh
🚧 Files skipped from review as they are similar to previous changes (6)
  • packaging/testing/.gitignore
  • .github/workflows/staging-release.yaml
  • packaging/testing/generate-preview-from-s3.sh
  • packaging/testing/test-packages-index.sh
  • packaging/generate-packages-index.sh
  • packaging/build-catalog.awk

📝 Walkthrough

Walkthrough

Adds a package catalog generator that parses local or S3 artifacts into JSON and HTML indexes, tests both discovery modes, provides preview support, and integrates validation and staging publication into GitHub Actions.

Changes

Packages catalog pipeline

Layer / File(s) Summary
Artifact parsing and catalog schema
packaging/build-catalog.awk
Parses versioned schema, Windows, macOS, RPM, and DEB artifacts into structured catalog records with URLs and Linux repository metadata.
Local and S3 catalog generation
packaging/generate-packages-index.sh
Collects and deduplicates local or S3 objects, selects the latest version, and generates versions.json, latest-version.txt, and index.html.
Generator fixtures and validation
packaging/testing/*
Adds local and S3 listing fixtures, assertions, preview generation, cleanup, and validation of generated catalog contents.
CI and staging publication
.github/workflows/pr-packages-index.yaml, .github/workflows/staging-release.yaml
Adds pull request testing and staging publication of the generated catalog files to S3.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Listing as Local or S3 listing
  participant Generator as Package index generator
  participant Parser as Catalog parser
  participant Storage as Catalog storage
  Listing->>Generator: Provide artifact paths
  Generator->>Parser: Parse unified object list
  Parser-->>Generator: Return version catalog rows
  Generator->>Storage: Write catalog files
Loading

Suggested labels: ci

Suggested reviewers: niedbalski

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main additions: a packages index generator and related release CI workflow updates.
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 lecaros-packages-index

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 665a78d50a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


function is_downloadable_linux(name) {
return name ~ /^fluent-bit-[0-9]+(\.[0-9]+)+-[0-9]+\.(x86_64|aarch64|arm64)\.rpm$/ \
|| name ~ /^fluent-bit_[0-9]+(\.[0-9]+)+_(amd64|arm64|aarch64)\.deb$/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include armhf Debian packages in the catalog

For Raspbian releases, the published target is raspbian/bookworm and the package build names DEBs from dpkg --print-architecture, which is armhf for the arm32v7 Raspbian image. This regex only accepts amd64, arm64, and aarch64, so every Raspbian package is ignored and the generated versions.json/linux_repos omits a supported Linux repository even after the release workflow publishes it.

Useful? React with 👍 / 👎.

Comment on lines +231 to +234
if (name == "fluent-bit-" v ".pkg") {
macos_pkg[v] = path
} else if (name == "fluent-bit-" v ".dmg") {
macos_dmg[v] = path

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support the actual macOS package names

When the release bucket contains the packages produced by the existing macOS workflow, they are named with architecture suffixes such as fluent-bit-<version>-apple.pkg and fluent-bit-<version>-intel.pkg, but these comparisons only accept fluent-bit-<version>.pkg or .dmg. As a result the generator records the version but leaves artifacts.macos.pkg and artifacts.macos.dmg as null, so the new package index cannot expose macOS downloads.

Useful? React with 👍 / 👎.

@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: 5

🧹 Nitpick comments (3)
.github/workflows/staging-release.yaml (1)

374-375: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Disable persisted checkout credentials.

This job only needs a checkout to run the generator. Prevent the read token from remaining in Git configuration for subsequent steps.

Proposed fix
     - name: Checkout code
       uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
+      with:
+        persist-credentials: false
🤖 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/staging-release.yaml around lines 374 - 375, Update the
actions/checkout step in the staging release workflow to disable persisted
credentials by setting its persist-credentials option to false, leaving the
pinned action version and other checkout behavior unchanged.

Source: Linters/SAST tools

packaging/build-catalog.awk (1)

107-124: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

idx is an implicit global in note_linux.

idx is assigned inside the function but isn't declared as a local (function parameter list only has key, label after the real params). It becomes a global variable — harmless today since nothing else uses idx, but a latent AWK footgun if the script grows.

-function note_linux(v, path, name, repo,    key, label) {
+function note_linux(v, path, name, repo,    key, label, idx) {
🤖 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 `@packaging/build-catalog.awk` around lines 107 - 124, Declare idx as a local
variable in the note_linux function’s local-parameter list alongside key and
label, keeping its existing assignment and use unchanged.
packaging/generate-packages-index.sh (1)

211-212: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Hardcoded +7d footer stripping is coupled to tree's exact HTML output format.

sed -e '/<hr>/,+7d' assumes the report/copyright footer after <hr> is always exactly 7 lines. This depends on the installed tree version's HTML template (CI installs it unpinned via apt-get install -y jq tree); a different tree version could leave stray footer text in the public index.html, or delete the closing </body></html> tags if the footer is shorter.

♻️ Proposed fix: delete to end-of-file and re-append closing tags
 tree --noreport --charset utf-8 --fromfile "$TREE_LIST" -H "$BASE_URL" | \
-    sed -e '/<hr>/,+7d' > "$WORK_DIR/tree.html"
+    sed -e '/<hr>/,$d' > "$WORK_DIR/tree.html"
+printf '</body>\n</html>\n' >> "$WORK_DIR/tree.html"

Please confirm what tree version the CI runner installs and whether its HTML footer format matches this assumption.

🤖 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 `@packaging/generate-packages-index.sh` around lines 211 - 212, Replace the
fixed `sed -e '/<hr>/,+7d'` footer removal in the tree HTML generation pipeline
with logic that removes everything from `<hr>` through end-of-file, then
re-appends the required closing `</body></html>` tags. Do not rely on the
installed `tree` version or a fixed footer line count, and preserve the
generated document’s valid closing structure.
🤖 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/pr-packages-index.yaml:
- Around line 8-13: Update the path filter in the pr-packages-index workflow to
include packaging/testing/generate-preview-from-s3.sh, and add a job step that
validates this script offline using an AWS_S3_LISTING_FILE fixture, or at
minimum performs a syntax check. Keep the existing package-index validation flow
unchanged.

In `@packaging/build-catalog.awk`:
- Around line 18-38: Update extract_version so the version parser stops at the
macOS extension separator while still accepting dots within numeric version
components. Ensure filenames such as fluent-bit-VERSION.pkg and
fluent-bit-VERSION.dmg produce VERSION without a trailing dot, while preserving
existing parsing for Linux and Windows artifact names.

In `@packaging/generate-packages-index.sh`:
- Around line 233-237: Validate LATEST_VERSION against SORTED_VERSIONS before
assigning LATEST in the override branch. If it is not an exact match for a
discovered version, fail with a clear error instead of generating catalog
outputs that reference a nonexistent version; preserve the existing fallback to
the final sorted version when no override is provided.

In `@packaging/testing/test-packages-index.sh`:
- Around line 92-96: Remove the LATEST_VERSION override from both generator
invocations in the test script, while preserving the existing 4.2.7 assertions
so the tests exercise automatic highest-version selection. Keep any explicit
override coverage separate from these default-selection runs.
- Around line 90-150: The S3 test currently checks only partial output and lacks
invalid-input coverage. Extend the S3 assertions to compare `.latest`,
`.base_url`, and `.versions` against the local result while excluding
`generated_at`, then add expected-failure cases covering an empty `BASE_PATH`
and a nonexistent `AWS_S3_LISTING_FILE`, using the existing test helpers and
preserving clear failure validation.

---

Nitpick comments:
In @.github/workflows/staging-release.yaml:
- Around line 374-375: Update the actions/checkout step in the staging release
workflow to disable persisted credentials by setting its persist-credentials
option to false, leaving the pinned action version and other checkout behavior
unchanged.

In `@packaging/build-catalog.awk`:
- Around line 107-124: Declare idx as a local variable in the note_linux
function’s local-parameter list alongside key and label, keeping its existing
assignment and use unchanged.

In `@packaging/generate-packages-index.sh`:
- Around line 211-212: Replace the fixed `sed -e '/<hr>/,+7d'` footer removal in
the tree HTML generation pipeline with logic that removes everything from `<hr>`
through end-of-file, then re-appends the required closing `</body></html>` tags.
Do not rely on the installed `tree` version or a fixed footer line count, and
preserve the generated document’s valid closing structure.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7bda1093-e44e-4261-aa4c-6a4c3a117df9

📥 Commits

Reviewing files that changed from the base of the PR and between cb7256c and 665a78d.

📒 Files selected for processing (7)
  • .github/workflows/pr-packages-index.yaml
  • .github/workflows/staging-release.yaml
  • packaging/build-catalog.awk
  • packaging/generate-packages-index.sh
  • packaging/testing/.gitignore
  • packaging/testing/generate-preview-from-s3.sh
  • packaging/testing/test-packages-index.sh

Comment thread .github/workflows/pr-packages-index.yaml
Comment thread packaging/build-catalog.awk Outdated
Comment thread packaging/generate-packages-index.sh
Comment thread packaging/testing/test-packages-index.sh
Comment thread packaging/testing/test-packages-index.sh

@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/pr-packages-index.yaml:
- Around line 63-65: Strengthen the preview validation steps in the workflow by
checking the contents of latest-version.txt and versions.json, not just their
existence. Assert that both fixtures identify 4.2.7 as the latest release, while
retaining the existing index.html existence check.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d8d3513e-b2d4-4aab-81a7-f980854d36e6

📥 Commits

Reviewing files that changed from the base of the PR and between 665a78d and 3523a63.

📒 Files selected for processing (6)
  • .github/workflows/pr-packages-index.yaml
  • .github/workflows/staging-release.yaml
  • packaging/build-catalog.awk
  • packaging/generate-packages-index.sh
  • packaging/testing/generate-preview-from-s3.sh
  • packaging/testing/test-packages-index.sh
🚧 Files skipped from review as they are similar to previous changes (4)
  • packaging/testing/generate-preview-from-s3.sh
  • .github/workflows/staging-release.yaml
  • packaging/generate-packages-index.sh
  • packaging/build-catalog.awk

Comment thread .github/workflows/pr-packages-index.yaml Outdated
@edsiper

edsiper commented Jul 24, 2026

Copy link
Copy Markdown
Member

note: before merging this once is ready, pls cleanup the commit history (cc: @lecaros)

@cosmo0920 cosmo0920 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The committed workflows' idea looks fine but there's lots of occurrences of fixed version numbers. Do we need to determine dynamically with reading CMakeLists.txt's definition or other part of this project?

Comment thread .github/workflows/pr-packages-index.yaml Outdated
Comment thread packaging/testing/test-packages-index.sh
Comment thread packaging/testing/test-packages-index.sh
Add a generator for packages.fluentbit.io that produces index.html,
versions.json, and latest-version.txt from a local mirror or S3 listing.

Wire the generator into the staging release workflow so the release
bucket is updated after Linux, Windows, and macOS package syncs. Add a
PR workflow that runs the offline regression test with jq and tree.

Signed-off-by: lecaros <lecaros@chronosphere.io>
@lecaros
lecaros force-pushed the lecaros-packages-index branch from a56ed2b to 3e30b80 Compare July 24, 2026 12:48
@lecaros

lecaros commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

thanks @cosmo0920 for the review. I've also cleaned up the commit history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants