mirror of
https://github.com/Azure/setup-helm.git
synced 2025-07-16 02:30:36 +00:00
Fixing PR comments
This commit is contained in:
14
lib/run.js
14
lib/run.js
@ -39,6 +39,8 @@ const core = __importStar(require("@actions/core"));
|
|||||||
const graphql_1 = require("@octokit/graphql");
|
const graphql_1 = require("@octokit/graphql");
|
||||||
const helmToolName = 'helm';
|
const helmToolName = 'helm';
|
||||||
const stableHelmVersion = 'v3.2.1';
|
const stableHelmVersion = 'v3.2.1';
|
||||||
|
const stableHelm3Version = 'v3.5.3';
|
||||||
|
const stableHelm2Version = 'v2.17.0';
|
||||||
const LATEST_HELM2_VERSION = '2.*';
|
const LATEST_HELM2_VERSION = '2.*';
|
||||||
const LATEST_HELM3_VERSION = '3.*';
|
const LATEST_HELM3_VERSION = '3.*';
|
||||||
function getExecutableExtension() {
|
function getExecutableExtension() {
|
||||||
@ -123,12 +125,16 @@ function getLatestHelmVersionFor(type) {
|
|||||||
return latestValidRelease.tagName;
|
return latestValidRelease.tagName;
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.warning(util.format("Error while fetching the latest Helm %s release. Error: %s. Using default Helm version %s.", type, err.toString(), stableHelmVersion));
|
core.warning(util.format("Error while fetching the latest Helm %s release. Error: %s. Using default Helm version %s.", type, err.toString(), getStableHelmVersionFor(type)));
|
||||||
|
return getStableHelmVersionFor(type);
|
||||||
}
|
}
|
||||||
core.warning(util.format("Could not find stable release for Helm %s. Using default Helm version %s.", type, stableHelmVersion));
|
core.warning(util.format("Could not find stable release for Helm %s. Using default Helm version %s.", type, getStableHelmVersionFor(type)));
|
||||||
return stableHelmVersion;
|
return getStableHelmVersionFor(type);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function getStableHelmVersionFor(type) {
|
||||||
|
return type === "v2" ? stableHelm2Version : stableHelm3Version;
|
||||||
|
}
|
||||||
// isValidVersion checks if verison matches the specified type and is a stable release
|
// isValidVersion checks if verison matches the specified type and is a stable release
|
||||||
function isValidVersion(version, type) {
|
function isValidVersion(version, type) {
|
||||||
if (!version.toLocaleLowerCase().startsWith(type))
|
if (!version.toLocaleLowerCase().startsWith(type))
|
||||||
@ -172,4 +178,4 @@ function run() {
|
|||||||
core.setOutput('helm-path', cachedPath);
|
core.setOutput('helm-path', cachedPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
run().catch(core.setFailed);
|
run().catch(core.setFailed);
|
||||||
|
17
src/run.ts
17
src/run.ts
@ -12,6 +12,8 @@ import { graphql } from '@octokit/graphql';
|
|||||||
|
|
||||||
const helmToolName = 'helm';
|
const helmToolName = 'helm';
|
||||||
const stableHelmVersion = 'v3.2.1';
|
const stableHelmVersion = 'v3.2.1';
|
||||||
|
const stableHelm3Version = 'v3.5.3';
|
||||||
|
const stableHelm2Version = 'v2.17.0';
|
||||||
const LATEST_HELM2_VERSION = '2.*';
|
const LATEST_HELM2_VERSION = '2.*';
|
||||||
const LATEST_HELM3_VERSION = '3.*';
|
const LATEST_HELM3_VERSION = '3.*';
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ async function downloadHelm(version: string): Promise<string> {
|
|||||||
return helmpath;
|
return helmpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getLatestHelmVersionFor(type) {
|
async function getLatestHelmVersionFor(type: string): Promise<string> {
|
||||||
const token = core.getInput('token', { 'required': true });
|
const token = core.getInput('token', { 'required': true });
|
||||||
try {
|
try {
|
||||||
const { repository } = await graphql(
|
const { repository } = await graphql(
|
||||||
@ -103,14 +105,19 @@ async function getLatestHelmVersionFor(type) {
|
|||||||
if (latestValidRelease)
|
if (latestValidRelease)
|
||||||
return latestValidRelease.tagName;
|
return latestValidRelease.tagName;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.warning(util.format("Error while fetching the latest Helm %s release. Error: %s. Using default Helm version %s.", type, err.toString(), stableHelmVersion));
|
core.warning(util.format("Error while fetching the latest Helm %s release. Error: %s. Using default Helm version %s.", type, err.toString(), getStableHelmVersionFor(type)));
|
||||||
|
return getStableHelmVersionFor(type);
|
||||||
}
|
}
|
||||||
core.warning(util.format("Could not find stable release for Helm %s. Using default Helm version %s.", type, stableHelmVersion));
|
core.warning(util.format("Could not find stable release for Helm %s. Using default Helm version %s.", type, getStableHelmVersionFor(type)));
|
||||||
return stableHelmVersion;
|
return getStableHelmVersionFor(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStableHelmVersionFor(type: string) {
|
||||||
|
return type==="v2" ? stableHelm2Version : stableHelm3Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
// isValidVersion checks if verison matches the specified type and is a stable release
|
// isValidVersion checks if verison matches the specified type and is a stable release
|
||||||
function isValidVersion(version, type): boolean {
|
function isValidVersion(version: string, type: string): boolean {
|
||||||
if (!version.toLocaleLowerCase().startsWith(type))
|
if (!version.toLocaleLowerCase().startsWith(type))
|
||||||
return false;
|
return false;
|
||||||
return version.indexOf('rc') == -1
|
return version.indexOf('rc') == -1
|
||||||
|
Reference in New Issue
Block a user