-
Notifications
You must be signed in to change notification settings - Fork 1
feat(ci): tie chart releases to app releases #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 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 ""
doneRepository: 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"
fiRepository: 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 1Repository: 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: 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| { | ||||||||||||||||
| echo "app_version=$APP_VERSION" | ||||||||||||||||
| echo "chart_name=$CHART_NAME" | ||||||||||||||||
|
|
@@ -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 | ||||||||||||||||
|
|
@@ -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 }} | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
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:
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.