Skip to content

ci(gateway): prompt for next dev version on release#2870

Open
renuka-fernando wants to merge 1 commit into
wso2:mainfrom
renuka-fernando:ci-gateway-prompt-next-dev-version
Open

ci(gateway): prompt for next dev version on release#2870
renuka-fernando wants to merge 1 commit into
wso2:mainfrom
renuka-fernando:ci-gateway-prompt-next-dev-version

Conversation

@renuka-fernando

Copy link
Copy Markdown
Contributor

Purpose

The gateway release workflow currently bumps to the next development version automatically (minor + 1, with -SNAPSHOT) via make version-bump-next-dev. This removes control over the version chosen after a release — for example when the next cycle should be a patch, a specific minor, or carry an -rc pre-release qualifier. This PR makes the next development version an explicit, maintainer-provided input at release time.

Goals

Let the maintainer specify the exact next development version when triggering the Gateway Release workflow, instead of having it computed automatically.

Approach

  • Add a required next_dev_version input to the workflow_dispatch trigger (string, documented to include the -SNAPSHOT suffix, e.g. 1.3.0-SNAPSHOT).
  • Replace the make -C gateway version-bump-next-dev step with a step that validates the input and applies it via make -C gateway version-set VERSION=<input>.
  • Reference the chosen version in the automated version-bump PR body.

The release version itself is still derived automatically from the VERSION file (with -SNAPSHOT stripped); only the next development version is now prompted.

Related Issues

N/A

Documentation

N/A — internal release automation change with no product documentation impact.

Automation tests

  • Unit tests

    N/A — GitHub Actions workflow change; no application code affected.

  • Integration tests

    N/A — verified by inspection of the workflow; exercised on the next manual release dispatch.

Security checks

Related PRs

N/A

Checklist

  • Tests added or updated (unit, integration, etc.)
  • Samples updated (if applicable)

Replace the automatic next-dev version bump in the gateway release
workflow with a required workflow_dispatch input. The maintainer now
provides the next development version (with -SNAPSHOT suffix) when
triggering the release, which is applied via `version-set` and
referenced in the version-bump PR body.
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The gateway release workflow now requires a manually supplied next development version, validates and applies it through the gateway Make target, and includes the selected version in the automated pull request description.

Changes

Gateway release versioning

Layer / File(s) Summary
Manual version selection and release update
.github/workflows/gateway-release.yml
Adds the required next_dev_version dispatch input, validates and applies it during the release job, and records the selected value in the pull request description.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: anugayan, arshardh, ashera96

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: requiring a next dev version during gateway release.
Description check ✅ Passed The description follows the template well with Purpose, Goals, Approach, tests, security, and documentation details; only a few optional sections are missing.
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

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.

@coderabbitai coderabbitai Bot 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.

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/gateway-release.yml:
- Line 79: Update the release workflow steps containing NEXT_DEV_VERSION and the
corresponding Make argument to avoid interpolating inputs directly into shell
source: expose the workflow input through the step’s env configuration,
reference the environment variable in the script with safe quoting, and quote
the Make argument so input contents cannot alter command parsing.
- Around line 80-85: Update the NEXT_DEV_VERSION validation in the gateway
release workflow to reject values that do not end with the required “-SNAPSHOT”
suffix, while retaining the existing missing-value error handling. Only invoke
`make ... version-set` after the value passes both non-empty and suffix-format
validation.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 79154c55-3e86-4968-9d10-8325544267bf

📥 Commits

Reviewing files that changed from the base of the PR and between 3639de5 and 88a1f1d.

📒 Files selected for processing (1)
  • .github/workflows/gateway-release.yml

run: make -C gateway version-bump-next-dev
- name: Set next dev version
run: |
NEXT_DEV_VERSION="${{ inputs.next_dev_version }}"

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.

🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Do not interpolate the workflow input into shell source.

A value containing quotes or shell syntax can break out of the assignment at Line 79 and execute arbitrary commands in the release job. Pass the input through env: and quote the Make argument.

Proposed fix
       - name: Set next dev version
+        env:
+          NEXT_DEV_VERSION: ${{ inputs.next_dev_version }}
         run: |
-          NEXT_DEV_VERSION="${{ inputs.next_dev_version }}"
           if [ -z "${NEXT_DEV_VERSION}" ]; then
             echo "Error: next_dev_version input is required"
             exit 1
           fi
           echo "Setting gateway to next dev version: ${NEXT_DEV_VERSION}"
-          make -C gateway version-set VERSION=${NEXT_DEV_VERSION}
+          make -C gateway version-set "VERSION=${NEXT_DEV_VERSION}"

Also applies to: 85-85

🧰 Tools
🪛 zizmor (1.26.1)

[error] 79-79: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 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/gateway-release.yml at line 79, Update the release
workflow steps containing NEXT_DEV_VERSION and the corresponding Make argument
to avoid interpolating inputs directly into shell source: expose the workflow
input through the step’s env configuration, reference the environment variable
in the script with safe quoting, and quote the Make argument so input contents
cannot alter command parsing.

Source: Linters/SAST tools

Comment on lines +80 to +85
if [ -z "${NEXT_DEV_VERSION}" ]; then
echo "Error: next_dev_version input is required"
exit 1
fi
echo "Setting gateway to next dev version: ${NEXT_DEV_VERSION}"
make -C gateway version-set VERSION=${NEXT_DEV_VERSION}

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Validate the required -SNAPSHOT version format.

The current check accepts any non-empty value, despite the input contract requiring a development version with the -SNAPSHOT suffix. version-set propagates this value into VERSION, Compose, Helm, and build artifacts.

Proposed fix
           if [ -z "${NEXT_DEV_VERSION}" ]; then
             echo "Error: next_dev_version input is required"
             exit 1
           fi
+          if [[ ! "${NEXT_DEV_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$ ]]; then
+            echo "Error: next_dev_version must match X.Y.Z-SNAPSHOT"
+            exit 1
+          fi
📝 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
if [ -z "${NEXT_DEV_VERSION}" ]; then
echo "Error: next_dev_version input is required"
exit 1
fi
echo "Setting gateway to next dev version: ${NEXT_DEV_VERSION}"
make -C gateway version-set VERSION=${NEXT_DEV_VERSION}
if [ -z "${NEXT_DEV_VERSION}" ]; then
echo "Error: next_dev_version input is required"
exit 1
fi
if [[ ! "${NEXT_DEV_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$ ]]; then
echo "Error: next_dev_version must match X.Y.Z-SNAPSHOT"
exit 1
fi
echo "Setting gateway to next dev version: ${NEXT_DEV_VERSION}"
make -C gateway version-set VERSION=${NEXT_DEV_VERSION}
🤖 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/gateway-release.yml around lines 80 - 85, Update the
NEXT_DEV_VERSION validation in the gateway release workflow to reject values
that do not end with the required “-SNAPSHOT” suffix, while retaining the
existing missing-value error handling. Only invoke `make ... version-set` after
the value passes both non-empty and suffix-format validation.

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