本文整理汇总了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);
});
示例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;
}
示例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));
}
}
示例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);
}
}
示例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);
}
})();
示例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);
}
示例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);
}
示例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);
}
示例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")
}
}
示例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);
}
}