本文整理汇总了TypeScript中vsts-task-lib/task.filePathSupplied函数的典型用法代码示例。如果您正苦于以下问题:TypeScript filePathSupplied函数的具体用法?TypeScript filePathSupplied怎么用?TypeScript filePathSupplied使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filePathSupplied函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: 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
示例2: run
export function run(connection: ContainerConnection): any {
var images = [];
var imageName = tl.getInput("imageName", true);
var qualifyImageName = tl.getBoolInput("qualifyImageName");
if (qualifyImageName) {
imageName = connection.qualifyImageName(imageName);
}
var baseImageName = imageUtils.imageNameWithoutTag(imageName);
if (baseImageName === imageName) {
images.push(imageName + ":latest");
} else {
images.push(imageName);
}
tl.getDelimitedInput("additionalImageTags", "\n").forEach(tag => {
images.push(baseImageName + ":" + tag);
});
var includeSourceTags = tl.getBoolInput("includeSourceTags");
if (includeSourceTags) {
sourceUtils.getSourceTags().forEach(tag => {
images.push(baseImageName + ":" + tag);
});
}
var includeLatestTag = tl.getBoolInput("includeLatestTag");
if (baseImageName !== imageName && includeLatestTag) {
images.push(baseImageName + ":latest");
}
var imageDigestFile: string;
if (tl.filePathSupplied("imageDigestFile")) {
imageDigestFile = tl.getPathInput("imageDigestFile");
}
var promise = dockerPush(connection, images.shift(), imageDigestFile);
images.forEach(imageName => {
promise = promise.then(() => dockerPush(connection, imageName));
});
return promise;
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:43,代码来源:containerpush.ts
示例3: main
async function main(): Promise<void> {
let buildIdentityDisplayName: string = null;
let buildIdentityAccount: string = null;
try {
tl.setResourcePath(path.join(__dirname, "task.json"));
// set the console code page to "UTF-8"
if (process.platform === "win32") {
tl.execSync(path.resolve(process.env.windir, "system32", "chcp.com"), ["65001"]);
}
// read inputs
let searchPattern = tl.getPathInput("searchPattern", true, false);
let filesList = nutil.resolveFilterSpec(
searchPattern,
tl.getVariable("System.DefaultWorkingDirectory") || process.cwd());
filesList.forEach(packageFile => {
if (!tl.stats(packageFile).isFile()) {
throw new Error(tl.loc("NotARegularFile", packageFile));
}
});
let connectedServiceName = tl.getInput("connectedServiceName");
let internalFeedUri = tl.getInput("feedName");
let nuGetAdditionalArgs = tl.getInput("nuGetAdditionalArgs");
let verbosity = tl.getInput("verbosity");
let nuGetFeedType = tl.getInput("nuGetFeedType") || "external";
// make sure the feed type is an expected one
let normalizedNuGetFeedType
= ["internal", "external"].find(x => nuGetFeedType.toUpperCase() === x.toUpperCase());
if (!normalizedNuGetFeedType) {
throw new Error(tl.loc("UnknownFeedType", nuGetFeedType));
}
nuGetFeedType = normalizedNuGetFeedType;
// due to a bug where we accidentally allowed nuGetPath to be surrounded by quotes before,
// locateNuGetExe() will strip them and check for existence there.
let nuGetPath = tl.getPathInput("nuGetPath", false, false);
let nugetVersion = tl.getInput("nuGetversion");
let userNuGetProvided = false;
if (tl.filePathSupplied("nuGetPath")) {
nuGetPath = nutil.stripLeadingAndTrailingQuotes(nuGetPath);
userNuGetProvided = true;
if (nugetVersion !== "custom")
{
// For back compat, if a path has already been specified then use it.
// However, warn the user in the build of this behavior.
tl.warning(tl.loc("Warning_ConflictingNuGetPreference"));
}
}
else {
if (nugetVersion === "custom")
{
throw new Error(tl.loc("NoNuGetSpecified"))
}
nuGetPath = nutil.getBundledNuGetLocation(nugetVersion);
}
let serviceUri = tl.getEndpointUrl("SYSTEMVSSCONNECTION", false);
//find nuget location to use
let credProviderPath = ngToolRunner.locateCredentialProvider();
const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPath);
// clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
// is unconditionally displayed
const useCredProvider = ngToolRunner.isCredentialProviderEnabled(quirks) && credProviderPath;
const useCredConfig = ngToolRunner.isCredentialConfigEnabled(quirks) && !useCredProvider;
let accessToken = auth.getSystemAccessToken();
let urlPrefixes = await locationHelpers.assumeNuGetUriPrefixes(serviceUri);
tl.debug(`discovered URL prefixes: ${urlPrefixes}`);
// Note to readers: This variable will be going away once we have a fix for the location service for
// customers behind proxies
let testPrefixes = tl.getVariable("NuGetTasks.ExtraUrlPrefixesForTesting");
if (testPrefixes) {
urlPrefixes = urlPrefixes.concat(testPrefixes.split(";"));
tl.debug(`all URL prefixes: ${urlPrefixes}`);
}
const authInfo = new auth.NuGetAuthInfo(urlPrefixes, accessToken);
let environmentSettings: ngToolRunner.NuGetEnvironmentSettings = {
authInfo: authInfo,
credProviderFolder: useCredProvider ? path.dirname(credProviderPath) : null,
extensionsDisabled: !userNuGetProvided
}
let configFile = null;
let apiKey: string;
let feedUri: string;
let credCleanup = () => { return };
if (nuGetFeedType == "internal") {
if (useCredConfig) {
let nuGetConfigHelper = new NuGetConfigHelper(nuGetPath, null, authInfo, environmentSettings);
nuGetConfigHelper.setSources([{ feedName: "internalFeed", feedUri: internalFeedUri }]);
configFile = nuGetConfigHelper.tempNugetConfigPath;
//.........这里部分代码省略.........
开发者ID:HSAR,项目名称:vso-agent-tasks,代码行数:101,代码来源:nugetpublisher.ts
示例4: main
async function main(): Promise<void> {
let buildIdentityDisplayName: string = null;
let buildIdentityAccount: string = null;
try {
tl.setResourcePath(path.join(__dirname, "task.json"));
// set the console code page to "UTF-8"
if (process.platform === "win32") {
tl.execSync(path.resolve(process.env.windir, "system32", "chcp.com"), ["65001"]);
}
// read inputs
let solution = tl.getPathInput("solution", true, false);
let filesList = nutil.resolveFilterSpec(
solution,
tl.getVariable("System.DefaultWorkingDirectory") || process.cwd());
filesList.forEach(solutionFile => {
if (!tl.stats(solutionFile).isFile()) {
throw new Error(tl.loc("NotARegularFile", solutionFile));
}
});
let noCache = tl.getBoolInput("noCache");
let nuGetRestoreArgs = tl.getInput("nuGetRestoreArgs");
let verbosity = tl.getInput("verbosity");
let restoreMode = tl.getInput("restoreMode") || "Restore";
// normalize the restore mode for display purposes, and ensure it's a known one
let normalizedRestoreMode = ["restore", "install"].find(x => restoreMode.toUpperCase() === x.toUpperCase());
if (!normalizedRestoreMode) {
throw new Error(tl.loc("UnknownRestoreMode", restoreMode));
}
restoreMode = normalizedRestoreMode;
let nugetConfigPath = tl.getPathInput("nugetConfigPath", false, true);
if (!tl.filePathSupplied("nugetConfigPath")) {
nugetConfigPath = null;
}
// due to a bug where we accidentally allowed nuGetPath to be surrounded by quotes before,
// locateNuGetExe() will strip them and check for existence there.
let userNuGetPath = tl.getPathInput("nuGetPath", false, false);
if (!tl.filePathSupplied("nuGetPath")) {
userNuGetPath = null;
}
let serviceUri = tl.getEndpointUrl("SYSTEMVSSCONNECTION", false);
// find nuget location to use
let nuGetPathToUse = ngToolRunner.locateNuGetExe(userNuGetPath);
let credProviderPath = ngToolRunner.locateCredentialProvider();
const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPathToUse);
// clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
// is unconditionally displayed
const useCredProvider = ngToolRunner.isCredentialProviderEnabled(quirks) && credProviderPath;
const useCredConfig = ngToolRunner.isCredentialConfigEnabled(quirks) && !useCredProvider;
let accessToken = auth.getSystemAccessToken();
let urlPrefixes = await locationHelpers.assumeNuGetUriPrefixes(serviceUri);
tl.debug(`discovered URL prefixes: ${urlPrefixes}`);
// Note to readers: This variable will be going away once we have a fix for the location service for
// customers behind proxies
let testPrefixes = tl.getVariable("NuGetTasks.ExtraUrlPrefixesForTesting");
if (testPrefixes) {
urlPrefixes = urlPrefixes.concat(testPrefixes.split(";"));
tl.debug(`all URL prefixes: ${urlPrefixes}`);
}
const authInfo = new auth.NuGetAuthInfo(urlPrefixes, accessToken);
let environmentSettings: ngToolRunner.NuGetEnvironmentSettings = {
authInfo: authInfo,
credProviderFolder: useCredProvider ? path.dirname(credProviderPath) : null,
extensionsDisabled: !userNuGetPath,
};
let configFile = nugetConfigPath;
let credCleanup = () => { return; };
if (useCredConfig) {
if (nugetConfigPath) {
let nuGetConfigHelper = new NuGetConfigHelper(
nuGetPathToUse,
nugetConfigPath,
authInfo,
environmentSettings);
const packageSources = await nuGetConfigHelper.getSourcesFromConfig();
if (packageSources.length !== 0) {
nuGetConfigHelper.setSources(packageSources);
credCleanup = () => tl.rmRF(nuGetConfigHelper.tempNugetConfigPath, true);
configFile = nuGetConfigHelper.tempNugetConfigPath;
}
}
else {
if (credProviderPath) {
tl.warning(tl.loc("Warning_NoConfigForOldNuGet"));
//.........这里部分代码省略.........
开发者ID:shashban,项目名称:vsts-tasks,代码行数:101,代码来源:nugetinstaller.ts
示例5: main
async function main(): Promise<void> {
let packagingLocation: pkgLocationUtils.PackagingLocation;
try {
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet);
} 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 buildIdentityDisplayName: string = null;
let buildIdentityAccount: string = null;
try {
tl.setResourcePath(path.join(__dirname, "task.json"));
nutil.setConsoleCodePage();
// read inputs
let solution = tl.getPathInput("solution", true, false);
let filesList = nutil.resolveFilterSpec(
solution,
tl.getVariable("System.DefaultWorkingDirectory") || process.cwd());
filesList.forEach(solutionFile => {
if (!tl.stats(solutionFile).isFile()) {
throw new Error(tl.loc("NotARegularFile", solutionFile));
}
});
let noCache = tl.getBoolInput("noCache");
let nuGetRestoreArgs = tl.getInput("nuGetRestoreArgs");
let verbosity = tl.getInput("verbosity");
let restoreMode = tl.getInput("restoreMode") || "Restore";
// normalize the restore mode for display purposes, and ensure it's a known one
let normalizedRestoreMode = ["restore", "install"].find(x => restoreMode.toUpperCase() === x.toUpperCase());
if (!normalizedRestoreMode) {
throw new Error(tl.loc("UnknownRestoreMode", restoreMode));
}
restoreMode = normalizedRestoreMode;
let nugetConfigPath = tl.getPathInput("nugetConfigPath", false, true);
if (!tl.filePathSupplied("nugetConfigPath")) {
nugetConfigPath = null;
}
let nugetUxOption = tl.getInput('nuGetVersion');
// due to a bug where we accidentally allowed nuGetPath to be surrounded by quotes before,
// locateNuGetExe() will strip them and check for existence there.
let nuGetPath = tl.getPathInput("nuGetPath", false, false);
let userNuGetProvided = false;
if(nuGetPath !== null && tl.filePathSupplied("nuGetPath")){
nuGetPath = nutil.stripLeadingAndTrailingQuotes(nuGetPath);
// True if the user provided their own version of NuGet
userNuGetProvided = true;
if (nugetUxOption !== "custom"){
// For back compat, if a path has already been specificed then use it.
// However warn the user in the build of this behavior
tl.warning(tl.loc("Warning_ConflictingNuGetPreference"));
}
}
else {
if (nugetUxOption === "custom")
{
throw new Error(tl.loc("NoNuGetSpecified"))
}
// Pull the pre-installed path for NuGet.
nuGetPath = nutil.getBundledNuGetLocation(nugetUxOption);
}
let serviceUri = tl.getEndpointUrl("SYSTEMVSSCONNECTION", false);
//find nuget location to use
let credProviderPath = nutil.locateCredentialProvider();
const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPath);
// clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
// is unconditionally displayed
const useCredProvider = ngToolRunner.isCredentialProviderEnabled(quirks) && credProviderPath;
const useCredConfig = ngToolRunner.isCredentialConfigEnabled(quirks) && !useCredProvider;
let accessToken = auth.getSystemAccessToken();
let urlPrefixes = packagingLocation.PackagingUris;
tl.debug(`discovered URL prefixes: ${urlPrefixes}`);
// Note to readers: This variable will be going away once we have a fix for the location service for
// customers behind proxies
let testPrefixes = tl.getVariable("NuGetTasks.ExtraUrlPrefixesForTesting");
if (testPrefixes) {
urlPrefixes = urlPrefixes.concat(testPrefixes.split(";"));
tl.debug(`all URL prefixes: ${urlPrefixes}`);
}
const authInfo = new auth.NuGetAuthInfo(urlPrefixes, accessToken);
//.........这里部分代码省略.........
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:101,代码来源:nugetinstaller.ts
注:本文中的vsts-task-lib/task.filePathSupplied函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论