mirror of
https://github.com/Azure/setup-kubectl.git
synced 2026-05-23 05:55:52 +00:00
feat: add downloadBaseURL input to support custom download mirrors
This commit is contained in:
parent
9095542ace
commit
96bb93543b
4 changed files with 72 additions and 8 deletions
10
src/run.ts
10
src/run.ts
|
|
@ -21,7 +21,8 @@ export async function run() {
|
|||
} else {
|
||||
version = await resolveKubectlVersion(version)
|
||||
}
|
||||
const cachedPath = await downloadKubectl(version)
|
||||
const downloadBaseURL = core.getInput('downloadBaseURL', {required: false})
|
||||
const cachedPath = await downloadKubectl(version, downloadBaseURL)
|
||||
|
||||
core.addPath(path.dirname(cachedPath))
|
||||
|
||||
|
|
@ -48,14 +49,17 @@ export async function getStableKubectlVersion(): Promise<string> {
|
|||
)
|
||||
}
|
||||
|
||||
export async function downloadKubectl(version: string): Promise<string> {
|
||||
export async function downloadKubectl(
|
||||
version: string,
|
||||
downloadBaseURL: string = 'https://dl.k8s.io'
|
||||
): Promise<string> {
|
||||
let cachedToolpath = toolCache.find(kubectlToolName, version)
|
||||
let kubectlDownloadPath = ''
|
||||
const arch = getKubectlArch()
|
||||
if (!cachedToolpath) {
|
||||
try {
|
||||
kubectlDownloadPath = await toolCache.downloadTool(
|
||||
getkubectlDownloadURL(version, arch)
|
||||
getkubectlDownloadURL(version, arch, downloadBaseURL)
|
||||
)
|
||||
} catch (exception) {
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue