mirror of
https://github.com/Azure/setup-helm.git
synced 2026-07-24 00:52:26 +00:00
fix: preserve subpath base URLs in getHelmDownloadURL (#292)
Ensure downloadBaseURL ends with '/' before URL resolution so a subpath mirror (e.g. https://example/kubernetes/helm) is preserved instead of having its last path segment replaced. Fixes downloads for all subpath mirrors.
This commit is contained in:
committed by
GitHub
parent
017211e1b1
commit
eb399fcd4f
@@ -140,6 +140,34 @@ describe('run.ts', () => {
|
||||
expect(os.platform).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('getHelmDownloadURL() - preserve a subpath base URL without a trailing slash', () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
|
||||
const expected =
|
||||
'https://mirror.example/kubernetes/helm/helm-v3.8.0-linux-amd64.tar.gz'
|
||||
expect(
|
||||
run.getHelmDownloadURL(
|
||||
'https://mirror.example/kubernetes/helm',
|
||||
'v3.8.0'
|
||||
)
|
||||
).toBe(expected)
|
||||
})
|
||||
|
||||
test('getHelmDownloadURL() - preserve a subpath base URL with a trailing slash', () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
|
||||
const expected =
|
||||
'https://mirror.example/kubernetes/helm/helm-v3.8.0-linux-amd64.tar.gz'
|
||||
expect(
|
||||
run.getHelmDownloadURL(
|
||||
'https://mirror.example/kubernetes/helm/',
|
||||
'v3.8.0'
|
||||
)
|
||||
).toBe(expected)
|
||||
})
|
||||
|
||||
test('getLatestHelmVersion() - return the latest version of HELM', async () => {
|
||||
const res = {
|
||||
status: 200,
|
||||
|
||||
Reference in New Issue
Block a user