Skip to content

feat: build apisix-runtime against an arbitrary apisix-nginx-module ref - #482

Open
AlinsRan wants to merge 4 commits into
masterfrom
feat/runtime-pin-module-ref
Open

feat: build apisix-runtime against an arbitrary apisix-nginx-module ref#482
AlinsRan wants to merge 4 commits into
masterfrom
feat/runtime-pin-module-ref

Conversation

@AlinsRan

@AlinsRan AlinsRan commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

build-apisix-runtime.sh already honours an apisix_nginx_module_ver override, but neither the Makefile nor the runtime Dockerfiles passed it through, so the only way to build against an unreleased module branch was to edit the pinned default.

  • thread apisix_nginx_module_ver through build_runtime and both runtime Dockerfiles; empty keeps the default pinned in build-apisix-runtime.sh
  • add build-apisix-runtime-deb-dispatch.yml: a workflow_dispatch job that builds the deb for a given module ref, smoke checks it with dpkg -i + openresty -V, and uploads it as an artifact

Needed to perf test api7/apisix-nginx-module#124 without tagging a runtime release first.

Summary by CodeRabbit

  • New Features

    • Added a manually triggered workflow to build, validate, and download the APISIX Runtime Debian package.
    • Added configurable APISIX Nginx module version selection for runtime image builds.
    • Added Docker-based smoke testing to verify generated Debian packages.
  • Improvements

    • Build artifacts are retained for 14 days, enabling convenient testing and distribution.

`build-apisix-runtime.sh` already honours an `apisix_nginx_module_ver`
override, but neither the Makefile nor the runtime Dockerfiles passed it
through, so the only way to build against an unreleased module branch was to
edit the pinned default.

Thread the value through `build_runtime` and both runtime Dockerfiles (empty
keeps the pinned default), and add a workflow_dispatch job that builds the deb
for a given module ref and uploads it as an artifact.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 21 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 07c9b3f1-958d-45e3-bcc2-783e96484be4

📥 Commits

Reviewing files that changed from the base of the PR and between c792cd7 and f82b212.

📒 Files selected for processing (2)
  • .github/workflows/package-apisix-runtime-deb-ubuntu20.04.yml
  • build-apisix-runtime.sh
📝 Walkthrough

Walkthrough

The PR adds a manually dispatched workflow for building and publishing apisix-runtime Debian packages. It also adds optional apisix-nginx-module version propagation to standard and BuildKit runtime image builds.

Changes

Runtime build configuration

Layer / File(s) Summary
Manual Debian package dispatch
.github/workflows/build-apisix-runtime-deb-dispatch.yml
The workflow accepts configurable inputs, validates them, builds the Debian package, runs a Docker smoke test, and uploads the resulting .deb artifact.
Nginx module version propagation
Makefile, dockerfiles/Dockerfile.apisix-runtime.deb, dockerfiles/Dockerfile.apisix-runtime.rpm
The Makefile passes apisix_nginx_module_ver to standard and BuildKit builds. Both Dockerfiles expose APISIX_NGINX_MODULE_VER to the build environment while preserving the script default when unset.

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

Sequence Diagram(s)

sequenceDiagram
  participant Maintainer
  participant GitHubActions
  participant Makefile
  participant Docker
  participant ArtifactStorage
  Maintainer->>GitHubActions: dispatch workflow with build inputs
  GitHubActions->>GitHubActions: validate inputs and install dependencies
  GitHubActions->>Docker: build apisix-runtime Debian package
  Makefile->>Docker: pass APISIX_NGINX_MODULE_VER for runtime builds
  Docker-->>GitHubActions: return package and smoke-test result
  GitHubActions->>ArtifactStorage: upload .deb artifact
Loading

Possibly related PRs


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Security Check ❌ Error Unvalidated Docker image inputs allow arbitrary image injection in workflow. IMAGE_BASE and IMAGE_TAG inputs lack validation, enabling execution of untrusted containers in the smoke test step (line... Add validation in the "Validate inputs" step: if [[ ! "$IMAGE_BASE" =~ ^[a-z0-9._/-]+$ ]] || [[ ! "$IMAGE_TAG" =~ ^[a-z0-9._-]+$ ]]; then exit 1; fi
✅ 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 clearly and concisely describes support for building apisix-runtime against an arbitrary apisix-nginx-module reference.
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.
E2e Test Quality Review ✅ Passed This PR does not include test code. The custom check reviews E2E test quality, which requires test files. This check is not applicable to infrastructure-only PRs without tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/runtime-pin-module-ref

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

…image

Adds a workflow_dispatch trigger to the existing runtime deb job with inputs
for the runtime version, the apisix-nginx-module ref and the base image, all
defaulting to what the scheduled/PR runs already used. The deb filename is now
discovered from the output directory instead of being spelled out, since it
carries the base image codename.

A separate dispatch-only workflow would not have been usable: GitHub only
resolves workflow_dispatch for workflows that exist on the default branch.

@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/build-apisix-runtime-deb-dispatch.yml:
- Line 76: Update the workflow step using actions/upload-artifact to reference
the intended v4 release by its complete commit SHA instead of the mutable `@v4`
tag, preserving the existing artifact upload configuration.
🪄 Autofix

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

Run ID: 7d590c6f-2b99-4cf4-adab-5f7d3af05905

📥 Commits

Reviewing files that changed from the base of the PR and between 95406eb and c792cd7.

📒 Files selected for processing (4)
  • .github/workflows/build-apisix-runtime-deb-dispatch.yml
  • Makefile
  • dockerfiles/Dockerfile.apisix-runtime.deb
  • dockerfiles/Dockerfile.apisix-runtime.rpm

"

- name: Publish artifact
uses: actions/upload-artifact@v4

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
file=".github/workflows/build-apisix-runtime-deb-dispatch.yml"
sed -n '1,115p' "$file"
printf '\n-- upload-artifact references --\n'
rg -n -C 2 'actions/upload-artifact@' .github/workflows
printf '\n-- current v4 tag target --\n'
git ls-remote https://github.com/actions/upload-artifact.git \
  'refs/tags/v4' 'refs/tags/v4^{}' || true

Repository: api7/apisix-build-tools

Length of output: 260


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '-- workflow files --'
git ls-files '.github/workflows/*' | sed -n '1,160p'
printf '%s\n' '-- matching workflow names and action references --'
rg -n -i -C 2 'build-apisix-runtime-deb-dispatch|actions/upload-artifact@|upload-artifact' .github 2>/dev/null || true
printf '%s\n' '-- repository status --'
git status --short

Repository: api7/apisix-build-tools

Length of output: 5653


🏁 Script executed:

#!/bin/bash
set -u
printf '%s\n' '-- repository revision --'
git rev-parse HEAD
git remote -v
printf '%s\n' '-- candidate path in Git objects --'
git cat-file -e HEAD:.github/workflows/build-apisix-runtime-deb-dispatch.yml 2>&1 || true
printf '%s\n' '-- action tag refs --'
git ls-remote https://github.com/actions/upload-artifact.git \
  'refs/tags/v4' 'refs/tags/v4^{}' 2>&1 || true

Repository: api7/apisix-build-tools

Length of output: 570


Security Misconfiguration (CWE-829): Inclusion of Functionality from Untrusted Control Sphere

Reachability: External

Pin actions/upload-artifact to a full commit SHA.

@v4 follows a mutable tag. Pin the intended release to prevent upstream tag changes from altering code executed with the workflow token and workspace access.

🤖 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/build-apisix-runtime-deb-dispatch.yml at line 76, Update
the workflow step using actions/upload-artifact to reference the intended v4
release by its complete commit SHA instead of the mutable `@v4` tag, preserving
the existing artifact upload configuration.

The validation already accepted a ref containing slashes, but the checkout
directory was named after the ref verbatim, so a branch ref such as
`feat/foo` produced a nested `apisix-nginx-module-feat/foo` and every path
relative to it broke:

    cd apisix-nginx-module-feat/var-index-access/patch
    ./patch.sh: pushd: ../../openresty-1.29.2.4/bundle/nginx-1.29.2: No such file

Replace the slashes when building the directory name and keep the ref itself
for the clone.
Lets two builds that differ only by the module ref be told apart by the
package name instead of by which run produced them.
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