Skip to content

Commit f37eaf5

Browse files
committed
fix(RELEASE-2175): add 'v' prefix to GitHub download URLs
This fix ensures the advisory download URL uses the tag format (v1.7.2) while keeping the PURL version as the semantic version (1.7.2). Assisted-by: Cursor AI Signed-off-by: Scott Wickersham <swickers@redhat.com>
1 parent 7b31aa0 commit f37eaf5

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

tasks/managed/populate-release-notes/populate-release-notes.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,13 @@ spec:
690690
# Ignore manifest files
691691
[[ "$filename" == *_manifest.json ]] && continue
692692
checksum="${CHECKSUM_MAP[$filename]}"
693-
download_url="https://github.com/$owner_repo/releases/download/$GITHUB_RELEASE_VERSION/$filename"
693+
# GitHub release tags typically use 'v' prefix (e.g., v1.7.2), but the version
694+
# extracted from filenames may not include it. Ensure the download URL uses the tag format.
695+
github_tag="$GITHUB_RELEASE_VERSION"
696+
if [[ ! "$github_tag" =~ ^v ]]; then
697+
github_tag="v$GITHUB_RELEASE_VERSION"
698+
fi
699+
download_url="https://github.com/$owner_repo/releases/download/$github_tag/$filename"
694700
purl="pkg:generic/$name@$GITHUB_RELEASE_VERSION?checksum=$checksum&download_url=$download_url"
695701
jsonString=$(jq -cn \
696702
--arg component "$name" \

tasks/managed/populate-release-notes/tests/test-populate-release-notes-cves-github.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ spec:
203203
- name: taskGitRevision
204204
value: "main"
205205
- name: github_release_version
206-
value: "v1.0.0"
206+
value: "1.0.0"
207207
- name: github_release_url
208-
value: "https://github.com/some-org/some-repo/releases/tag/v1.0.0"
208+
value: "https://github.com/some-org/some-repo"
209209
- name: binaries_dir
210210
value: "$(context.pipelineRun.uid)/releases"
211211
runAfter:
@@ -263,5 +263,15 @@ spec:
263263
"$DATA_FILE")" == "CVE-123CVE-456"
264264
test "$(jq '.releaseNotes.content.artifacts[0].cves.fixed."CVE-123".packages | length' \
265265
"$DATA_FILE")" == 2
266+
267+
# Verify the PURL download_url has 'v' prefix in the tag (even though github_release_version was "1.0.0")
268+
# The download URL should be: https://github.com/some-org/some-repo/releases/download/v1.0.0/<filename>
269+
PURL=$(jq -r '.releaseNotes.content.artifacts[0].purl' "$DATA_FILE")
270+
echo "PURL: $PURL"
271+
# Check that download_url contains /download/v1.0.0/ (with the v prefix)
272+
[[ "$PURL" == *"download/v1.0.0/"* ]] || { echo "ERROR: download_url missing 'v' prefix"; exit 1; }
273+
# Check that the version in the PURL itself is still 1.0.0 (without v prefix)
274+
[[ "$PURL" == "pkg:generic/releng-test-product-binaries@1.0.0?"* ]] \
275+
|| { echo "ERROR: PURL version should be 1.0.0"; exit 1; }
266276
runAfter:
267277
- run-task

0 commit comments

Comments
 (0)