Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ko-build-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
chart_version: ${{ steps.prepare.outputs.chart_version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Prepare versions and chart name
id: prepare
run: |
set -euo pipefail
APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
CHART_NAME="$(yq '.name' charts/*/Chart.yaml)"
CHART_VERSION="$(yq '.version' charts/*/Chart.yaml)"
CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
Comment on lines 37 to +39
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The same version extraction logic is duplicated for both APP_VERSION and CHART_VERSION. Consider extracting this to a single variable to follow the DRY principle and reduce maintenance burden. For example:

VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
APP_VERSION=$VERSION
CHART_VERSION=$VERSION

This makes it clear that both versions should always be identical and reduces the chance of inconsistencies if the extraction logic needs to be modified in the future.

Copilot uses AI. Check for mistakes.
Comment on lines 37 to +39
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Test sed behavior with various tag formats
echo "Testing sed 's/v//g' vs sed 's/^v//'"
echo "======================================="
for tag in "v1.2.3" "v1.2.3-dev" "v2.0.0-rc1" "v1.0-v2"; do
  result_global=$(echo "$tag" | sed 's/v//g')
  result_prefix=$(echo "$tag" | sed 's/^v//')
  echo "Tag: $tag"
  echo "  sed 's/v//g':  $result_global"
  echo "  sed 's/^v//':  $result_prefix"
  echo ""
done

Repository: linuxfoundation/lfx-v2-mailing-list-service

Length of output: 424


🏁 Script executed:

# Check if the workflow file exists and examine lines 37-39
if [ -f ".github/workflows/ko-build-tag.yaml" ]; then
  echo "File found. Checking lines 37-39:"
  sed -n '37,39p' ".github/workflows/ko-build-tag.yaml"
  echo ""
  echo "Extended context (lines 30-45):"
  sed -n '30,45p' ".github/workflows/ko-build-tag.yaml"
else
  echo "File not found"
fi

Repository: linuxfoundation/lfx-v2-mailing-list-service

Length of output: 943


🏁 Script executed:

# Search for all uses of sed 's/v//g' or similar patterns in the workflow
echo "Searching for sed patterns in the workflow file:"
rg "sed.*'s/.*v" ".github/workflows/ko-build-tag.yaml" -A 1 -B 1

Repository: linuxfoundation/lfx-v2-mailing-list-service

Length of output: 370


Strip only the leading "v" from version tags to avoid corruption of prerelease versions.

The current sed 's/v//g' removes all v characters globally. This corrupts prerelease tags: v1.2.3-dev becomes 1.2.3-de and v1.0-v2 becomes 1.0-2. Use sed 's/^v//' instead to strip only the leading v prefix.

Both APP_VERSION (line 37) and CHART_VERSION (line 39) have this issue:

Suggested fix
-          APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
+          APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
           CHART_NAME="$(yq '.name' charts/*/Chart.yaml)"
-          CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
+          CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
📝 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
APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
CHART_NAME="$(yq '.name' charts/*/Chart.yaml)"
CHART_VERSION="$(yq '.version' charts/*/Chart.yaml)"
CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
CHART_NAME="$(yq '.name' charts/*/Chart.yaml)"
CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
🤖 Prompt for AI Agents
In @.github/workflows/ko-build-tag.yaml around lines 37 - 39, The APP_VERSION
and CHART_VERSION assignments use sed 's/v//g' which removes all "v" characters
and corrupts prerelease tags; update the sed expression for both APP_VERSION and
CHART_VERSION to only strip a leading "v" (replace the global removal with a
pattern that removes ^v) so tags like v1.2.3-dev and v1.0-v2 keep their internal
"v" characters intact.

{
echo "app_version=$APP_VERSION"
echo "chart_name=$CHART_NAME"
Expand Down Expand Up @@ -82,11 +82,11 @@ jobs:
image_name: ${{ steps.publish-ghcr.outputs.image_name }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Publish Chart to GHCR
id: publish-ghcr
uses: linuxfoundation/lfx-public-workflows/.github/actions/helm-chart-oci-publisher@c465d6571fa0b8be9d551d902955164ea04a00af # main
uses: linuxfoundation/lfx-public-workflows/.github/actions/helm-chart-oci-publisher@17e4144d7ba68f7c3e8c16eece5aed15fd7c2dc8 # main
with:
name: ${{ needs.publish.outputs.chart_name }}
repository: ${{ github.repository }}/chart
Expand All @@ -97,12 +97,12 @@ jobs:
registry_password: ${{ secrets.GITHUB_TOKEN }}

- name: Install Cosign
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
with:
cosign-release: "${{ env.COSIGN_VERSION }}"

- name: Login to GitHub
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
4 changes: 3 additions & 1 deletion charts/lfx-v2-mailing-list-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ apiVersion: v2
name: lfx-v2-mailing-list-service
description: LFX Platform V2 Mailing List Service chart
type: application
version: 0.1.9
# This version should not be incremented, as it is dynamically replaced with the release version during the chart build
# job.
version: 0.0.1
appVersion: "latest"