mirror of
https://github.com/Azure/setup-helm.git
synced 2025-11-07 21:16:57 +00:00
fixed method to access helm releses JSON
This commit is contained in:
parent
45f20ed080
commit
f89e61b2b4
2 changed files with 10 additions and 10 deletions
10
lib/run.js
10
lib/run.js
|
|
@ -90,12 +90,12 @@ function getLatestHelmVersion() {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let helmJSONPath = yield toolCache.downloadTool(helmAllReleasesUrl);
|
||||
try {
|
||||
const helmJSONArray = JSON.parse(fs.readFileSync(helmJSONPath, 'utf-8'));
|
||||
helmJSONArray.forEach(ver => {
|
||||
if (isValidVersion(ver["tag_name"])) {
|
||||
return ver;
|
||||
const helmJSON = JSON.parse(fs.readFileSync(helmJSONPath, 'utf-8'));
|
||||
for (let i in helmJSON) {
|
||||
if (isValidVersion(helmJSON[i].tag_name)) {
|
||||
return helmJSON[i].tag_name;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
core.warning(util.format("Error while fetching the latest Helm release. Error: %s. Using default Helm version %s", err.toString(), stableHelmVersion));
|
||||
|
|
|
|||
10
src/run.ts
10
src/run.ts
|
|
@ -85,12 +85,12 @@ export async function getLatestHelmVersion(): Promise<string> {
|
|||
let helmJSONPath:string = await toolCache.downloadTool(helmAllReleasesUrl);
|
||||
|
||||
try{
|
||||
const helmJSONArray = JSON.parse(fs.readFileSync(helmJSONPath, 'utf-8'))
|
||||
helmJSONArray.forEach(ver => {
|
||||
if(isValidVersion(ver["tag_name"])){
|
||||
return ver;
|
||||
const helmJSON = JSON.parse(fs.readFileSync(helmJSONPath, 'utf-8'))
|
||||
for(let i in helmJSON){
|
||||
if(isValidVersion(helmJSON[i].tag_name)){
|
||||
return helmJSON[i].tag_name;
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch(err){
|
||||
core.warning(util.format("Error while fetching the latest Helm release. Error: %s. Using default Helm version %s", err.toString(), stableHelmVersion));
|
||||
return stableHelmVersion;
|
||||
|
|
|
|||
Loading…
Reference in a new issue