当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript task.getDelimitedInput函数代码示例

本文整理汇总了TypeScript中azure-pipelines-task-lib/task.getDelimitedInput函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getDelimitedInput函数的具体用法?TypeScript getDelimitedInput怎么用?TypeScript getDelimitedInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getDelimitedInput函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getExternalAuthInfoArray

export async function getExternalAuthInfoArray(inputKey: string): Promise<AuthInfo[]>
{
    let externalAuthArray: AuthInfo[] = [];
    let endpointNames = tl.getDelimitedInput(inputKey, ",");

    if (!endpointNames || endpointNames.length === 0)
    {
        return externalAuthArray;
    }

    tl.debug(tl.loc("Info_AddingExternalFeeds", endpointNames.length));
    for (let endpointId of endpointNames)
    {
        let feedUri = tl.getEndpointUrl(endpointId, false);
        let endpointName = tl.getEndpointDataParameter(endpointId, "endpointname", false);
        let externalAuth = tl.getEndpointAuthorization(endpointId, true);
        let scheme = tl.getEndpointAuthorizationScheme(endpointId, true).toLowerCase();
        switch(scheme) {
            case "token":
                const token = externalAuth.parameters["apitoken"];
                tl.debug(tl.loc("Info_AddingTokenAuthEntry", feedUri));
                externalAuthArray.push(new AuthInfo({
                        feedName: endpointName,
                        feedUri,
                        isInternalSource: false,
                    } as IPackageSource,
                    AuthType.Token,
                    "build", // fake username, could be anything.
                    token,
                    ));
                break;
            case "usernamepassword":
                let username = externalAuth.parameters["username"];
                let password = externalAuth.parameters["password"];
                tl.debug(tl.loc("Info_AddingPasswordAuthEntry", feedUri));
                externalAuthArray.push(new AuthInfo({
                        feedName: endpointName,
                        feedUri,
                        isInternalSource: false,
                    } as IPackageSource,
                    AuthType.UsernamePassword,
                    username,
                    password));
                break;
            case "none":
            default:
                break;
        }
    }
    return externalAuthArray;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:51,代码来源:authentication.ts

示例2: getInternalAuthInfoArray

export async function getInternalAuthInfoArray(inputKey: string): Promise<AuthInfo[]> {
    let internalAuthArray: AuthInfo[] = [];
    const feedList  = tl.getDelimitedInput(inputKey, ",");
    if (!feedList || feedList.length === 0)
    {
        return internalAuthArray;
    }
    const serverType = tl.getVariable("System.ServerType");
    if (!serverType || serverType.toLowerCase() !== "hosted"){
        throw new Error(tl.loc("Error_PythonInternalFeedsNotSupportedOnprem"));
    }

    tl.debug(tl.loc("Info_AddingInternalFeeds", feedList.length));

    let packagingLocation: string;
    const serviceUri = tl.getEndpointUrl("SYSTEMVSSCONNECTION", false);
    const localAccessToken = pkgLocationUtils.getSystemAccessToken();
    try {
        // This call is to get the packaging URI(abc.pkgs.vs.com) which is same for all protocols.
        packagingLocation = await pkgLocationUtils.getNuGetUriFromBaseServiceUri(
            serviceUri,
            localAccessToken);
    } catch (error) {
        tl.debug(tl.loc("FailedToGetPackagingUri"));
        tl.debug(JSON.stringify(error));
        packagingLocation = serviceUri;
    }

    internalAuthArray = await Promise.all(feedList.map(async (feedName: string) => {
        const feedUri = await pkgLocationUtils.getFeedRegistryUrl(
            packagingLocation,
            pkgLocationUtils.RegistryType.PyPiUpload,
            feedName,
            null,
            localAccessToken,
            true /* useSession */);
        return new AuthInfo({
            feedName,
            feedUri,
            isInternalSource: true,
            } as IPackageSource,
            AuthType.Token,
            "build",
            localAccessToken,
        );
    }));

    return internalAuthArray;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:49,代码来源:authentication.ts

示例3: catch

void common.runTfx(async tfx => {
    tfx.arg(["extension", "share", "--no-color"]);

    common.setTfxMarketplaceArguments(tfx);
    common.validateAndSetTfxManifestArguments(tfx);

    // Installation targets
    const accounts = tl.getDelimitedInput("accounts", ",", true);
    tfx.arg(["--share-with"].concat(accounts).map((value, index) => { return value.trim(); }));

    try{
        const code = await tfx.exec();
        tl.setResult(tl.TaskResult.Succeeded, `tfx exited with return code: ${code}`);
    } catch (err)
    {
        tl.setResult(tl.TaskResult.Failed, `tfx failed with error: ${err}`);
    }
});
开发者ID:Microsoft,项目名称:vsts-extension-build-release-tasks,代码行数:18,代码来源:ShareExtension.ts

示例4: getCustomRegistries

export async function getCustomRegistries(packagingLocation: PackagingLocation): Promise<NpmRegistry[]> {
    const workingDir = tl.getInput(NpmTaskInput.WorkingDir) || process.cwd();
    const npmRegistries: INpmRegistry[] = await npmutil.getLocalNpmRegistries(workingDir, packagingLocation.PackagingUris);
    const registryLocation = tl.getInput(NpmTaskInput.CustomRegistry);
    switch (registryLocation) {
        case RegistryLocation.Feed:
            tl.debug(tl.loc('UseFeed'));
            const feedId = tl.getInput(NpmTaskInput.CustomFeed, true);
            npmRegistries.push(await NpmRegistry.FromFeedId(packagingLocation.DefaultPackagingUri, feedId, null));
            break;
        case RegistryLocation.Npmrc:
            tl.debug(tl.loc('UseNpmrc'));
            const endpointIds = tl.getDelimitedInput(NpmTaskInput.CustomEndpoint, ',');
            if (endpointIds && endpointIds.length > 0) {
                await Promise.all(endpointIds.map(async e => {
                    npmRegistries.push(await NpmRegistry.FromServiceEndpoint(e, true));
                }));
            }
            break;
    }
    return npmRegistries;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:22,代码来源:npmcustom.ts

示例5: if

void common.runTfx(async tfx => {
    let cleanupTfxArgs: () => void;

    try {
        tfx.arg(["extension", "publish", "--json", "--no-color"]);
        const outputVariable = tl.getInput("outputVariable", false);

        common.setTfxMarketplaceArguments(tfx);

        // Read file type
        const fileType = tl.getInput("fileType", true);
        let vsixOutput;

        if (fileType === "manifest") {
            // Set tfx manifest arguments
            cleanupTfxArgs = common.validateAndSetTfxManifestArguments(tfx);

            // Update tasks version if needed
            await common.checkUpdateTasksManifests();
        } else {
            // Set vsix file argument
            let vsixFilePattern = tl.getPathInput("vsixFile", true);
            let matchingVsixFile: string[];
            if (vsixFilePattern.indexOf("*") >= 0 || vsixFilePattern.indexOf("?") >= 0) {
                tl.debug("Pattern found in vsixFile parameter");
                matchingVsixFile = tl.findMatch(tl.getInput("cwd", false) || process.cwd(), vsixFilePattern);
            }
            else {
                tl.debug("No pattern found in vsixFile parameter");
                matchingVsixFile = [vsixFilePattern];
            }

            if (!matchingVsixFile || matchingVsixFile.length === 0) {
                tl.setResult(tl.TaskResult.Failed, `Found no vsix files matching: ${vsixFilePattern}.`);
                return false;
            }
            if (matchingVsixFile.length !== 1) {
                tl.setResult(tl.TaskResult.Failed, `Found multiple vsix files matching: ${vsixFilePattern}.`);
                return false;
            }

            const vsixFile = matchingVsixFile[0];
            tl.checkPath(vsixFile, "vsixPath");

            vsixOutput = tl.getVariable("System.DefaultWorkingDirectory");

            const publisher = tl.getInput("publisherId", false);

            const extensionId = tl.getInput("extensionId", false);
            const extensionTag = tl.getInput("extensionTag", false);

            const extensionName = tl.getInput("extensionName", false);
            const extensionVisibility = tl.getInput("extensionVisibility", false) || "";
            const extensionPricing = tl.getInput("extensionPricing", false);
            const extensionVersion = common.getExtensionVersion();
            const updateTasksId = tl.getBoolInput("updateTasksId", false);
            const updateTasksVersion = tl.getBoolInput("updateTasksVersion", false);

            if (publisher
                || extensionId
                || extensionTag
                || extensionName
                || (extensionPricing && extensionPricing !== "default")
                || (extensionVisibility && extensionVisibility !== "default")
                || extensionVersion
                || updateTasksId ) {

                tl.debug("Start editing of VSIX");
                const ve = new vsixeditor.VSIXEditor(vsixFile, vsixOutput);
                ve.startEdit();

                if (publisher) { ve.editPublisher(publisher); }
                if (extensionId) { ve.editId(extensionId); }
                if (extensionTag) { ve.editIdTag(extensionTag); }
                if (extensionName) { ve.editExtensionName(extensionName); }
                if (extensionVisibility) { ve.editExtensionVisibility(extensionVisibility); }
                if (extensionPricing) { ve.editExtensionPricing(extensionPricing); }
                if (extensionVersion) {
                    ve.editVersion(extensionVersion);
                    ve.editUpdateTasksVersion(updateTasksVersion);
                }
                if (updateTasksId) {
                    ve.editUpdateTasksId(updateTasksId);
                }

                const vsixGeneratedFile = await ve.endEdit();
                tfx.arg(["--vsix", vsixGeneratedFile]);
                vsixOutput = vsixGeneratedFile;
            }
            else {
                vsixOutput = vsixFile;
                tfx.arg(["--vsix", vsixOutput]);
            }
        } 

        // Share with
        const shareWith = tl.getDelimitedInput("shareWith", ",", false).map((value) => { return value.trim(); });
        const extensionVisibility = tl.getInput("extensionVisibility", false) || "";
        const connectTo = tl.getInput("connectTo", true);
        if (shareWith) {
//.........这里部分代码省略.........
开发者ID:Microsoft,项目名称:vsts-extension-build-release-tasks,代码行数:101,代码来源:PublishExtension.ts

示例6: _logNugetStartupVariables

function _logNugetStartupVariables(nuGetPath: string, nugetVersion: string) {
    try {
        const nugetfeedtype = tl.getInput("nugetfeedtype");
        let externalendpoint = null;
        if (nugetfeedtype != null && nugetfeedtype === "external") {
            const epId = tl.getInput("externalendpoint");
            if (epId) {
                externalendpoint = {
                    feedName: tl.getEndpointUrl(epId, false).replace(/\W/g, ""),
                    feedUri: tl.getEndpointUrl(epId, false),
                };
            }
        }

        let externalendpoints = tl.getDelimitedInput("externalendpoints", ",");
        if (externalendpoints) {
            externalendpoints = externalendpoints.reduce((ary, id) => {
                const te = {
                    feedName: tl.getEndpointUrl(id, false).replace(/\W/g, ""),
                    feedUri: tl.getEndpointUrl(id, false),
                };
                ary.push(te);
                return ary;
            }, []);
        }
        const nugetTelem = {
                "command": tl.getInput("command"),
                "NUGET_EXE_TOOL_PATH_ENV_VAR": tl.getVariable(nuGetGetter.NUGET_EXE_TOOL_PATH_ENV_VAR),
                "NUGET_EXE_CUSTOM_LOCATION": tl.getVariable(NUGET_EXE_CUSTOM_LOCATION),
                "searchPatternPack": tl.getPathInput("searchPatternPack"),
                "configurationToPack": tl.getInput("configurationToPack"),
                "versioningScheme": tl.getInput("versioningScheme"),
                "includeReferencedProjects": tl.getBoolInput("includeReferencedProjects"),
                "versionEnvVar": tl.getInput("versioningScheme") === "byEnvVar" ?
                    tl.getVariable(tl.getInput("versionEnvVar")) : null,
                "requestedMajorVersion": tl.getInput("requestedMajorVersion"),
                "requestedMinorVersion": tl.getInput("requestedMinorVersion"),
                "requestedPatchVersion": tl.getInput("requestedPatchVersion"),
                "packTimezone": tl.getInput("packTimezone"),
                "buildProperties": tl.getInput("buildProperties"),
                "basePath": tl.getInput("basePath"),
                "verbosityPack": tl.getInput("verbosityPack"),
                "includeSymbols": tl.getBoolInput("includeSymbols"),
                "NuGet.UseLegacyFindFiles": tl.getVariable("NuGet.UseLegacyFindFiles"),
                "NuGetTasks.IsHostedTestEnvironment": tl.getVariable("NuGetTasks.IsHostedTestEnvironment"),
                "System.TeamFoundationCollectionUri": tl.getVariable("System.TeamFoundationCollectionUri"),
                "NuGet.OverwritePackagingCollectionUrl": tl.getVariable("NuGet.OverwritePackagingCollectionUrl"),
                "externalendpoint": externalendpoint,
                "externalendpoints": externalendpoints,
                "allowpackageconflicts": tl.getInput("allowpackageconflicts"),
                "includenugetorg": tl.getInput("includenugetorg"),
                "nocache": tl.getInput("nocache"),
                "disableparallelprocessing": tl.getInput("disableParallelProcessing"),
                "nugetconfigpath": tl.getInput("nugetconfigpath"),
                "nugetfeedtype": nugetfeedtype,
                "searchpatternpush": tl.getInput("searchpatternpush"),
                "selectorconfig": tl.getInput("selectorconfig"),
                "solution": tl.getInput("solution"),
                "verbositypush": tl.getInput("verbositypush"),
                "verbosityrestore": tl.getInput("verbosityrestore"),
                "nuGetPath": nuGetPath,
                "nugetVersion": nugetVersion,
            };

        telemetry.emitTelemetry("Packaging", "NuGetCommand", nugetTelem);
    } catch (err) {
        tl.debug(`Unable to log NuGet task init telemetry. Err:( ${err} )`);
    }
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:69,代码来源:nugetcommandmain.ts

示例7: main

async function main(): Promise<void> {
    tl.setResourcePath(path.join(__dirname, 'task.json'));
    let saveNpmrcPath: string;
    let npmrc = tl.getInput(constants.NpmAuthenticateTaskInput.WorkingFile);
    let workingDirectory = path.dirname(npmrc);
    if (!(npmrc.endsWith('.npmrc'))) {
        throw new Error(tl.loc('NpmrcNotNpmrc', npmrc));
    }
    else if (!tl.exist(npmrc)) {
        throw new Error(tl.loc('NpmrcDoesNotExist', npmrc));
    }
    else {
        console.log(tl.loc("AuthenticatingThisNpmrc", npmrc));
    }

    if (tl.getVariable("SAVE_NPMRC_PATH")) {
         saveNpmrcPath = tl.getVariable("SAVE_NPMRC_PATH");
    }
    else {
        let tempPath = tl.getVariable('Agent.BuildDirectory') || tl.getVariable('Agent.TempDirectory');
        tempPath = path.join(tempPath, 'npmAuthenticate');
        tl.mkdirP(tempPath);
        saveNpmrcPath = fs.mkdtempSync(tempPath + path.sep); 
        tl.setVariable("SAVE_NPMRC_PATH", saveNpmrcPath, false);
        tl.setVariable("NPM_AUTHENTICATE_TEMP_DIRECTORY", tempPath, false);
    }
    let npmrcTable: Object;

    //The index file is a json object that keeps track of where .npmrc files are saved.
    //There is a key-value pairing of filepaths of original npmrc files to IDs.
    //This is important so multiple runs of the npm Authenticate task on the same .npmrc file actually reverts to the original after the build completes.
    let indexFile = path.join(saveNpmrcPath, 'index.json');

    if (fs.existsSync(indexFile)) { //If the file exists, add to it.
        npmrcTable = JSON.parse(fs.readFileSync(indexFile, 'utf8'));
        
    }
    else { //If the file doesn't exist, create it. 
        npmrcTable = new Object();
        npmrcTable['index'] = 0;
    }

    if (npmrcTable[npmrc] === undefined) {
        npmrcTable[npmrc] = npmrcTable['index'];
        npmrcTable['index']++;
        fs.writeFileSync(indexFile, JSON.stringify(npmrcTable));
        util.saveFileWithName(npmrc, npmrcTable[npmrc], saveNpmrcPath);
    }

    let endpointRegistries: npmregistry.INpmRegistry[] = [];
    let endpointIds = tl.getDelimitedInput(constants.NpmAuthenticateTaskInput.CustomEndpoint, ',');
    if (endpointIds && endpointIds.length > 0) {
        await Promise.all(endpointIds.map(async e => {
            endpointRegistries.push(await npmregistry.NpmRegistry.FromServiceEndpoint(e, true));
        }));
    }

    let packagingLocation: pkgLocationUtils.PackagingLocation;
    try {
        packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Npm);
    } catch (error) {
        tl.debug('Unable to get packaging URIs, using default collection URI');
        tl.debug(JSON.stringify(error));
        const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri');
        packagingLocation = {
            PackagingUris: [collectionUrl],
            DefaultPackagingUri: collectionUrl
        };
    }
    let LocalNpmRegistries = await npmutil.getLocalNpmRegistries(workingDirectory, packagingLocation.PackagingUris);
    
    let npmrcFile = fs.readFileSync(npmrc, 'utf8').split(os.EOL);
    for (let RegistryURLString of npmrcparser.GetRegistries(npmrc, /* saveNormalizedRegistries */ true)) {
        let registryURL = URL.parse(RegistryURLString);
        let registry: npmregistry.NpmRegistry;
        if (endpointRegistries && endpointRegistries.length > 0) {
            for (let serviceEndpoint of endpointRegistries) {
                
                if (util.toNerfDart(serviceEndpoint.url) == util.toNerfDart(RegistryURLString)) {
                    let serviceURL = URL.parse(serviceEndpoint.url);              
                    console.log(tl.loc("AddingEndpointCredentials", registryURL.host));
                    registry = serviceEndpoint;
                    npmrcFile = clearFileOfReferences(npmrc, npmrcFile, serviceURL);
                    break;
                }
            }
        }
        if (!registry) {
            for (let localRegistry of LocalNpmRegistries) {
                if (util.toNerfDart(localRegistry.url) == util.toNerfDart(RegistryURLString)) {
                    let localURL = URL.parse(localRegistry.url);
                    console.log(tl.loc("AddingLocalCredentials"));
                    registry = localRegistry;
                    npmrcFile = clearFileOfReferences(npmrc, npmrcFile, localURL);
                    break;
                }
            }
        }
        if (registry) {
            tl.debug(tl.loc('AddingAuthRegistry', registry.url));
//.........这里部分代码省略.........
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:101,代码来源:npmauth.ts

示例8: switch

// ensure we don't override already set values
const existingArguments = tl.getVariable(variableName);
if (existingArguments) {
    msbuildAdditionalArguments.push(existingArguments);
}

// MSBUILD
let msbuildTargets: string[] = new Array<string>();
if (tl.getBoolInput("MsBuildTargetClean")) {
    msbuildTargets.push("Clean");
}
if (tl.getBoolInput("MsBuildTargetBuild")) {
    msbuildTargets.push("Build");
}
const customMsBuildTargets: string[] = tl.getDelimitedInput("MsBuildTargetCustom", ";", false);
msbuildTargets.push(...customMsBuildTargets);

if (msbuildTargets.length > 0) {
    msbuildAdditionalArguments.push(`/t:${msbuildTargets.join(";")}`);
}

const outputPath = tl.getInput("MsBuildOutputPath", false);
if (outputPath && outputPath !== "AsConfigured") {
    let path: string;
    switch (outputPath) {
        case "BinariesDirectory":
            path = `"${tl.getVariable("Build.BinariesDirectory")}"`;
            break;
        case "StagingDirectory":
            path = `"${tl.getVariable("Build.StagingDirectory")}"`;
开发者ID:jessehouwing,项目名称:vsts-msbuild-helper-task,代码行数:30,代码来源:vsts-msbuild-helper.ts

示例9: runBuild

export async function runBuild(): Promise<void> {
  
  const aipPath: string = taskLib.getPathInput('AipPath', true, false);
  let aipBuild: string = taskLib.getInput('AipBuild');
  let aipPackageName: string = taskLib.getInput('AipPackageName');
  let aipOutputFolder: string = taskLib.getInput('AipOutputFolder');

  if (aipOutputFolder == taskLib.getVariable('BUILD_SOURCESDIRECTORY')) {
    taskLib.debug("Reset AipOutputFolder. OLD: $aipOutputFolder NEW:(empty).");
    aipOutputFolder = ""
  }

  const aipExtraCommands: string[] = taskLib.getDelimitedInput('AipExtraCommands', '\r\n');
  const aipResetDigSign: boolean = taskLib.getBoolInput('AipResetDigSign');

  // Log input parameters
  if (aipBuild == null) {
    aipBuild = '';
  }
  taskLib.debug(taskLib.loc("AI_StartTaskLog"));
  taskLib.debug("aipPath = " + aipPath);
  taskLib.debug("aipBuild  = " + aipBuild);
  taskLib.debug("aipPackageName = " + aipPackageName);
  taskLib.debug("aipOutputFolder = " + aipOutputFolder);
  taskLib.debug("aipExtraCommands = " + aipExtraCommands);
  taskLib.debug("aipResetDigSign = " + aipResetDigSign);

  // Validate "aipPath" input parameter.
  taskLib.checkPath(aipPath, aipPath);

  // Validate advinst tool path
  const advinstToolPath: string = await getAdvinstComTool();
  if (null == advinstToolPath) {
    throw new Error(taskLib.loc("AI_AdvinstNotFoundErr"));
  }

  // Compute the advinst commands
  let advinstCommands: string[] = [];
  if (aipPackageName) {
    advinstCommands.push(`SetPackageName \"${aipPackageName}\" -buildname \"${aipBuild}\"`);
  }

  if (aipOutputFolder) {
    advinstCommands.push(`SetOutputLocation -path \"${aipOutputFolder}\" -buildname \"${aipBuild}\"`);
  }

  if (aipResetDigSign) {
    advinstCommands.push('ResetSig');
  }

  if (aipExtraCommands.length > 0) {
    advinstCommands = advinstCommands.concat(aipExtraCommands);
  }

  advinstCommands.push(aipBuild ? `Build -buildslist \"${aipBuild}\"` : `Build`);

  //Execute the commands
  try {
    var commandsFilePath = getCommandsFile(advinstCommands);
    const advinstCmdLineArgs: string[] = ['/execute', `${aipPath}`, `${commandsFilePath}`];
    let result = taskLib.execSync(advinstToolPath, advinstCmdLineArgs);
    if (result.code != 0) {
      throw new Error(taskLib.loc("AI_ExecFailedErr", result.stdout));
    }
  }
  finally {
    if (commandsFilePath) {
      taskLib.rmRF(commandsFilePath);
    }
  }
}
开发者ID:Caphyon,项目名称:advinst-vsts-task,代码行数:71,代码来源:AdvinstBuilder.ts


注:本文中的azure-pipelines-task-lib/task.getDelimitedInput函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。