How to use the azure-pipelines-tool-lib/tool.prependPath 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-pipelines-tasks / Tasks / DotNetCoreInstallerV1 / dotnetcoreinstaller.ts View on Github external
console.log(tl.loc("ToolToInstall", packageType, versionSpec));
    var versionSpecParts = new VersionParts(versionSpec);

    let versionFetcher = new DotNetCoreVersionFetcher();
    let versionInfo: VersionInfo = await versionFetcher.getVersionInfo(versionSpecParts.versionSpec, packageType, includePreviewVersions);
    if (!versionInfo) {
        throw tl.loc("MatchingVersionNotFound", versionSpecParts.versionSpec);
    }

    let dotNetCoreInstaller = new VersionInstaller(packageType, installationPath);
    if (!dotNetCoreInstaller.isVersionInstalled(versionInfo.getVersion())) {
        await dotNetCoreInstaller.downloadAndInstall(versionInfo, versionFetcher.getDownloadUrl(versionInfo));
    }

    toolLib.prependPath(installationPath);

    // By default disable Multi Level Lookup unless user wants it enabled.
    let  performMultiLevelLookup = tl.getBoolInput("performMultiLevelLookup", false);
    tl.setVariable("DOTNET_MULTILEVEL_LOOKUP", !performMultiLevelLookup ? "0" : "1");

    // Add dot net tools path to "PATH" environment variables, so that tools can be used directly.
    addDotNetCoreToolPath();

    // Set DOTNET_ROOT for dotnet core Apphost to find runtime since it is installed to a non well-known location.
    tl.setVariable('DOTNET_ROOT', installationPath);
}
github microsoft / azure-pipelines-tasks / Tasks / UseGoV1 / installer.ts View on Github external
let toolPath: string;
    toolPath = toolLib.findLocalTool('go', normalizeVersion(version));

    if (!toolPath) {
        // download, extract, cache
        toolPath = await acquireGo(version);
        tl.debug("Go tool is cached under " + toolPath);
    }

    setGoEnvironmentVariables(toolPath);

    toolPath = path.join(toolPath, 'bin');
    //
    // prepend the tools path. instructs the agent to prepend for future tasks
    //
    toolLib.prependPath(toolPath);
}
github microsoft / azure-pipelines-tasks / Tasks / DockerInstallerV0 / src / dockertoolinstaller.ts View on Github external
async function configureDocker() {
    var version = tl.getInput("dockerVersion", true);
    var releaseType = tl.getInput("releaseType", true);

    var dockerPath = await utils.downloadDocker(version, releaseType);

    // prepend the tools path. instructs the agent to prepend for future tasks
    if (!process.env['PATH'].startsWith(path.dirname(dockerPath))) {
        toolLib.prependPath(path.dirname(dockerPath));
    }
}
github microsoft / azure-pipelines-tasks / Tasks / ContainerBuildV0 / src / buildctl.ts View on Github external
async function configureBuildctl() {

    tl.debug("configuring buildctl");
    var stableBuildKitVersion = await utils.getStableBuildctlVersion();
    var buildctlPath = await utils.downloadBuildctl(stableBuildKitVersion);

    // prepend the tools path. instructs the agent to prepend for future tasks
    if (!process.env['PATH'].startsWith(path.dirname(buildctlPath))) {
        toolLib.prependPath(path.dirname(buildctlPath));
    }
}
github microsoft / azure-pipelines-tasks / Tasks / FuncToolsInstallerV0 / src / functoolsinstaller.ts View on Github external
async function downloadFuncTools() {
    const version = await utils.getFuncToolsVersion();
    const funcToolsPath = await utils.downloadFuncTools(version);

    // prepend the tools path. instructs the agent to prepend for future tasks
    if (!process.env['PATH'].startsWith(path.dirname(funcToolsPath))) {
        toolLib.prependPath(path.dirname(funcToolsPath));
    }
}
github microsoft / azure-pipelines-tasks / Tasks / GoToolV0 / gotool.ts View on Github external
let toolPath: string;
    toolPath = toolLib.findLocalTool('go', fixVersion(version));

    if (!toolPath) {
        // download, extract, cache
        toolPath = await acquireGo(version);
        tl.debug("Go tool is cached under " + toolPath);
    }

    setGoEnvironmentVariables(toolPath);

    toolPath = path.join(toolPath, 'bin');
    //
    // prepend the tools path. instructs the agent to prepend for future tasks
    //
    toolLib.prependPath(toolPath);
}
github microsoft / azure-pipelines-tasks / Tasks / DotNetCoreInstallerV1 / dotnetcoreinstaller.ts View on Github external
function addDotNetCoreToolPath() {
    try {
        let globalToolPath: string = "";
        if (tl.osType().match(/^Win/)) {
            globalToolPath = path.join(process.env.USERPROFILE, Constants.relativeGlobalToolPath);
        } else {
            globalToolPath = path.join(process.env.HOME, Constants.relativeGlobalToolPath);
        }

        console.log(tl.loc("PrependGlobalToolPath"));
        tl.mkdirP(globalToolPath);
        toolLib.prependPath(globalToolPath);
    } catch (error) {
        //nop
        console.log(tl.loc("ErrorWhileSettingDotNetToolPath", JSON.stringify(error)));
    }
}
github rdagumampan / yuniql / yuniql-azure-pipelines / src / install / installer.ts View on Github external
//extract assemblies
            const extractRoot: string = await toolLib.extractZip(temp);
            console.log('yuniql/var_extractRoot: ' + extractRoot);

            //cache assemblies
            if (version != 'latest') {
                toolLib.cacheDir(extractRoot, "yuniql", version);
            } else {
                //use v0.0.0 as placeholder for latest version
                //TODO: always replace the current cached version for now
                toolLib.cleanVersion('v0.0.0');
                toolLib.cacheDir(extractRoot, "yuniql", 'v0.0.0');
            }

            //append PATH
            toolLib.prependPath(extractRoot);
        }
    }
    catch (error) {
        console.log('yuniql/error: ' + error.message);
        taskLib.setResult(taskLib.TaskResult.Failed, error.message);
    }
}
github microsoft / azure-devops-extension-tasks / BuildTasks / TfxInstaller / TfxInstaller.ts View on Github external
toolPath = toolLib.findLocalTool('tfx', version);
        }

        if (!toolPath) {
            toolPath = await acquireTfx(version);
        }
    }

    if (os.platform() !== "win32")
    {
        toolPath = path.join(toolPath, "/node_modules/.bin/");
    }
    
    taskLib.setVariable("__tfxpath", toolPath, false);
    toolLib.prependPath(toolPath);
}