Replace cdn.dl.k8s.io with dl.k8s.io (#227) (#228)
Some checks failed
Run prettify / Prettier Check (push) Has been cancelled
Run unit tests. / build (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Integration test for setup-kubectl / Validate release and master branch (push) Has been cancelled

The cdn.dl.k8s.io domain is no longer available. Switch all download URLs back to dl.k8s.io.
This commit is contained in:
David Gamero 2026-02-18 15:32:20 -05:00 committed by GitHub
parent 8fd7ec08ee
commit ef7e8f900a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -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://cdn.dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl` return `https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl`
case 'Darwin': case 'Darwin':
return `https://cdn.dl.k8s.io/release/${version}/bin/darwin/${arch}/kubectl` return `https://dl.k8s.io/release/${version}/bin/darwin/${arch}/kubectl`
case 'Windows_NT': case 'Windows_NT':
default: default:
return `https://cdn.dl.k8s.io/release/${version}/bin/windows/${arch}/kubectl.exe` return `https://dl.k8s.io/release/${version}/bin/windows/${arch}/kubectl.exe`
} }
} }
@ -30,7 +30,7 @@ export async function getLatestPatchVersion(
minor: string minor: string
): Promise<string> { ): Promise<string> {
const version = `${major}.${minor}` const version = `${major}.${minor}`
const sourceURL = `https://cdn.dl.k8s.io/release/stable-${version}.txt` const sourceURL = `https://dl.k8s.io/release/stable-${version}.txt`
try { try {
const downloadPath = await toolCache.downloadTool(sourceURL) const downloadPath = await toolCache.downloadTool(sourceURL)
const latestPatch = fs const latestPatch = fs

View file

@ -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://cdn.dl.k8s.io/release/v1.15.0/bin/linux/%s/kubectl', 'https://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://cdn.dl.k8s.io/release/v1.15.0/bin/darwin/%s/kubectl', 'https://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://cdn.dl.k8s.io/release/v1.15.0/bin/windows/%s/kubectl.exe', 'https://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)
@ -176,7 +176,7 @@ describe('Testing all functions in run file.', () => {
expect(result).toBe('v1.27.15') expect(result).toBe('v1.27.15')
expect(toolCache.downloadTool).toHaveBeenCalledWith( expect(toolCache.downloadTool).toHaveBeenCalledWith(
'https://cdn.dl.k8s.io/release/stable-1.27.txt' 'https://dl.k8s.io/release/stable-1.27.txt'
) )
}) })
@ -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://cdn.dl.k8s.io/release/stable.txt' 'https://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')

View file

@ -12,7 +12,7 @@ import {
const kubectlToolName = 'kubectl' const kubectlToolName = 'kubectl'
const stableKubectlVersion = 'v1.15.0' const stableKubectlVersion = 'v1.15.0'
const stableVersionUrl = 'https://cdn.dl.k8s.io/release/stable.txt' const stableVersionUrl = 'https://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})