本文整理汇总了TypeScript中azure-pipelines-task-lib/task.warning函数的典型用法代码示例。如果您正苦于以下问题:TypeScript warning函数的具体用法?TypeScript warning怎么用?TypeScript warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getVsTestRunnerDetails
export function getVsTestRunnerDetails(testConfig: models.TestConfigurations) {
const vstestexeLocation = locateVSTestConsole(testConfig);
// Temporary hack for 16.0. All this code will be removed once we migrate to the Hydra flow
if (testConfig.vsTestVersion === '16.0') {
testConfig.vsTestVersionDetails = new version.VSTestVersion(vstestexeLocation, 16, 0, 0);
return;
}
const vstestLocationEscaped = vstestexeLocation.replace(/\\/g, '\\\\');
const wmicTool = tl.tool('wmic');
const wmicArgs = ['datafile', 'where', 'name=\''.concat(vstestLocationEscaped, '\''), 'get', 'Version', '/Value'];
wmicTool.arg(wmicArgs);
let output = wmicTool.execSync({ silent: true } as tr.IExecSyncOptions).stdout;
if (utils.Helper.isNullOrWhitespace(output)) {
tl.error(tl.loc('ErrorReadingVstestVersion'));
throw new Error(tl.loc('ErrorReadingVstestVersion'));
}
output = output.trim();
tl.debug('VSTest Version information: ' + output);
const verSplitArray = output.split('=');
if (verSplitArray.length !== 2) {
tl.error(tl.loc('ErrorReadingVstestVersion'));
throw new Error(tl.loc('ErrorReadingVstestVersion'));
}
const versionArray = verSplitArray[1].split('.');
if (versionArray.length !== 4) {
tl.warning(tl.loc('UnexpectedVersionString', output));
throw new Error(tl.loc('UnexpectedVersionString', output));
}
const majorVersion = parseInt(versionArray[0]);
const minorVersion = parseInt(versionArray[1]);
const patchNumber = parseInt(versionArray[2]);
ci.publishEvent({ testplatform: `${majorVersion}.${minorVersion}.${patchNumber}` });
if (isNaN(majorVersion) || isNaN(minorVersion) || isNaN(patchNumber)) {
tl.warning(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
throw new Error(tl.loc('UnexpectedVersionNumber', verSplitArray[1]));
}
switch (majorVersion) {
case 14:
testConfig.vsTestVersionDetails = new version.Dev14VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
break;
case 15:
testConfig.vsTestVersionDetails = new version.Dev15VSTestVersion(vstestexeLocation, minorVersion, patchNumber);
break;
default:
testConfig.vsTestVersionDetails = new version.VSTestVersion(vstestexeLocation, majorVersion, minorVersion, patchNumber);
break;
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:56,代码来源:versionfinder.ts
示例2: shouldUseVstsNuGetPush
function shouldUseVstsNuGetPush(isInternalFeed: boolean, conflictsAllowed: boolean, nugetExePath: string): boolean {
if (tl.osType() !== "Windows_NT"){
tl.debug("Running on a non-windows platform so NuGet.exe will be used.");
return false;
}
if (!isInternalFeed)
{
tl.debug("Pushing to an external feed so NuGet.exe will be used.");
return false;
}
if (commandHelper.isOnPremisesTfs())
{
tl.debug("Pushing to an onPrem environment, only NuGet.exe is supported.");
if(conflictsAllowed){
tl.warning(tl.loc("Warning_AllowDuplicatesOnlyAvailableHosted"));
}
return false;
}
const nugetOverrideFlag = tl.getVariable("NuGet.ForceNuGetForPush");
if (nugetOverrideFlag === "true") {
tl.debug("NuGet.exe is force enabled for publish.");
if(conflictsAllowed)
{
tl.warning(tl.loc("Warning_ForceNuGetCannotSkipConflicts"));
}
return false;
}
if (nugetOverrideFlag === "false") {
tl.debug("NuGet.exe is force disabled for publish.");
return true;
}
const vstsNuGetPushOverrideFlag = tl.getVariable("NuGet.ForceVstsNuGetPushForPush");
if (vstsNuGetPushOverrideFlag === "true") {
tl.debug("VstsNuGetPush.exe is force enabled for publish.");
return true;
}
if (vstsNuGetPushOverrideFlag === "false") {
tl.debug("VstsNuGetPush.exe is force disabled for publish.");
if(conflictsAllowed)
{
tl.warning(tl.loc("Warning_ForceNuGetCannotSkipConflicts"));
}
return false;
}
return true;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:53,代码来源:nugetpublisher.ts
示例3: searchAndReplace
function searchAndReplace(value: string): string {
const method = tl.getInput("searchReplaceMethod", true);
const search = tl.getInput("searchValue") || "";
const replacement = tl.getInput("replacementValue") || "";
if (method === "basic") {
return value.split(search).join(replacement);
} else {
const regexOptions = tl.getInput("regexOptions", false);
let searchExpression: RegExp;
if (regexOptions) {
searchExpression = new RegExp(search, regexOptions);
} else {
searchExpression = new RegExp(search);
}
if (method === "match") {
const result = value.match(searchExpression);
if (!result || result.length === 0) {
tl.warning("Found no matches");
return "";
} else {
return result[0];
}
}
if (method === "regex") {
return value.replace(searchExpression, replacement);
}
}
return value;
}
开发者ID:jessehouwing,项目名称:vsts-variable-tasks,代码行数:32,代码来源:vsts-variable-transform.ts
示例4: run
async function run() {
try {
tl.setResourcePath(path.join(__dirname, 'task.json'));
// Check platform is macOS since demands are not evaluated on Hosted pools
if (os.platform() !== 'darwin') {
console.log(tl.loc('InstallRequiresMac'));
} else {
let keychain: string = tl.getInput('keychain');
let keychainPath: string = tl.getTaskVariable('APPLE_CERTIFICATE_KEYCHAIN');
let deleteCert: boolean = tl.getBoolInput('deleteCert');
let hash: string = tl.getTaskVariable('APPLE_CERTIFICATE_SHA1HASH');
if (deleteCert && hash) {
sign.deleteCert(keychainPath, hash);
}
let deleteKeychain: boolean = false;
if (keychain === 'temp') {
deleteKeychain = true;
} else if (keychain === 'custom') {
deleteKeychain = tl.getBoolInput('deleteCustomKeychain');
}
if (deleteKeychain && keychainPath) {
await sign.deleteKeychain(keychainPath);
}
}
} catch (err) {
tl.warning(err);
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:32,代码来源:postinstallcert.ts
示例5: getSystemAccessToken
export function getSystemAccessToken(): string {
tl.debug('Getting credentials for local feeds');
const auth = tl.getEndpointAuthorization('SYSTEMVSSCONNECTION', false);
if (auth.scheme === 'OAuth') {
tl.debug('Got auth token');
return auth.parameters['AccessToken'];
} else {
tl.warning('Could not determine credentials to use');
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:10,代码来源:locationUtilities.ts
示例6: getTempFolder
export function getTempFolder(): string {
try {
tl.assertAgent('2.115.0');
const tmpDir = tl.getVariable('Agent.TempDirectory');
return tmpDir;
} catch (err) {
tl.warning(tl.loc('UpgradeAgentMessage'));
return os.tmpdir();
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:10,代码来源:helpers.ts
示例7: downloadAndInstall
public async downloadAndInstall(versionInfo: VersionInfo, downloadUrl: string): Promise<void> {
if (!versionInfo || !versionInfo.getVersion() || !downloadUrl || !url.parse(downloadUrl)) {
throw tl.loc("VersionCanNotBeDownloadedFromUrl", versionInfo, downloadUrl);
}
let version = versionInfo.getVersion();
try {
try {
var downloadPath = await toolLib.downloadTool(downloadUrl)
}
catch (ex) {
throw tl.loc("CouldNotDownload", downloadUrl, ex);
}
// Extract
console.log(tl.loc("ExtractingPackage", downloadPath));
try {
var extPath = tl.osType().match(/^Win/) ? await toolLib.extractZip(downloadPath) : await toolLib.extractTar(downloadPath);
}
catch (ex) {
throw tl.loc("FailedWhileExtractingPacakge", ex);
}
// Copy folders
tl.debug(tl.loc("CopyingFoldersIntoPath", this.installationPath));
var allRootLevelEnteriesInDir: string[] = tl.ls("", [extPath]).map(name => path.join(extPath, name));
var directoriesTobeCopied: string[] = allRootLevelEnteriesInDir.filter(path => fs.lstatSync(path).isDirectory());
directoriesTobeCopied.forEach((directoryPath) => {
tl.cp(directoryPath, this.installationPath, "-rf", false);
});
// Copy files
try {
if (this.packageType == utils.Constants.sdk && this.isLatestInstalledVersion(version)) {
tl.debug(tl.loc("CopyingFilesIntoPath", this.installationPath));
var filesToBeCopied = allRootLevelEnteriesInDir.filter(path => !fs.lstatSync(path).isDirectory());
filesToBeCopied.forEach((filePath) => {
tl.cp(filePath, this.installationPath, "-f", false);
});
}
}
catch (ex) {
tl.warning(tl.loc("FailedToCopyTopLevelFiles", this.installationPath, ex));
}
// Cache tool
this.createInstallationCompleteFile(versionInfo);
console.log(tl.loc("SuccessfullyInstalled", this.packageType, version));
}
catch (ex) {
throw tl.loc("FailedWhileInstallingVersionAtPath", version, this.installationPath, ex);
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:55,代码来源:versioninstaller.ts
示例8: request
request(options, (err, res, faModel) => {
if (err) {
tl.warning(tl.loc('UnableToGetFeatureFlag', featureFlag));
tl.debug('Unable to get feature flag ' + featureFlag + ' Error:' + err.message);
resolve(state);
}
if (faModel && faModel.effectiveState) {
state = ('on' === faModel.effectiveState.toLowerCase());
tl.debug(' Final feature flag state: ' + state);
}
resolve(state);
});
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:12,代码来源:runvstest.ts
示例9: run
async function run() {
try {
tl.setResourcePath(path.join(__dirname, 'task.json'));
const keystoreFile: string = tl.getTaskVariable('KEYSTORE_FILE_PATH');
if (keystoreFile && tl.exist(keystoreFile)) {
fs.unlinkSync(keystoreFile);
tl.debug('Deleted keystore file downloaded from the server: ' + keystoreFile);
}
} catch (err) {
tl.warning(tl.loc('DeleteKeystoreFileFailed', err));
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:12,代码来源:postandroidsigning.ts
示例10: clearFileOfReferences
function clearFileOfReferences(npmrc: string, file: string[], url: URL.Url) {
let redoneFile = file;
let warned = false;
for (let i = 0; i < redoneFile.length; i++) {
if (file[i].indexOf(url.host) != -1 && file[i].indexOf(url.path) != -1 && file[i].indexOf('registry=') == -1) {
if (!warned) {
tl.warning(tl.loc('CheckedInCredentialsOverriden', url.host));
}
warned = true;
redoneFile[i] = '';
}
}
fs.writeFileSync(npmrc, redoneFile.join(os.EOL));
return redoneFile;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:15,代码来源:npmauth.ts
注:本文中的azure-pipelines-task-lib/task.warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论