mirror of
https://github.com/Azure/setup-helm.git
synced 2025-11-07 21:16:57 +00:00
add logs
This commit is contained in:
parent
42a468462c
commit
30ffb39edf
1 changed files with 9 additions and 11 deletions
20
src/run.ts
20
src/run.ts
|
|
@ -18,14 +18,15 @@ export async function run() {
|
||||||
let version = core.getInput('version', {required: true})
|
let version = core.getInput('version', {required: true})
|
||||||
|
|
||||||
if (version !== 'latest' && version[0] !== 'v') {
|
if (version !== 'latest' && version[0] !== 'v') {
|
||||||
|
core.info('Getting latest Helm version')
|
||||||
version = getValidVersion(version)
|
version = getValidVersion(version)
|
||||||
}
|
}
|
||||||
if (version.toLocaleLowerCase() === 'latest') {
|
if (version.toLocaleLowerCase() === 'latest') {
|
||||||
version = await getLatestHelmVersion()
|
version = await getLatestHelmVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(util.format('Downloading %s', version))
|
core.info(`Downloading ${version}`)
|
||||||
let cachedPath = await downloadHelm(version)
|
const cachedPath = await downloadHelm(version)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!process.env['PATH'].startsWith(path.dirname(cachedPath))) {
|
if (!process.env['PATH'].startsWith(path.dirname(cachedPath))) {
|
||||||
|
|
@ -35,13 +36,11 @@ export async function run() {
|
||||||
//do nothing, set as output variable
|
//do nothing, set as output variable
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
core.info(`Helm tool version '${version}' has been cached at ${cachedPath}`)
|
||||||
`Helm tool version: '${version}' has been cached at ${cachedPath}`
|
|
||||||
)
|
|
||||||
core.setOutput('helm-path', cachedPath)
|
core.setOutput('helm-path', cachedPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns version with proper v before it
|
// Prefixes version with v
|
||||||
export function getValidVersion(version: string): string {
|
export function getValidVersion(version: string): string {
|
||||||
return 'v' + version
|
return 'v' + version
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +73,7 @@ export async function getLatestHelmVersion(): Promise<string> {
|
||||||
return stableHelmVersion
|
return stableHelmVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(
|
core.warning(
|
||||||
`Could not find valid release. Using default version ${stableHelmVersion}`
|
`Could not find valid release. Using default version ${stableHelmVersion}`
|
||||||
)
|
)
|
||||||
return stableHelmVersion
|
return stableHelmVersion
|
||||||
|
|
@ -142,10 +141,9 @@ export async function downloadHelm(version: string): Promise<string> {
|
||||||
)
|
)
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
util.format(
|
`Failed to download Helm from location ${getHelmDownloadURL(
|
||||||
'Failed to download Helm from location',
|
version
|
||||||
getHelmDownloadURL(version)
|
)}`
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue