Skip to content

Commit b723b17

Browse files
authored
Merge pull request #3838 from saschagrunert/release-notes-index-fix-2
Re-add production bucket fix to release notes index
2 parents e1105e7 + 98c41c9 commit b723b17

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

pkg/release/publish.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,10 @@ func (p *Publisher) PublishToGcs(
402402
return nil
403403
}
404404

405-
// TODO: remove this function once https://cdn.dl.k8s.io/release/release-notes-index.json
406-
// is fixed.
407405
func FixPublicReleaseNotesURL(gcsPath string) string {
408-
const prefix = "https://storage.googleapis.com/"
409-
for strings.HasPrefix(gcsPath, prefix) {
410-
gcsPath = strings.TrimPrefix(gcsPath, prefix)
406+
const prefix = "gs://" + ProductionBucket
407+
if strings.HasPrefix(gcsPath, prefix) {
408+
gcsPath = ProductionBucketURL + strings.TrimPrefix(gcsPath, prefix)
411409
}
412410
return gcsPath
413411
}

pkg/release/publish_test.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,9 @@ func TestFixPublicReleaseNotesURL(t *testing.T) {
383383
input: "https://dl.k8s.io/release/v1.32.0-beta.0/release-notes.json",
384384
expected: "https://dl.k8s.io/release/v1.32.0-beta.0/release-notes.json",
385385
},
386-
"should fix wrong URL with 1 prefix": {
387-
input: "https://storage.googleapis.com/https://dl.k8s.io/release/v1.32.0-alpha.3/release-notes.json",
388-
expected: "https://dl.k8s.io/release/v1.32.0-alpha.3/release-notes.json",
389-
},
390-
"should fix wrong URL with multiple prefixes": {
391-
input: "https://storage.googleapis.com/https://storage.googleapis.com/https://dl.k8s.io/release/v1.28.1/release-notes.json",
392-
expected: "https://dl.k8s.io/release/v1.28.1/release-notes.json",
386+
"should fix URL referring to production bucket": {
387+
input: "gs://767373bbdcb8270361b96548387bf2a9ad0d48758c35/release/v1.29.11/release-notes.json",
388+
expected: "https://dl.k8s.io/release/v1.29.11/release-notes.json",
393389
},
394390
} {
395391
t.Run(name, func(t *testing.T) {

0 commit comments

Comments
 (0)