How to use the azure-pipelines-tool-lib/tool.evaluateVersions function in azure-pipelines-tool-lib

To help you get started, we’ve selected a few azure-pipelines-tool-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / azure-devops-extension-tasks / BuildTasks / TfxInstaller / TfxInstaller.ts View on Github external
function queryLatestMatch(versionSpec: string): string {
    const npmRunner = new tr.ToolRunner("npm");
    npmRunner.arg(["show", "tfx-cli", "versions", "--json"]);
    const result = npmRunner.execSync({ failOnStdErr: false, silent: true, ignoreReturnCode: false} as tr.IExecOptions);
    if (result.code === 0)
    {
        let versions: string[] = JSON.parse(result.stdout.trim());
        let version: string = toolLib.evaluateVersions(versions, versionSpec);
        return version;
    }
    return "";
}