mirror of
https://github.com/Azure/setup-kubectl.git
synced 2026-02-07 16:27:26 +00:00
Merge 5a62f6e947 into a0bf2818e7
This commit is contained in:
commit
b2f2fdaa69
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 {
|
||||
switch (os.type()) {
|
||||
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':
|
||||
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':
|
||||
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) => {
|
||||
jest.spyOn(os, 'type').mockReturnValue('Linux')
|
||||
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
|
||||
)
|
||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl)
|
||||
|
|
@ -55,7 +55,7 @@ describe('Testing all functions in run file.', () => {
|
|||
(arch) => {
|
||||
jest.spyOn(os, 'type').mockReturnValue('Darwin')
|
||||
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
|
||||
)
|
||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl)
|
||||
|
|
@ -67,7 +67,7 @@ describe('Testing all functions in run file.', () => {
|
|||
(arch) => {
|
||||
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
|
||||
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
|
||||
)
|
||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl)
|
||||
|
|
@ -251,7 +251,7 @@ describe('Testing all functions in run file.', () => {
|
|||
jest.spyOn(core, 'setOutput').mockImplementation()
|
||||
expect(await run.run()).toBeUndefined()
|
||||
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.addPath).toHaveBeenCalledWith('pathToCachedTool')
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
|
||||
const kubectlToolName = 'kubectl'
|
||||
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() {
|
||||
let version = core.getInput('version', {required: true})
|
||||
|
|
|
|||
Loading…
Reference in a new issue