-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into users/vithati/k8sm
- Loading branch information
Showing
52 changed files
with
668 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
"version": { | ||
"Major": 2, | ||
"Minor": 154, | ||
"Patch": 10 | ||
"Patch": 11 | ||
}, | ||
"demands": [ | ||
"azureps" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
"version": { | ||
"Major": 2, | ||
"Minor": 154, | ||
"Patch": 10 | ||
"Patch": 11 | ||
}, | ||
"demands": [ | ||
"azureps" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
"version": { | ||
"Major": 3, | ||
"Minor": 154, | ||
"Patch": 10 | ||
"Patch": 11 | ||
}, | ||
"preview": true, | ||
"demands": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
"version": { | ||
"Major": 3, | ||
"Minor": 154, | ||
"Patch": 10 | ||
"Patch": 11 | ||
}, | ||
"preview": true, | ||
"demands": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"version": { | ||
"Major": 3, | ||
"Minor": 1, | ||
"Patch": 0 | ||
"Patch": 1 | ||
}, | ||
"preview": "true", | ||
"demands": [], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"version": { | ||
"Major": 3, | ||
"Minor": 1, | ||
"Patch": 0 | ||
"Patch": 1 | ||
}, | ||
"preview": "true", | ||
"demands": [], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
"use strict"; | ||
|
||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import * as util from 'util'; | ||
import * as tl from "azure-pipelines-task-lib/task"; | ||
import * as toolLib from 'azure-pipelines-tool-lib/tool'; | ||
import * as path from "path"; | ||
|
||
const funcToolName = 'func'; | ||
const stableFuncToolsVersion = '2.7.1585'; | ||
|
||
function getExecutableExtension(): string { | ||
if (os.type().match(/^Win/)) { | ||
return '.exe'; | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
function getDownloadUrl(version: string) { | ||
let downloadUrlFormat = 'https://github.com/Azure/azure-functions-core-tools/releases/download/%s/Azure.Functions.Cli.%s.%s.zip'; | ||
switch (os.type()) { | ||
case 'Linux': | ||
return util.format(downloadUrlFormat, version, 'linux-x64', version); | ||
|
||
case 'Darwin': | ||
return util.format(downloadUrlFormat, version, 'osx-x64', version); | ||
|
||
case 'Windows_NT': | ||
default: | ||
return util.format(downloadUrlFormat, version, 'win-x86', version); | ||
|
||
} | ||
} | ||
|
||
export async function getLatestFuncToolsVersion(): Promise<string> { | ||
const funcToolsLatestReleaseUrl = 'https://api.github.com/repos/Azure/azure-functions-core-tools/releases/latest'; | ||
let latestVersion = stableFuncToolsVersion; | ||
|
||
try { | ||
const downloadPath = await toolLib.downloadTool(funcToolsLatestReleaseUrl); | ||
const response = JSON.parse(fs.readFileSync(downloadPath, 'utf8').toString().trim()); | ||
if (response.tag_name) { | ||
latestVersion = response.tag_name; | ||
} | ||
} catch (error) { | ||
tl.warning(tl.loc('ErrorFetchingLatestVersion', funcToolsLatestReleaseUrl, error, stableFuncToolsVersion)); | ||
} | ||
|
||
return latestVersion; | ||
} | ||
|
||
export async function downloadFuncTools(version: string): Promise<string> { | ||
let cachedToolpath = toolLib.findLocalTool(funcToolName, version); | ||
|
||
if (!cachedToolpath) { | ||
const downloadUrl = getDownloadUrl(version); | ||
let downloadPath; | ||
try { | ||
downloadPath = await toolLib.downloadTool(downloadUrl); | ||
} | ||
catch (ex) { | ||
throw new Error(tl.loc('FuncDownloadFailed', downloadUrl, ex)); | ||
} | ||
|
||
tl.debug('Extracting the downloaded func tool zip..'); | ||
const unzippedFuncPath = await toolLib.extractZip(downloadPath); | ||
cachedToolpath = await toolLib.cacheDir(unzippedFuncPath, funcToolName, version); | ||
console.log(tl.loc("SuccessfullyDownloaded", version, cachedToolpath)); | ||
} else { | ||
console.log(tl.loc("VersionAlreadyInstalled", version, cachedToolpath)); | ||
} | ||
|
||
const funcPath = path.join(cachedToolpath, funcToolName + getExecutableExtension()); | ||
fs.chmodSync(funcPath, '777'); | ||
return funcPath; | ||
} |
Oops, something went wrong.