mirror of
https://github.com/Azure/setup-kubectl.git
synced 2026-02-12 18:49:22 +00:00
Remove download redirects, use cdn.dl.k8s.io domain (#219)
dl.k8s.io redirects to cdn.dl.k8s.io which somehow results in constants download errors on a self-hosted runner in the UAE region. Other regions were not affected. Updating the domains fixed the issue
This commit is contained in:
parent
a0bf2818e7
commit
f366ff3801
3 changed files with 8 additions and 8 deletions
|
|
@ -14,14 +14,14 @@ export function getKubectlArch(): string {
|
||||||
export function getkubectlDownloadURL(version: string, arch: string): string {
|
export function getkubectlDownloadURL(version: string, arch: string): string {
|
||||||
switch (os.type()) {
|
switch (os.type()) {
|
||||||
case 'Linux':
|
case 'Linux':
|
||||||
return `https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl`
|
return `https://cdn.dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl`
|
||||||
|
|
||||||
case 'Darwin':
|
case 'Darwin':
|
||||||
return `https://dl.k8s.io/release/${version}/bin/darwin/${arch}/kubectl`
|
return `https://cdn.dl.k8s.io/release/${version}/bin/darwin/${arch}/kubectl`
|
||||||
|
|
||||||
case 'Windows_NT':
|
case 'Windows_NT':
|
||||||
default:
|
default:
|
||||||
return `https://dl.k8s.io/release/${version}/bin/windows/${arch}/kubectl.exe`
|
return `https://cdn.dl.k8s.io/release/${version}/bin/windows/${arch}/kubectl.exe`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ describe('Testing all functions in run file.', () => {
|
||||||
(arch) => {
|
(arch) => {
|
||||||
jest.spyOn(os, 'type').mockReturnValue('Linux')
|
jest.spyOn(os, 'type').mockReturnValue('Linux')
|
||||||
const kubectlLinuxUrl = util.format(
|
const kubectlLinuxUrl = util.format(
|
||||||
'https://dl.k8s.io/release/v1.15.0/bin/linux/%s/kubectl',
|
'https://cdn.dl.k8s.io/release/v1.15.0/bin/linux/%s/kubectl',
|
||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl)
|
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl)
|
||||||
|
|
@ -55,7 +55,7 @@ describe('Testing all functions in run file.', () => {
|
||||||
(arch) => {
|
(arch) => {
|
||||||
jest.spyOn(os, 'type').mockReturnValue('Darwin')
|
jest.spyOn(os, 'type').mockReturnValue('Darwin')
|
||||||
const kubectlDarwinUrl = util.format(
|
const kubectlDarwinUrl = util.format(
|
||||||
'https://dl.k8s.io/release/v1.15.0/bin/darwin/%s/kubectl',
|
'https://cdn.dl.k8s.io/release/v1.15.0/bin/darwin/%s/kubectl',
|
||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl)
|
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl)
|
||||||
|
|
@ -67,7 +67,7 @@ describe('Testing all functions in run file.', () => {
|
||||||
(arch) => {
|
(arch) => {
|
||||||
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
|
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
|
||||||
const kubectlWindowsUrl = util.format(
|
const kubectlWindowsUrl = util.format(
|
||||||
'https://dl.k8s.io/release/v1.15.0/bin/windows/%s/kubectl.exe',
|
'https://cdn.dl.k8s.io/release/v1.15.0/bin/windows/%s/kubectl.exe',
|
||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl)
|
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl)
|
||||||
|
|
@ -251,7 +251,7 @@ describe('Testing all functions in run file.', () => {
|
||||||
jest.spyOn(core, 'setOutput').mockImplementation()
|
jest.spyOn(core, 'setOutput').mockImplementation()
|
||||||
expect(await run.run()).toBeUndefined()
|
expect(await run.run()).toBeUndefined()
|
||||||
expect(toolCache.downloadTool).toHaveBeenCalledWith(
|
expect(toolCache.downloadTool).toHaveBeenCalledWith(
|
||||||
'https://dl.k8s.io/release/stable.txt'
|
'https://cdn.dl.k8s.io/release/stable.txt'
|
||||||
)
|
)
|
||||||
expect(core.getInput).toHaveBeenCalledWith('version', {required: true})
|
expect(core.getInput).toHaveBeenCalledWith('version', {required: true})
|
||||||
expect(core.addPath).toHaveBeenCalledWith('pathToCachedTool')
|
expect(core.addPath).toHaveBeenCalledWith('pathToCachedTool')
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
|
|
||||||
const kubectlToolName = 'kubectl'
|
const kubectlToolName = 'kubectl'
|
||||||
const stableKubectlVersion = 'v1.15.0'
|
const stableKubectlVersion = 'v1.15.0'
|
||||||
const stableVersionUrl = 'https://dl.k8s.io/release/stable.txt'
|
const stableVersionUrl = 'https://cdn.dl.k8s.io/release/stable.txt'
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
let version = core.getInput('version', {required: true})
|
let version = core.getInput('version', {required: true})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue