Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed stable helm version download error #10746

Merged
merged 6 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Tasks/Common/kubernetes-common-v2/helmutility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ export async function downloadHelm(version?: string): Promise<string> {
const unzipedHelmPath = await toolLib.extractZip(helmDownloadPath);
cachedToolpath = await toolLib.cacheDir(unzipedHelmPath, helmToolName, version);
}

const helmpath = findHelm(cachedToolpath);
if (!helmpath) {
throw new Error(tl.loc('HelmNotFoundInFolder', cachedToolpath));
}

fs.chmodSync(helmpath, '777');
return helmpath;
}
Expand Down Expand Up @@ -69,7 +68,12 @@ export async function getStableHelmVersion(): Promise<string> {
try {
const downloadPath = await toolLib.downloadTool('https://api.github.com/repos/helm/helm/releases/latest');
const response = JSON.parse(fs.readFileSync(downloadPath, 'utf8').toString().trim());
return response.body.tag_name;
if (!response.tag_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

response.body.tag_name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not in body anymore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have helmutility.ts at 2 places? Cannot we use only one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because of kubernetes-common and kubernetes-common-v2.
v2 was created to roll out the upgrade of vsts-task-lib to azure-pipelines-task-lib

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan is to deprecate kubernetes-common once all the dependent tasks start consuming azure-pipelines-task-lib

{
return stableHelmVersion;
}

return response.tag_name;
} catch (error) {
tl.warning(tl.loc('HelmLatestNotKnown', helmLatestReleaseUrl, error, stableHelmVersion));
}
Expand Down
7 changes: 6 additions & 1 deletion Tasks/Common/kubernetes-common/helmutility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ export async function getStableHelmVersion(): Promise<string> {
try {
const downloadPath = await toolLib.downloadTool('https://api.github.com/repos/helm/helm/releases/latest');
const response = JSON.parse(fs.readFileSync(downloadPath, 'utf8').toString().trim());
return response.body.tag_name;
if (!response.tag_name)
{
return stableHelmVersion;
}

return response.tag_name;
} catch (error) {
tl.warning(tl.loc('HelmLatestNotKnown', helmLatestReleaseUrl, error, stableHelmVersion));
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/HelmDeployV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 154,
"Patch": 2
"Patch": 3
},
"demands": [],
"groups": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/HelmDeployV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 154,
"Patch": 2
"Patch": 3
},
"demands": [],
"groups": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"loc.friendlyName": "Helm tool installer",
"loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=851275)",
"loc.helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?linkid=851275)",
"loc.description": "Install Helm and Kubernetes on an agent machine",
"loc.instanceNameFormat": "Install Helm $(helmVersion)",
"loc.group.displayName.prerequisite": "Prerequisite",
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmInstallerV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 153,
"Patch": 1
"Minor": 155,
"Patch": 0
},
"demands": [],
"satisfies": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmInstallerV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 153,
"Patch": 1
"Minor": 155,
"Patch": 0
},
"demands": [],
"satisfies": [
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmInstallerV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 154,
"Patch": 1
"Minor": 155,
"Patch": 0
},
"preview": true,
"demands": [],
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmInstallerV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 154,
"Patch": 1
"Minor": 155,
"Patch": 0
},
"preview": true,
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubectlInstallerV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 154,
"Patch": 1
"Patch": 2
},
"demands": [],
"satisfies": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubectlInstallerV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 154,
"Patch": 1
"Patch": 2
},
"demands": [],
"satisfies": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubernetesManifestV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 155,
"Patch": 1
"Patch": 2
},
"demands": [],
"groups": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubernetesManifestV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 155,
"Patch": 1
"Patch": 2
},
"demands": [],
"groups": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubernetesV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 154,
"Patch": 3
"Patch": 4
},
"demands": [],
"preview": "false",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubernetesV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 0,
"Minor": 154,
"Patch": 3
"Patch": 4
},
"demands": [],
"preview": "false",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubernetesV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 1,
"Minor": 155,
"Patch": 0
"Patch": 1
},
"demands": [],
"releaseNotes": "What's new in Version 1.0:<br/>&nbsp;Added new service connection type input for easy selection of Azure AKS cluster.<br/>&nbsp;Replaced output variable input with output variables section that we had added in all tasks.",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/KubernetesV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 1,
"Minor": 155,
"Patch": 0
"Patch": 1
},
"demands": [],
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down