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


TypeScript task.getPathInput函数代码示例

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


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

示例1: while

    return connection.getCombinedConfig(imageDigestComposeFile).then(output => {
        var removeBuildOptions = tl.getBoolInput("removeBuildOptions");
        if (removeBuildOptions) {
            var doc = yaml.safeLoad(output);
            for (var serviceName in doc.services || {}) {
                delete doc.services[serviceName].build;
            }
            output = yaml.safeDump(doc, {lineWidth: -1} as any);
        }

        var baseResolveDir = tl.getPathInput("baseResolveDirectory");
        if (baseResolveDir) {
            // This just searches the output string and replaces all
            // occurrences of the base resolve directory. This isn't
            // precisely accurate but is a good enough solution.
            var replaced = output;
            do {
                output = replaced;
                replaced = output.replace(baseResolveDir, ".");
            } while (replaced !== output);
        }

        var outputDockerComposeFile = tl.getPathInput("outputDockerComposeFile", true);

        fs.writeFileSync(outputDockerComposeFile, output);
    });
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:26,代码来源:dockercomposeconfig.ts

示例2: run

export function run(connection: ContainerConnection): any {
    let action = tl.getInput("action", true);

    let imageNames;
    let useMultiImageMode = action === "Push images";
    if (useMultiImageMode) {
        imageNames = utils.getImageNames();
    } else {
        imageNames = [utils.getImageName()];
    }
    
    let imageMappings = utils.getImageMappings(connection, imageNames);

    let imageDigestFile: string = null;
    if (tl.filePathSupplied("imageDigestFile")) {
        imageDigestFile = tl.getPathInput("imageDigestFile");
    }

    let firstImageMapping = imageMappings.shift();
    let pushedSourceImages = [firstImageMapping.sourceImageName];
    let promise = dockerPush(connection, firstImageMapping.targetImageName, imageDigestFile, useMultiImageMode);
    imageMappings.forEach(imageMapping => {
        // If we've already pushed a tagged version of this source image, then we don't want to write the digest info to the file since it will be duplicate.
        if (pushedSourceImages.indexOf(imageMapping.sourceImageName) >= 0) {
            promise = promise.then(() => dockerPush(connection, imageMapping.targetImageName));
        } else {
            pushedSourceImages.push(imageMapping.sourceImageName);
            promise = promise.then(() => dockerPush(connection, imageMapping.targetImageName, imageDigestFile, useMultiImageMode));
        }
    });

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

示例3: constructor

    constructor() {
        try {
            this.templateType = tl.getInput(constants.TemplateTypeInputName, true);

            if(this.templateType === constants.TemplateTypeCustom) {
                this.customTemplateLocation = tl.getPathInput(constants.CustomTemplateLocationInputType, true, true);
            } else {               
                this.serviceEndpoint = tl.getInput(constants.ConnectedServiceInputName, true);
                this.resourceGroup = tl.getInput(constants.ResourceGroupInputName, true);
                this.storageAccount = tl.getInput(constants.StorageAccountInputName, true);
                this.location = tl.getInput(constants.LocationInputName, true);  

                this.baseImageSource = tl.getInput(constants.BaseImageSourceInputName, true);
                if(this.baseImageSource === constants.BaseImageSourceCustomVhd) {
                    this.customBaseImageUrl = tl.getInput(constants.CustomImageUrlInputName, true);
                    this.osType = tl.getInput(constants.CustomImageOsTypeInputName, true);
                } else {
                    this.builtinBaseImage = tl.getInput(constants.BuiltinBaseImageInputName, true);
                    this._extractImageDetails();
                }              

                this.deployScriptPath = this._getResolvedPath(tl.getInput(constants.DeployScriptPathInputName, true));
                console.log(tl.loc("ResolvedDeployPackgePath", this.deployScriptPath));
                this.packagePath = this._getResolvedPath(tl.getInput(constants.DeployPackageInputName, true));
                console.log(tl.loc("ResolvedDeployScriptPath", this.packagePath));
                this.deployScriptArguments = tl.getInput(constants.DeployScriptArgumentsInputName, false);
            }                

            this.imageUri = tl.getInput(constants.OutputVariableImageUri, false);
        } 
        catch (error) {
            throw (tl.loc("TaskParametersConstructorFailed", error.message));
        }
    }
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:34,代码来源:taskParameters.ts

示例4: getKubectl

    private async getKubectl() : Promise<string> {
        let versionOrLocation = tl.getInput("versionOrLocation");
        if( versionOrLocation === "location") {
            let pathToKubectl = tl.getPathInput("specifyLocation", true, true);
            fs.chmodSync(pathToKubectl, "777");
            return pathToKubectl;
        }
        else if(versionOrLocation === "version") {
            var defaultVersionSpec = "1.7.0";
            let versionSpec = tl.getInput("versionSpec");
            let checkLatest: boolean = tl.getBoolInput('checkLatest', false);
            var version = await utils.getKubectlVersion(versionSpec, checkLatest);
            if (versionSpec != defaultVersionSpec || checkLatest)
            {
               tl.debug(tl.loc("DownloadingClient"));
               var version = await utils.getKubectlVersion(versionSpec, checkLatest);
               return await utils.downloadKubectl(version); 
            }

            // Reached here => default version
            // Now to handle back-compat, return the version installed on the machine
            if(this.kubectlPath && fs.existsSync(this.kubectlPath))
            {
                return this.kubectlPath;
            }
            
           // Download the default version
           tl.debug(tl.loc("DownloadingClient"));
           var version = await utils.getKubectlVersion(versionSpec, checkLatest);
           return await utils.downloadKubectl(version); 
        }
    }
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:32,代码来源:clusterconnection.ts

示例5: pythonScript

(async () => {
    try {
        task.setResourcePath(path.join(__dirname, 'task.json'));
        await pythonScript({
            scriptSource: task.getInput('scriptSource'),
            scriptPath: task.getPathInput('scriptPath'),
            script: task.getInput('script'),
            arguments: task.getInput('arguments'),
            pythonInterpreter: task.getInput('pythonInterpreter'), // string instead of path: a path will default to the agent's sources directory
            workingDirectory: task.getPathInput('workingDirectory'),
            failOnStderr: task.getBoolInput('failOnStderr')
        });
        task.setResult(task.TaskResult.Succeeded, "");
    } catch (error) {
        task.setResult(task.TaskResult.Failed, error.message);
    }
})();
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:17,代码来源:main.ts

示例6: run

export function run(connection: ContainerConnection): any {
    var command = connection.createCommand();
    command.arg("build");

    var dockerfilepath = tl.getInput("dockerFile", true);
    var dockerFile = findDockerFile(dockerfilepath);
    
    if(!tl.exist(dockerFile)) {
        throw new Error(tl.loc('ContainerDockerFileNotFound', dockerfilepath));
    }

    command.arg(["-f", dockerFile]);

    tl.getDelimitedInput("buildArguments", "\n").forEach(buildArgument => {
        command.arg(["--build-arg", buildArgument]);
    });

    var imageName = utils.getImageName(); 
    var qualifyImageName = tl.getBoolInput("qualifyImageName");
    if (qualifyImageName) {
        imageName = connection.qualifyImageName(imageName);
    }
    command.arg(["-t", imageName]);

    var baseImageName = imageUtils.imageNameWithoutTag(imageName);

    tl.getDelimitedInput("additionalImageTags", "\n").forEach(tag => {
        command.arg(["-t", baseImageName + ":" + tag]);
    });

    var includeSourceTags = tl.getBoolInput("includeSourceTags");
    if (includeSourceTags) {
        sourceUtils.getSourceTags().forEach(tag => {
            command.arg(["-t", baseImageName + ":" + tag]);
        });
    }

    var includeLatestTag = tl.getBoolInput("includeLatestTag");
    if (baseImageName !== imageName && includeLatestTag) {
        command.arg(["-t", baseImageName]);
    }

    var memory = tl.getInput("memory");
    if (memory) {
        command.arg(["-m", memory]);
    }

    var context: string;
    var defaultContext = tl.getBoolInput("defaultContext");
    if (defaultContext) {
        context = path.dirname(dockerFile);
    } else {
        context = tl.getPathInput("context");
    }
    command.arg(context);
    return connection.execCommand(command);
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:57,代码来源:containerbuild.ts

示例7: run

export function run(connection: ContainerConnection): any {
    var command = connection.createCommand();
    command.arg("build");

    var dockerfilepath = tl.getInput("dockerFile", true);
    let dockerFile = fileUtils.findDockerFile(dockerfilepath);
    
    if(!tl.exist(dockerFile)) {
        throw new Error(tl.loc('ContainerDockerFileNotFound', dockerfilepath));
    }

    command.arg(["-f", dockerFile]);

    var addDefaultLabels = tl.getBoolInput("addDefaultLabels");
    if (addDefaultLabels) {        
        pipelineUtils.addDefaultLabelArgs(command);
    }

    var commandArguments = tl.getInput("arguments", false); 
    command.line(commandArguments);
    
    var imageName = utils.getImageName(); 
    var qualifyImageName = tl.getBoolInput("qualifyImageName");
    if (qualifyImageName) {
        imageName = connection.getQualifiedImageNameIfRequired(imageName);
    }
    command.arg(["-t", tl.getBoolInput("enforceDockerNamingConvention") ? imageUtils.generateValidImageName(imageName) : imageName]);

    var baseImageName = imageUtils.imageNameWithoutTag(imageName);

    var includeSourceTags = tl.getBoolInput("includeSourceTags");
    if (includeSourceTags) {
        sourceUtils.getSourceTags().forEach(tag => {
            command.arg(["-t", baseImageName + ":" + tag]);
        });
    }

    var includeLatestTag = tl.getBoolInput("includeLatestTag");
    if (baseImageName !== imageName && includeLatestTag) {
        command.arg(["-t", baseImageName]);
    }

    var memoryLimit = tl.getInput("memoryLimit");
    if (memoryLimit) {
        command.arg(["-m", memoryLimit]);
    }

    var context: string;
    var useDefaultContext = tl.getBoolInput("useDefaultContext");
    if (useDefaultContext) {
        context = path.dirname(dockerFile);
    } else {
        context = tl.getPathInput("buildContext");
    }
    command.arg(context);
    return connection.execCommand(command);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:57,代码来源:containerbuild.ts

示例8: getImageNames

export function getImageNames(): string[] {
    let imageNamesFilePath = tl.getPathInput("imageNamesPath", /* required */ true, /* check exists */ true);
    var enforceDockerNamingConvention = tl.getBoolInput("enforceDockerNamingConvention");
    let imageNames = fs.readFileSync(imageNamesFilePath, "utf-8").trim().replace("\r\n", "\n").split("\n");
    if (!imageNames.length) {
        throw new Error(tl.loc("NoImagesInImageNamesFile", imageNamesFilePath));
    }

    return imageNames.map(n => (enforceDockerNamingConvention === true)? imageUtils.generateValidImageName(n): n);
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:10,代码来源:utils.ts

示例9:

export const getInputs = (): PackageInputs => {
    return {
        packageId : tasks.getInput("PackageId", true ),
        packageFormat : tasks.getInput("PackageFormat", true),
        packageVersion : tasks.getInput("PackageVersion"),
        outputPath  : utils.removeTrailingSlashes(utils.safeTrim(tasks.getPathInput("OutputPath"))) || undefined,
        sourcePath  : utils.removeTrailingSlashes(utils.safeTrim(tasks.getPathInput("SourcePath"))) || undefined,
        nuGetAuthor : tasks.getInput("NuGetAuthor"),
        nuGetTitle : tasks.getInput("NuGetTitle"),
        nuGetDescription : tasks.getInput("NuGetDescription"),
        nuGetReleaseNotes : tasks.getInput("NuGetReleaseNotes"),
        nuGetReleaseNotesFile : tasks.getInput("NuGetReleaseNotesFile", false),
        overwrite : tasks.getBoolInput("Overwrite"),
        include : utils.getLineSeparatedItems(tasks.getInput("Include")),
        listFiles : tasks.getBoolInput("ListFiles"),
        additionalArguments: tasks.getInput("AdditionalArguments"),
        compressionLevel: tasks.getInput("CompressionLevel")
    }
}
开发者ID:OctopusDeploy,项目名称:OctoTFS,代码行数:19,代码来源:index.ts

示例10: runTask

 public static async runTask() {
     try {
         let sectionName: string = TaskLib.getInput("sectionName", true);
         let markdownFilePath: string = TaskLib.getPathInput("markdownFilePath", true);
         console.log(`##vso[task.addattachment type=Distributedtask.Core.Summary;name=${sectionName};]${markdownFilePath}`);
     } catch (err) {
         TaskLib.setResult(
             TaskLib.TaskResult.Failed, 
             err.message);
     }
 }
开发者ID:andremarques023,项目名称:vsts-extensions,代码行数:11,代码来源:attachSummaryMarkdown.ts


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