azure-pipelines-task-lib 3.2.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/task.d.ts CHANGED
@@ -1,712 +1,728 @@
1
- /// <reference types="node" />
2
- import Q = require('q');
3
- import fs = require('fs');
4
- import im = require('./internal');
5
- import trm = require('./toolrunner');
6
- export declare enum TaskResult {
7
- Succeeded = 0,
8
- SucceededWithIssues = 1,
9
- Failed = 2,
10
- Cancelled = 3,
11
- Skipped = 4
12
- }
13
- export declare enum TaskState {
14
- Unknown = 0,
15
- Initialized = 1,
16
- InProgress = 2,
17
- Completed = 3
18
- }
19
- export declare enum IssueType {
20
- Error = 0,
21
- Warning = 1
22
- }
23
- export declare enum ArtifactType {
24
- Container = 0,
25
- FilePath = 1,
26
- VersionControl = 2,
27
- GitRef = 3,
28
- TfvcLabel = 4
29
- }
30
- export declare enum FieldType {
31
- AuthParameter = 0,
32
- DataParameter = 1,
33
- Url = 2
34
- }
35
- /** Platforms supported by our build agent */
36
- export declare enum Platform {
37
- Windows = 0,
38
- MacOS = 1,
39
- Linux = 2
40
- }
41
- export declare const setStdStream: typeof im._setStdStream;
42
- export declare const setErrStream: typeof im._setErrStream;
43
- /**
44
- * Sets the result of the task.
45
- * Execution will continue.
46
- * If not set, task will be Succeeded.
47
- * If multiple calls are made to setResult the most pessimistic call wins (Failed) regardless of the order of calls.
48
- *
49
- * @param result TaskResult enum of Succeeded, SucceededWithIssues, Failed, Cancelled or Skipped.
50
- * @param message A message which will be logged as an error issue if the result is Failed.
51
- * @param done Optional. Instructs the agent the task is done. This is helpful when child processes
52
- * may still be running and prevent node from fully exiting. This argument is supported
53
- * from agent version 2.142.0 or higher (otherwise will no-op).
54
- * @returns void
55
- */
56
- export declare function setResult(result: TaskResult, message: string, done?: boolean): void;
57
- export declare const setResourcePath: typeof im._setResourcePath;
58
- export declare const loc: typeof im._loc;
59
- export declare const getVariable: typeof im._getVariable;
60
- /**
61
- * Asserts the agent version is at least the specified minimum.
62
- *
63
- * @param minimum minimum version version - must be 2.104.1 or higher
64
- */
65
- export declare function assertAgent(minimum: string): void;
66
- /**
67
- * Gets a snapshot of the current state of all job variables available to the task.
68
- * Requires a 2.104.1 agent or higher for full functionality.
69
- *
70
- * Limitations on an agent prior to 2.104.1:
71
- * 1) The return value does not include all public variables. Only public variables
72
- * that have been added using setVariable are returned.
73
- * 2) The name returned for each secret variable is the formatted environment variable
74
- * name, not the actual variable name (unless it was set explicitly at runtime using
75
- * setVariable).
76
- *
77
- * @returns VariableInfo[]
78
- */
79
- export declare function getVariables(): VariableInfo[];
80
- /**
81
- * Sets a variable which will be available to subsequent tasks as well.
82
- *
83
- * @param name name of the variable to set
84
- * @param val value to set
85
- * @param secret whether variable is secret. Multi-line secrets are not allowed. Optional, defaults to false
86
- * @param isOutput whether variable is an output variable. Optional, defaults to false
87
- * @returns void
88
- */
89
- export declare function setVariable(name: string, val: string, secret?: boolean, isOutput?: boolean): void;
90
- /**
91
- * Registers a value with the logger, so the value will be masked from the logs. Multi-line secrets are not allowed.
92
- *
93
- * @param val value to register
94
- */
95
- export declare function setSecret(val: string): void;
96
- /** Snapshot of a variable at the time when getVariables was called. */
97
- export interface VariableInfo {
98
- name: string;
99
- value: string;
100
- secret: boolean;
101
- }
102
- /**
103
- * Gets the value of an input.
104
- * If required is true and the value is not set, it will throw.
105
- *
106
- * @param name name of the input to get
107
- * @param required whether input is required. optional, defaults to false
108
- * @returns string
109
- */
110
- export declare function getInput(name: string, required?: boolean): string | undefined;
111
- /**
112
- * Gets the value of an input.
113
- * If the value is not set, it will throw.
114
- *
115
- * @param name name of the input to get
116
- * @returns string
117
- */
118
- export declare function getInputRequired(name: string): string;
119
- /**
120
- * Gets the value of an input and converts to a bool. Convenience.
121
- * If required is true and the value is not set, it will throw.
122
- * If required is false and the value is not set, returns false.
123
- *
124
- * @param name name of the bool input to get
125
- * @param required whether input is required. optional, defaults to false
126
- * @returns boolean
127
- */
128
- export declare function getBoolInput(name: string, required?: boolean): boolean;
129
- /**
130
- * Gets the value of an input and splits the value using a delimiter (space, comma, etc).
131
- * Empty values are removed. This function is useful for splitting an input containing a simple
132
- * list of items - such as build targets.
133
- * IMPORTANT: Do not use this function for splitting additional args! Instead use argString(), which
134
- * follows normal argument splitting rules and handles values encapsulated by quotes.
135
- * If required is true and the value is not set, it will throw.
136
- *
137
- * @param name name of the input to get
138
- * @param delim delimiter to split on
139
- * @param required whether input is required. optional, defaults to false
140
- * @returns string[]
141
- */
142
- export declare function getDelimitedInput(name: string, delim: string | RegExp, required?: boolean): string[];
143
- /**
144
- * Checks whether a path inputs value was supplied by the user
145
- * File paths are relative with a picker, so an empty path is the root of the repo.
146
- * Useful if you need to condition work (like append an arg) if a value was supplied
147
- *
148
- * @param name name of the path input to check
149
- * @returns boolean
150
- */
151
- export declare function filePathSupplied(name: string): boolean;
152
- /**
153
- * Gets the value of a path input
154
- * It will be quoted for you if it isn't already and contains spaces
155
- * If required is true and the value is not set, it will throw.
156
- * If check is true and the path does not exist, it will throw.
157
- *
158
- * @param name name of the input to get
159
- * @param required whether input is required. optional, defaults to false
160
- * @param check whether path is checked. optional, defaults to false
161
- * @returns string
162
- */
163
- export declare function getPathInput(name: string, required?: boolean, check?: boolean): string | undefined;
164
- /**
165
- * Gets the value of a path input
166
- * It will be quoted for you if it isn't already and contains spaces
167
- * If the value is not set, it will throw.
168
- * If check is true and the path does not exist, it will throw.
169
- *
170
- * @param name name of the input to get
171
- * @param check whether path is checked. optional, defaults to false
172
- * @returns string
173
- */
174
- export declare function getPathInputRequired(name: string, check?: boolean): string;
175
- /**
176
- * Gets the url for a service endpoint
177
- * If the url was not set and is not optional, it will throw.
178
- *
179
- * @param id name of the service endpoint
180
- * @param optional whether the url is optional
181
- * @returns string
182
- */
183
- export declare function getEndpointUrl(id: string, optional: boolean): string | undefined;
184
- /**
185
- * Gets the url for a service endpoint
186
- * If the url was not set, it will throw.
187
- *
188
- * @param id name of the service endpoint
189
- * @returns string
190
- */
191
- export declare function getEndpointUrlRequired(id: string): string;
192
- export declare function getEndpointDataParameter(id: string, key: string, optional: boolean): string | undefined;
193
- export declare function getEndpointDataParameterRequired(id: string, key: string): string;
194
- /**
195
- * Gets the endpoint authorization scheme for a service endpoint
196
- * If the endpoint authorization scheme is not set and is not optional, it will throw.
197
- *
198
- * @param id name of the service endpoint
199
- * @param optional whether the endpoint authorization scheme is optional
200
- * @returns {string} value of the endpoint authorization scheme
201
- */
202
- export declare function getEndpointAuthorizationScheme(id: string, optional: boolean): string | undefined;
203
- /**
204
- * Gets the endpoint authorization scheme for a service endpoint
205
- * If the endpoint authorization scheme is not set, it will throw.
206
- *
207
- * @param id name of the service endpoint
208
- * @returns {string} value of the endpoint authorization scheme
209
- */
210
- export declare function getEndpointAuthorizationSchemeRequired(id: string): string;
211
- /**
212
- * Gets the endpoint authorization parameter value for a service endpoint with specified key
213
- * If the endpoint authorization parameter is not set and is not optional, it will throw.
214
- *
215
- * @param id name of the service endpoint
216
- * @param key key to find the endpoint authorization parameter
217
- * @param optional optional whether the endpoint authorization scheme is optional
218
- * @returns {string} value of the endpoint authorization parameter value
219
- */
220
- export declare function getEndpointAuthorizationParameter(id: string, key: string, optional: boolean): string | undefined;
221
- /**
222
- * Gets the endpoint authorization parameter value for a service endpoint with specified key
223
- * If the endpoint authorization parameter is not set, it will throw.
224
- *
225
- * @param id name of the service endpoint
226
- * @param key key to find the endpoint authorization parameter
227
- * @returns {string} value of the endpoint authorization parameter value
228
- */
229
- export declare function getEndpointAuthorizationParameterRequired(id: string, key: string): string;
230
- /**
231
- * Interface for EndpointAuthorization
232
- * Contains a schema and a string/string dictionary of auth data
233
- */
234
- export interface EndpointAuthorization {
235
- /** dictionary of auth data */
236
- parameters: {
237
- [key: string]: string;
238
- };
239
- /** auth scheme such as OAuth or username/password etc... */
240
- scheme: string;
241
- }
242
- /**
243
- * Gets the authorization details for a service endpoint
244
- * If the authorization was not set and is not optional, it will set the task result to Failed.
245
- *
246
- * @param id name of the service endpoint
247
- * @param optional whether the url is optional
248
- * @returns string
249
- */
250
- export declare function getEndpointAuthorization(id: string, optional: boolean): EndpointAuthorization | undefined;
251
- /**
252
- * Gets the name for a secure file
253
- *
254
- * @param id secure file id
255
- * @returns string
256
- */
257
- export declare function getSecureFileName(id: string): string | undefined;
258
- /**
259
- * Gets the secure file ticket that can be used to download the secure file contents
260
- *
261
- * @param id name of the secure file
262
- * @returns {string} secure file ticket
263
- */
264
- export declare function getSecureFileTicket(id: string): string | undefined;
265
- /**
266
- * Gets a variable value that is set by previous step from the same wrapper task.
267
- * Requires a 2.115.0 agent or higher.
268
- *
269
- * @param name name of the variable to get
270
- * @returns string
271
- */
272
- export declare function getTaskVariable(name: string): string | undefined;
273
- /**
274
- * Sets a task variable which will only be available to subsequent steps belong to the same wrapper task.
275
- * Requires a 2.115.0 agent or higher.
276
- *
277
- * @param name name of the variable to set
278
- * @param val value to set
279
- * @param secret whether variable is secret. optional, defaults to false
280
- * @returns void
281
- */
282
- export declare function setTaskVariable(name: string, val: string, secret?: boolean): void;
283
- export declare const command: typeof im._command;
284
- export declare const warning: typeof im._warning;
285
- export declare const error: typeof im._error;
286
- export declare const debug: typeof im._debug;
287
- export interface FsStats extends fs.Stats {
288
- }
289
- /**
290
- * Get's stat on a path.
291
- * Useful for checking whether a file or directory. Also getting created, modified and accessed time.
292
- * see [fs.stat](https://nodejs.org/api/fs.html#fs_class_fs_stats)
293
- *
294
- * @param path path to check
295
- * @returns fsStat
296
- */
297
- export declare function stats(path: string): FsStats;
298
- export declare const exist: typeof im._exist;
299
- export declare function writeFile(file: string, data: string | Buffer, options?: BufferEncoding | fs.WriteFileOptions): void;
300
- /**
301
- * @deprecated Use `getPlatform`
302
- * Useful for determining the host operating system.
303
- * see [os.type](https://nodejs.org/api/os.html#os_os_type)
304
- *
305
- * @return the name of the operating system
306
- */
307
- export declare function osType(): string;
308
- /**
309
- * Determine the operating system the build agent is running on.
310
- * @returns {Platform}
311
- * @throws {Error} Platform is not supported by our agent
312
- */
313
- export declare function getPlatform(): Platform;
314
- /**
315
- * Returns the process's current working directory.
316
- * see [process.cwd](https://nodejs.org/api/process.html#process_process_cwd)
317
- *
318
- * @return the path to the current working directory of the process
319
- */
320
- export declare function cwd(): string;
321
- export declare const checkPath: typeof im._checkPath;
322
- /**
323
- * Change working directory.
324
- *
325
- * @param path new working directory path
326
- * @returns void
327
- */
328
- export declare function cd(path: string): void;
329
- /**
330
- * Change working directory and push it on the stack
331
- *
332
- * @param path new working directory path
333
- * @returns void
334
- */
335
- export declare function pushd(path: string): void;
336
- /**
337
- * Change working directory back to previously pushed directory
338
- *
339
- * @returns void
340
- */
341
- export declare function popd(): void;
342
- /**
343
- * Make a directory. Creates the full path with folders in between
344
- * Will throw if it fails
345
- *
346
- * @param p path to create
347
- * @returns void
348
- */
349
- export declare function mkdirP(p: string): void;
350
- /**
351
- * Resolves a sequence of paths or path segments into an absolute path.
352
- * Calls node.js path.resolve()
353
- * Allows L0 testing with consistent path formats on Mac/Linux and Windows in the mock implementation
354
- * @param pathSegments
355
- * @returns {string}
356
- */
357
- export declare function resolve(...pathSegments: any[]): string;
358
- export declare const which: typeof im._which;
359
- /**
360
- * Returns array of files in the given path, or in current directory if no path provided. See shelljs.ls
361
- * @param {string} options Available options: -R (recursive), -A (all files, include files beginning with ., except for . and ..)
362
- * @param {string[]} paths Paths to search.
363
- * @return {string[]} An array of files in the given path(s).
364
- */
365
- export declare function ls(options: string, paths: string[]): string[];
366
- /**
367
- * Copies a file or folder.
368
- *
369
- * @param source source path
370
- * @param dest destination path
371
- * @param options string -r, -f or -rf for recursive and force
372
- * @param continueOnError optional. whether to continue on error
373
- * @param retryCount optional. Retry count to copy the file. It might help to resolve intermittent issues e.g. with UNC target paths on a remote host.
374
- */
375
- export declare function cp(source: string, dest: string, options?: string, continueOnError?: boolean, retryCount?: number): void;
376
- /**
377
- * Moves a path.
378
- *
379
- * @param source source path
380
- * @param dest destination path
381
- * @param options string -f or -n for force and no clobber
382
- * @param continueOnError optional. whether to continue on error
383
- */
384
- export declare function mv(source: string, dest: string, options?: string, continueOnError?: boolean): void;
385
- /**
386
- * Interface for FindOptions
387
- * Contains properties to control whether to follow symlinks
388
- */
389
- export interface FindOptions {
390
- /**
391
- * When true, broken symbolic link will not cause an error.
392
- */
393
- allowBrokenSymbolicLinks: boolean;
394
- /**
395
- * Equivalent to the -H command line option. Indicates whether to traverse descendants if
396
- * the specified path is a symbolic link directory. Does not cause nested symbolic link
397
- * directories to be traversed.
398
- */
399
- followSpecifiedSymbolicLink: boolean;
400
- /**
401
- * Equivalent to the -L command line option. Indicates whether to traverse descendants of
402
- * symbolic link directories.
403
- */
404
- followSymbolicLinks: boolean;
405
- /**
406
- * When true, missing files will not cause an error and will be skipped.
407
- */
408
- skipMissingFiles?: boolean;
409
- }
410
- /**
411
- * Interface for RetryOptions
412
- *
413
- * Contains "continueOnError" and "retryCount" options.
414
- */
415
- export interface RetryOptions {
416
- /**
417
- * If true, code still continues to execute when all retries failed.
418
- */
419
- continueOnError: boolean;
420
- /**
421
- * Number of retries.
422
- */
423
- retryCount: number;
424
- }
425
- /**
426
- * Tries to execute a function a specified number of times.
427
- *
428
- * @param func a function to be executed.
429
- * @param args executed function arguments array.
430
- * @param retryOptions optional. Defaults to { continueOnError: false, retryCount: 0 }.
431
- * @returns the same as the usual function.
432
- */
433
- export declare function retry(func: Function, args: any[], retryOptions?: RetryOptions): any;
434
- /**
435
- * Recursively finds all paths a given path. Returns an array of paths.
436
- *
437
- * @param findPath path to search
438
- * @param options optional. defaults to { followSymbolicLinks: true }. following soft links is generally appropriate unless deleting files.
439
- * @returns string[]
440
- */
441
- export declare function find(findPath: string, options?: FindOptions): string[];
442
- /**
443
- * Prefer tl.find() and tl.match() instead. This function is for backward compatibility
444
- * when porting tasks to Node from the PowerShell or PowerShell3 execution handler.
445
- *
446
- * @param rootDirectory path to root unrooted patterns with
447
- * @param pattern include and exclude patterns
448
- * @param includeFiles whether to include files in the result. defaults to true when includeFiles and includeDirectories are both false
449
- * @param includeDirectories whether to include directories in the result
450
- * @returns string[]
451
- */
452
- export declare function legacyFindFiles(rootDirectory: string, pattern: string, includeFiles?: boolean, includeDirectories?: boolean): string[];
453
- /**
454
- * Remove a path recursively with force
455
- *
456
- * @param inputPath path to remove
457
- * @throws when the file or directory exists but could not be deleted.
458
- */
459
- export declare function rmRF(inputPath: string): void;
460
- /**
461
- * Exec a tool. Convenience wrapper over ToolRunner to exec with args in one call.
462
- * Output will be streamed to the live console.
463
- * Returns promise with return code
464
- *
465
- * @param tool path to tool to exec
466
- * @param args an arg string or array of args
467
- * @param options optional exec options. See IExecOptions
468
- * @returns number
469
- */
470
- export declare function exec(tool: string, args: any, options?: trm.IExecOptions): Q.Promise<number>;
471
- /**
472
- * Exec a tool synchronously. Convenience wrapper over ToolRunner to execSync with args in one call.
473
- * Output will be *not* be streamed to the live console. It will be returned after execution is complete.
474
- * Appropriate for short running tools
475
- * Returns IExecResult with output and return code
476
- *
477
- * @param tool path to tool to exec
478
- * @param args an arg string or array of args
479
- * @param options optional exec options. See IExecSyncOptions
480
- * @returns IExecSyncResult
481
- */
482
- export declare function execSync(tool: string, args: string | string[], options?: trm.IExecSyncOptions): trm.IExecSyncResult;
483
- /**
484
- * Convenience factory to create a ToolRunner.
485
- *
486
- * @param tool path to tool to exec
487
- * @returns ToolRunner
488
- */
489
- export declare function tool(tool: string): trm.ToolRunner;
490
- export interface MatchOptions {
491
- debug?: boolean;
492
- nobrace?: boolean;
493
- noglobstar?: boolean;
494
- dot?: boolean;
495
- noext?: boolean;
496
- nocase?: boolean;
497
- nonull?: boolean;
498
- matchBase?: boolean;
499
- nocomment?: boolean;
500
- nonegate?: boolean;
501
- flipNegate?: boolean;
502
- }
503
- /**
504
- * Applies glob patterns to a list of paths. Supports interleaved exclude patterns.
505
- *
506
- * @param list array of paths
507
- * @param patterns patterns to apply. supports interleaved exclude patterns.
508
- * @param patternRoot optional. default root to apply to unrooted patterns. not applied to basename-only patterns when matchBase:true.
509
- * @param options optional. defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }.
510
- */
511
- export declare function match(list: string[], patterns: string[] | string, patternRoot?: string, options?: MatchOptions): string[];
512
- /**
513
- * Filter to apply glob patterns
514
- *
515
- * @param pattern pattern to apply
516
- * @param options optional. defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }.
517
- */
518
- export declare function filter(pattern: string, options?: MatchOptions): (element: string, indexed: number, array: string[]) => boolean;
519
- /**
520
- * Determines the find root from a list of patterns. Performs the find and then applies the glob patterns.
521
- * Supports interleaved exclude patterns. Unrooted patterns are rooted using defaultRoot, unless
522
- * matchOptions.matchBase is specified and the pattern is a basename only. For matchBase cases, the
523
- * defaultRoot is used as the find root.
524
- *
525
- * @param defaultRoot default path to root unrooted patterns. falls back to System.DefaultWorkingDirectory or process.cwd().
526
- * @param patterns pattern or array of patterns to apply
527
- * @param findOptions defaults to { followSymbolicLinks: true }. following soft links is generally appropriate unless deleting files.
528
- * @param matchOptions defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }
529
- */
530
- export declare function findMatch(defaultRoot: string, patterns: string[] | string, findOptions?: FindOptions, matchOptions?: MatchOptions): string[];
531
- export interface ProxyConfiguration {
532
- proxyUrl: string;
533
- proxyUsername?: string;
534
- proxyPassword?: string;
535
- proxyBypassHosts?: string[];
536
- }
537
- /**
538
- * Gets http proxy configuration used by Build/Release agent
539
- *
540
- * @return ProxyConfiguration
541
- */
542
- export declare function getHttpProxyConfiguration(requestUrl?: string): ProxyConfiguration | null;
543
- export interface CertConfiguration {
544
- caFile?: string;
545
- certFile?: string;
546
- keyFile?: string;
547
- certArchiveFile?: string;
548
- passphrase?: string;
549
- }
550
- /**
551
- * Gets http certificate configuration used by Build/Release agent
552
- *
553
- * @return CertConfiguration
554
- */
555
- export declare function getHttpCertConfiguration(): CertConfiguration | null;
556
- export declare class TestPublisher {
557
- testRunner: string;
558
- constructor(testRunner: string);
559
- publish(resultFiles?: string | string[], mergeResults?: string, platform?: string, config?: string, runTitle?: string, publishRunAttachments?: string, testRunSystem?: string): void;
560
- }
561
- export declare class CodeCoveragePublisher {
562
- constructor();
563
- publish(codeCoverageTool?: string, summaryFileLocation?: string, reportDirectory?: string, additionalCodeCoverageFiles?: string | string[]): void;
564
- }
565
- export declare class CodeCoverageEnabler {
566
- private buildTool;
567
- private ccTool;
568
- constructor(buildTool: string, ccTool: string);
569
- enableCodeCoverage(buildProps: {
570
- [key: string]: string;
571
- }): void;
572
- }
573
- /**
574
- * Upload user interested file as additional log information
575
- * to the current timeline record.
576
- *
577
- * The file shall be available for download along with task logs.
578
- *
579
- * @param path Path to the file that should be uploaded.
580
- * @returns void
581
- */
582
- export declare function uploadFile(path: string): void;
583
- /**
584
- * Instruction for the agent to update the PATH environment variable.
585
- * The specified directory is prepended to the PATH.
586
- * The updated environment variable will be reflected in subsequent tasks.
587
- *
588
- * @param path Local directory path.
589
- * @returns void
590
- */
591
- export declare function prependPath(path: string): void;
592
- /**
593
- * Upload and attach summary markdown to current timeline record.
594
- * This summary shall be added to the build/release summary and
595
- * not available for download with logs.
596
- *
597
- * @param path Local directory path.
598
- * @returns void
599
- */
600
- export declare function uploadSummary(path: string): void;
601
- /**
602
- * Upload and attach attachment to current timeline record.
603
- * These files are not available for download with logs.
604
- * These can only be referred to by extensions using the type or name values.
605
- *
606
- * @param type Attachment type.
607
- * @param name Attachment name.
608
- * @param path Attachment path.
609
- * @returns void
610
- */
611
- export declare function addAttachment(type: string, name: string, path: string): void;
612
- /**
613
- * Set an endpoint field with given value.
614
- * Value updated will be retained in the endpoint for
615
- * the subsequent tasks that execute within the same job.
616
- *
617
- * @param id Endpoint id.
618
- * @param field FieldType enum of AuthParameter, DataParameter or Url.
619
- * @param key Key.
620
- * @param value Value for key or url.
621
- * @returns void
622
- */
623
- export declare function setEndpoint(id: string, field: FieldType, key: string, value: string): void;
624
- /**
625
- * Set progress and current operation for current task.
626
- *
627
- * @param percent Percentage of completion.
628
- * @param currentOperation Current pperation.
629
- * @returns void
630
- */
631
- export declare function setProgress(percent: number, currentOperation: string): void;
632
- /**
633
- * Indicates whether to write the logging command directly to the host or to the output pipeline.
634
- *
635
- * @param id Timeline record Guid.
636
- * @param parentId Parent timeline record Guid.
637
- * @param recordType Record type.
638
- * @param recordName Record name.
639
- * @param order Order of timeline record.
640
- * @param startTime Start time.
641
- * @param finishTime End time.
642
- * @param progress Percentage of completion.
643
- * @param state TaskState enum of Unknown, Initialized, InProgress or Completed.
644
- * @param result TaskResult enum of Succeeded, SucceededWithIssues, Failed, Cancelled or Skipped.
645
- * @param message current operation
646
- * @returns void
647
- */
648
- export declare function logDetail(id: string, message: string, parentId?: string, recordType?: string, recordName?: string, order?: number, startTime?: string, finishTime?: string, progress?: number, state?: TaskState, result?: TaskResult): void;
649
- /**
650
- * Log error or warning issue to timeline record of current task.
651
- *
652
- * @param type IssueType enum of Error or Warning.
653
- * @param sourcePath Source file location.
654
- * @param lineNumber Line number.
655
- * @param columnNumber Column number.
656
- * @param code Error or warning code.
657
- * @param message Error or warning message.
658
- * @returns void
659
- */
660
- export declare function logIssue(type: IssueType, message: string, sourcePath?: string, lineNumber?: number, columnNumber?: number, errorCode?: string): void;
661
- /**
662
- * Upload user interested file as additional log information
663
- * to the current timeline record.
664
- *
665
- * The file shall be available for download along with task logs.
666
- *
667
- * @param containerFolder Folder that the file will upload to, folder will be created if needed.
668
- * @param path Path to the file that should be uploaded.
669
- * @param name Artifact name.
670
- * @returns void
671
- */
672
- export declare function uploadArtifact(containerFolder: string, path: string, name?: string): void;
673
- /**
674
- * Create an artifact link, artifact location is required to be
675
- * a file container path, VC path or UNC share path.
676
- *
677
- * The file shall be available for download along with task logs.
678
- *
679
- * @param name Artifact name.
680
- * @param path Path to the file that should be associated.
681
- * @param artifactType ArtifactType enum of Container, FilePath, VersionControl, GitRef or TfvcLabel.
682
- * @returns void
683
- */
684
- export declare function associateArtifact(name: string, path: string, artifactType: ArtifactType): void;
685
- /**
686
- * Upload user interested log to build’s container “logs\tool” folder.
687
- *
688
- * @param path Path to the file that should be uploaded.
689
- * @returns void
690
- */
691
- export declare function uploadBuildLog(path: string): void;
692
- /**
693
- * Update build number for current build.
694
- *
695
- * @param value Value to be assigned as the build number.
696
- * @returns void
697
- */
698
- export declare function updateBuildNumber(value: string): void;
699
- /**
700
- * Add a tag for current build.
701
- *
702
- * @param value Tag value.
703
- * @returns void
704
- */
705
- export declare function addBuildTag(value: string): void;
706
- /**
707
- * Update release name for current release.
708
- *
709
- * @param value Value to be assigned as the release name.
710
- * @returns void
711
- */
712
- export declare function updateReleaseName(name: string): void;
1
+ /// <reference types="node" />
2
+ import Q = require('q');
3
+ import fs = require('fs');
4
+ import im = require('./internal');
5
+ import trm = require('./toolrunner');
6
+ export declare enum TaskResult {
7
+ Succeeded = 0,
8
+ SucceededWithIssues = 1,
9
+ Failed = 2,
10
+ Cancelled = 3,
11
+ Skipped = 4
12
+ }
13
+ export declare enum TaskState {
14
+ Unknown = 0,
15
+ Initialized = 1,
16
+ InProgress = 2,
17
+ Completed = 3
18
+ }
19
+ export declare enum IssueType {
20
+ Error = 0,
21
+ Warning = 1
22
+ }
23
+ export declare enum ArtifactType {
24
+ Container = 0,
25
+ FilePath = 1,
26
+ VersionControl = 2,
27
+ GitRef = 3,
28
+ TfvcLabel = 4
29
+ }
30
+ export declare enum FieldType {
31
+ AuthParameter = 0,
32
+ DataParameter = 1,
33
+ Url = 2
34
+ }
35
+ /** Platforms supported by our build agent */
36
+ export declare enum Platform {
37
+ Windows = 0,
38
+ MacOS = 1,
39
+ Linux = 2
40
+ }
41
+ export declare enum AgentHostedMode {
42
+ Unknown = 0,
43
+ SelfHosted = 1,
44
+ MsHosted = 2
45
+ }
46
+ export declare const setStdStream: typeof im._setStdStream;
47
+ export declare const setErrStream: typeof im._setErrStream;
48
+ /**
49
+ * Sets the result of the task.
50
+ * Execution will continue.
51
+ * If not set, task will be Succeeded.
52
+ * If multiple calls are made to setResult the most pessimistic call wins (Failed) regardless of the order of calls.
53
+ *
54
+ * @param result TaskResult enum of Succeeded, SucceededWithIssues, Failed, Cancelled or Skipped.
55
+ * @param message A message which will be logged as an error issue if the result is Failed.
56
+ * @param done Optional. Instructs the agent the task is done. This is helpful when child processes
57
+ * may still be running and prevent node from fully exiting. This argument is supported
58
+ * from agent version 2.142.0 or higher (otherwise will no-op).
59
+ * @returns void
60
+ */
61
+ export declare function setResult(result: TaskResult, message: string, done?: boolean): void;
62
+ export declare const setResourcePath: typeof im._setResourcePath;
63
+ export declare const loc: typeof im._loc;
64
+ export declare const getVariable: typeof im._getVariable;
65
+ /**
66
+ * Asserts the agent version is at least the specified minimum.
67
+ *
68
+ * @param minimum minimum version version - must be 2.104.1 or higher
69
+ */
70
+ export declare function assertAgent(minimum: string): void;
71
+ /**
72
+ * Gets a snapshot of the current state of all job variables available to the task.
73
+ * Requires a 2.104.1 agent or higher for full functionality.
74
+ *
75
+ * Limitations on an agent prior to 2.104.1:
76
+ * 1) The return value does not include all public variables. Only public variables
77
+ * that have been added using setVariable are returned.
78
+ * 2) The name returned for each secret variable is the formatted environment variable
79
+ * name, not the actual variable name (unless it was set explicitly at runtime using
80
+ * setVariable).
81
+ *
82
+ * @returns VariableInfo[]
83
+ */
84
+ export declare function getVariables(): VariableInfo[];
85
+ /**
86
+ * Sets a variable which will be available to subsequent tasks as well.
87
+ *
88
+ * @param name name of the variable to set
89
+ * @param val value to set
90
+ * @param secret whether variable is secret. Multi-line secrets are not allowed. Optional, defaults to false
91
+ * @param isOutput whether variable is an output variable. Optional, defaults to false
92
+ * @returns void
93
+ */
94
+ export declare function setVariable(name: string, val: string, secret?: boolean, isOutput?: boolean): void;
95
+ /**
96
+ * Registers a value with the logger, so the value will be masked from the logs. Multi-line secrets are not allowed.
97
+ *
98
+ * @param val value to register
99
+ */
100
+ export declare function setSecret(val: string): void;
101
+ /** Snapshot of a variable at the time when getVariables was called. */
102
+ export interface VariableInfo {
103
+ name: string;
104
+ value: string;
105
+ secret: boolean;
106
+ }
107
+ /**
108
+ * Gets the value of an input.
109
+ * If required is true and the value is not set, it will throw.
110
+ *
111
+ * @param name name of the input to get
112
+ * @param required whether input is required. optional, defaults to false
113
+ * @returns string
114
+ */
115
+ export declare function getInput(name: string, required?: boolean): string | undefined;
116
+ /**
117
+ * Gets the value of an input.
118
+ * If the value is not set, it will throw.
119
+ *
120
+ * @param name name of the input to get
121
+ * @returns string
122
+ */
123
+ export declare function getInputRequired(name: string): string;
124
+ /**
125
+ * Gets the value of an input and converts to a bool. Convenience.
126
+ * If required is true and the value is not set, it will throw.
127
+ * If required is false and the value is not set, returns false.
128
+ *
129
+ * @param name name of the bool input to get
130
+ * @param required whether input is required. optional, defaults to false
131
+ * @returns boolean
132
+ */
133
+ export declare function getBoolInput(name: string, required?: boolean): boolean;
134
+ /**
135
+ * Gets the value of an input and splits the value using a delimiter (space, comma, etc).
136
+ * Empty values are removed. This function is useful for splitting an input containing a simple
137
+ * list of items - such as build targets.
138
+ * IMPORTANT: Do not use this function for splitting additional args! Instead use argString(), which
139
+ * follows normal argument splitting rules and handles values encapsulated by quotes.
140
+ * If required is true and the value is not set, it will throw.
141
+ *
142
+ * @param name name of the input to get
143
+ * @param delim delimiter to split on
144
+ * @param required whether input is required. optional, defaults to false
145
+ * @returns string[]
146
+ */
147
+ export declare function getDelimitedInput(name: string, delim: string | RegExp, required?: boolean): string[];
148
+ /**
149
+ * Checks whether a path inputs value was supplied by the user
150
+ * File paths are relative with a picker, so an empty path is the root of the repo.
151
+ * Useful if you need to condition work (like append an arg) if a value was supplied
152
+ *
153
+ * @param name name of the path input to check
154
+ * @returns boolean
155
+ */
156
+ export declare function filePathSupplied(name: string): boolean;
157
+ /**
158
+ * Gets the value of a path input
159
+ * It will be quoted for you if it isn't already and contains spaces
160
+ * If required is true and the value is not set, it will throw.
161
+ * If check is true and the path does not exist, it will throw.
162
+ *
163
+ * @param name name of the input to get
164
+ * @param required whether input is required. optional, defaults to false
165
+ * @param check whether path is checked. optional, defaults to false
166
+ * @returns string
167
+ */
168
+ export declare function getPathInput(name: string, required?: boolean, check?: boolean): string | undefined;
169
+ /**
170
+ * Gets the value of a path input
171
+ * It will be quoted for you if it isn't already and contains spaces
172
+ * If the value is not set, it will throw.
173
+ * If check is true and the path does not exist, it will throw.
174
+ *
175
+ * @param name name of the input to get
176
+ * @param check whether path is checked. optional, defaults to false
177
+ * @returns string
178
+ */
179
+ export declare function getPathInputRequired(name: string, check?: boolean): string;
180
+ /**
181
+ * Gets the url for a service endpoint
182
+ * If the url was not set and is not optional, it will throw.
183
+ *
184
+ * @param id name of the service endpoint
185
+ * @param optional whether the url is optional
186
+ * @returns string
187
+ */
188
+ export declare function getEndpointUrl(id: string, optional: boolean): string | undefined;
189
+ /**
190
+ * Gets the url for a service endpoint
191
+ * If the url was not set, it will throw.
192
+ *
193
+ * @param id name of the service endpoint
194
+ * @returns string
195
+ */
196
+ export declare function getEndpointUrlRequired(id: string): string;
197
+ export declare function getEndpointDataParameter(id: string, key: string, optional: boolean): string | undefined;
198
+ export declare function getEndpointDataParameterRequired(id: string, key: string): string;
199
+ /**
200
+ * Gets the endpoint authorization scheme for a service endpoint
201
+ * If the endpoint authorization scheme is not set and is not optional, it will throw.
202
+ *
203
+ * @param id name of the service endpoint
204
+ * @param optional whether the endpoint authorization scheme is optional
205
+ * @returns {string} value of the endpoint authorization scheme
206
+ */
207
+ export declare function getEndpointAuthorizationScheme(id: string, optional: boolean): string | undefined;
208
+ /**
209
+ * Gets the endpoint authorization scheme for a service endpoint
210
+ * If the endpoint authorization scheme is not set, it will throw.
211
+ *
212
+ * @param id name of the service endpoint
213
+ * @returns {string} value of the endpoint authorization scheme
214
+ */
215
+ export declare function getEndpointAuthorizationSchemeRequired(id: string): string;
216
+ /**
217
+ * Gets the endpoint authorization parameter value for a service endpoint with specified key
218
+ * If the endpoint authorization parameter is not set and is not optional, it will throw.
219
+ *
220
+ * @param id name of the service endpoint
221
+ * @param key key to find the endpoint authorization parameter
222
+ * @param optional optional whether the endpoint authorization scheme is optional
223
+ * @returns {string} value of the endpoint authorization parameter value
224
+ */
225
+ export declare function getEndpointAuthorizationParameter(id: string, key: string, optional: boolean): string | undefined;
226
+ /**
227
+ * Gets the endpoint authorization parameter value for a service endpoint with specified key
228
+ * If the endpoint authorization parameter is not set, it will throw.
229
+ *
230
+ * @param id name of the service endpoint
231
+ * @param key key to find the endpoint authorization parameter
232
+ * @returns {string} value of the endpoint authorization parameter value
233
+ */
234
+ export declare function getEndpointAuthorizationParameterRequired(id: string, key: string): string;
235
+ /**
236
+ * Interface for EndpointAuthorization
237
+ * Contains a schema and a string/string dictionary of auth data
238
+ */
239
+ export interface EndpointAuthorization {
240
+ /** dictionary of auth data */
241
+ parameters: {
242
+ [key: string]: string;
243
+ };
244
+ /** auth scheme such as OAuth or username/password etc... */
245
+ scheme: string;
246
+ }
247
+ /**
248
+ * Gets the authorization details for a service endpoint
249
+ * If the authorization was not set and is not optional, it will set the task result to Failed.
250
+ *
251
+ * @param id name of the service endpoint
252
+ * @param optional whether the url is optional
253
+ * @returns string
254
+ */
255
+ export declare function getEndpointAuthorization(id: string, optional: boolean): EndpointAuthorization | undefined;
256
+ /**
257
+ * Gets the name for a secure file
258
+ *
259
+ * @param id secure file id
260
+ * @returns string
261
+ */
262
+ export declare function getSecureFileName(id: string): string | undefined;
263
+ /**
264
+ * Gets the secure file ticket that can be used to download the secure file contents
265
+ *
266
+ * @param id name of the secure file
267
+ * @returns {string} secure file ticket
268
+ */
269
+ export declare function getSecureFileTicket(id: string): string | undefined;
270
+ /**
271
+ * Gets a variable value that is set by previous step from the same wrapper task.
272
+ * Requires a 2.115.0 agent or higher.
273
+ *
274
+ * @param name name of the variable to get
275
+ * @returns string
276
+ */
277
+ export declare function getTaskVariable(name: string): string | undefined;
278
+ /**
279
+ * Sets a task variable which will only be available to subsequent steps belong to the same wrapper task.
280
+ * Requires a 2.115.0 agent or higher.
281
+ *
282
+ * @param name name of the variable to set
283
+ * @param val value to set
284
+ * @param secret whether variable is secret. optional, defaults to false
285
+ * @returns void
286
+ */
287
+ export declare function setTaskVariable(name: string, val: string, secret?: boolean): void;
288
+ export declare const command: typeof im._command;
289
+ export declare const warning: typeof im._warning;
290
+ export declare const error: typeof im._error;
291
+ export declare const debug: typeof im._debug;
292
+ export interface FsStats extends fs.Stats {
293
+ }
294
+ /**
295
+ * Get's stat on a path.
296
+ * Useful for checking whether a file or directory. Also getting created, modified and accessed time.
297
+ * see [fs.stat](https://nodejs.org/api/fs.html#fs_class_fs_stats)
298
+ *
299
+ * @param path path to check
300
+ * @returns fsStat
301
+ */
302
+ export declare function stats(path: string): FsStats;
303
+ export declare const exist: typeof im._exist;
304
+ export declare function writeFile(file: string, data: string | Buffer, options?: BufferEncoding | fs.WriteFileOptions): void;
305
+ /**
306
+ * @deprecated Use `getPlatform`
307
+ * Useful for determining the host operating system.
308
+ * see [os.type](https://nodejs.org/api/os.html#os_os_type)
309
+ *
310
+ * @return the name of the operating system
311
+ */
312
+ export declare function osType(): string;
313
+ /**
314
+ * Determine the operating system the build agent is running on.
315
+ * @returns {Platform}
316
+ * @throws {Error} Platform is not supported by our agent
317
+ */
318
+ export declare function getPlatform(): Platform;
319
+ /**
320
+ * Return hosted type of Agent
321
+ * @returns {AgentHostedMode}
322
+ */
323
+ export declare function getAgentMode(): AgentHostedMode;
324
+ /**
325
+ * Returns the process's current working directory.
326
+ * see [process.cwd](https://nodejs.org/api/process.html#process_process_cwd)
327
+ *
328
+ * @return the path to the current working directory of the process
329
+ */
330
+ export declare function cwd(): string;
331
+ export declare const checkPath: typeof im._checkPath;
332
+ /**
333
+ * Change working directory.
334
+ *
335
+ * @param path new working directory path
336
+ * @returns void
337
+ */
338
+ export declare function cd(path: string): void;
339
+ /**
340
+ * Change working directory and push it on the stack
341
+ *
342
+ * @param path new working directory path
343
+ * @returns void
344
+ */
345
+ export declare function pushd(path: string): void;
346
+ /**
347
+ * Change working directory back to previously pushed directory
348
+ *
349
+ * @returns void
350
+ */
351
+ export declare function popd(): void;
352
+ /**
353
+ * Make a directory. Creates the full path with folders in between
354
+ * Will throw if it fails
355
+ *
356
+ * @param p path to create
357
+ * @returns void
358
+ */
359
+ export declare function mkdirP(p: string): void;
360
+ /**
361
+ * Resolves a sequence of paths or path segments into an absolute path.
362
+ * Calls node.js path.resolve()
363
+ * Allows L0 testing with consistent path formats on Mac/Linux and Windows in the mock implementation
364
+ * @param pathSegments
365
+ * @returns {string}
366
+ */
367
+ export declare function resolve(...pathSegments: any[]): string;
368
+ export declare const which: typeof im._which;
369
+ /**
370
+ * Returns array of files in the given path, or in current directory if no path provided. See shelljs.ls
371
+ * @param {string} options Available options: -R (recursive), -A (all files, include files beginning with ., except for . and ..)
372
+ * @param {string[]} paths Paths to search.
373
+ * @return {string[]} An array of files in the given path(s).
374
+ */
375
+ export declare function ls(options: string, paths: string[]): string[];
376
+ /**
377
+ * Copies a file or folder.
378
+ *
379
+ * @param source source path
380
+ * @param dest destination path
381
+ * @param options string -r, -f or -rf for recursive and force
382
+ * @param continueOnError optional. whether to continue on error
383
+ * @param retryCount optional. Retry count to copy the file. It might help to resolve intermittent issues e.g. with UNC target paths on a remote host.
384
+ */
385
+ export declare function cp(source: string, dest: string, options?: string, continueOnError?: boolean, retryCount?: number): void;
386
+ /**
387
+ * Moves a path.
388
+ *
389
+ * @param source source path
390
+ * @param dest destination path
391
+ * @param options string -f or -n for force and no clobber
392
+ * @param continueOnError optional. whether to continue on error
393
+ */
394
+ export declare function mv(source: string, dest: string, options?: string, continueOnError?: boolean): void;
395
+ /**
396
+ * Interface for FindOptions
397
+ * Contains properties to control whether to follow symlinks
398
+ */
399
+ export interface FindOptions {
400
+ /**
401
+ * When true, broken symbolic link will not cause an error.
402
+ */
403
+ allowBrokenSymbolicLinks: boolean;
404
+ /**
405
+ * Equivalent to the -H command line option. Indicates whether to traverse descendants if
406
+ * the specified path is a symbolic link directory. Does not cause nested symbolic link
407
+ * directories to be traversed.
408
+ */
409
+ followSpecifiedSymbolicLink: boolean;
410
+ /**
411
+ * Equivalent to the -L command line option. Indicates whether to traverse descendants of
412
+ * symbolic link directories.
413
+ */
414
+ followSymbolicLinks: boolean;
415
+ /**
416
+ * When true, missing files will not cause an error and will be skipped.
417
+ */
418
+ skipMissingFiles?: boolean;
419
+ }
420
+ /**
421
+ * Interface for RetryOptions
422
+ *
423
+ * Contains "continueOnError" and "retryCount" options.
424
+ */
425
+ export interface RetryOptions {
426
+ /**
427
+ * If true, code still continues to execute when all retries failed.
428
+ */
429
+ continueOnError: boolean;
430
+ /**
431
+ * Number of retries.
432
+ */
433
+ retryCount: number;
434
+ }
435
+ /**
436
+ * Tries to execute a function a specified number of times.
437
+ *
438
+ * @param func a function to be executed.
439
+ * @param args executed function arguments array.
440
+ * @param retryOptions optional. Defaults to { continueOnError: false, retryCount: 0 }.
441
+ * @returns the same as the usual function.
442
+ */
443
+ export declare function retry(func: Function, args: any[], retryOptions?: RetryOptions): any;
444
+ /**
445
+ * Recursively finds all paths a given path. Returns an array of paths.
446
+ *
447
+ * @param findPath path to search
448
+ * @param options optional. defaults to { followSymbolicLinks: true }. following soft links is generally appropriate unless deleting files.
449
+ * @returns string[]
450
+ */
451
+ export declare function find(findPath: string, options?: FindOptions): string[];
452
+ /**
453
+ * Prefer tl.find() and tl.match() instead. This function is for backward compatibility
454
+ * when porting tasks to Node from the PowerShell or PowerShell3 execution handler.
455
+ *
456
+ * @param rootDirectory path to root unrooted patterns with
457
+ * @param pattern include and exclude patterns
458
+ * @param includeFiles whether to include files in the result. defaults to true when includeFiles and includeDirectories are both false
459
+ * @param includeDirectories whether to include directories in the result
460
+ * @returns string[]
461
+ */
462
+ export declare function legacyFindFiles(rootDirectory: string, pattern: string, includeFiles?: boolean, includeDirectories?: boolean): string[];
463
+ /**
464
+ * Remove a path recursively with force
465
+ *
466
+ * @param inputPath path to remove
467
+ * @throws when the file or directory exists but could not be deleted.
468
+ */
469
+ export declare function rmRF(inputPath: string): void;
470
+ /**
471
+ * Exec a tool. Convenience wrapper over ToolRunner to exec with args in one call.
472
+ * Output will be streamed to the live console.
473
+ * Returns promise with return code
474
+ *
475
+ * @param tool path to tool to exec
476
+ * @param args an arg string or array of args
477
+ * @param options optional exec options. See IExecOptions
478
+ * @returns number
479
+ */
480
+ export declare function exec(tool: string, args: any, options?: trm.IExecOptions): Q.Promise<number>;
481
+ /**
482
+ * Exec a tool synchronously. Convenience wrapper over ToolRunner to execSync with args in one call.
483
+ * Output will be *not* be streamed to the live console. It will be returned after execution is complete.
484
+ * Appropriate for short running tools
485
+ * Returns IExecResult with output and return code
486
+ *
487
+ * @param tool path to tool to exec
488
+ * @param args an arg string or array of args
489
+ * @param options optional exec options. See IExecSyncOptions
490
+ * @returns IExecSyncResult
491
+ */
492
+ export declare function execSync(tool: string, args: string | string[], options?: trm.IExecSyncOptions): trm.IExecSyncResult;
493
+ /**
494
+ * Convenience factory to create a ToolRunner.
495
+ *
496
+ * @param tool path to tool to exec
497
+ * @returns ToolRunner
498
+ */
499
+ export declare function tool(tool: string): trm.ToolRunner;
500
+ export interface MatchOptions {
501
+ debug?: boolean;
502
+ nobrace?: boolean;
503
+ noglobstar?: boolean;
504
+ dot?: boolean;
505
+ noext?: boolean;
506
+ nocase?: boolean;
507
+ nonull?: boolean;
508
+ matchBase?: boolean;
509
+ nocomment?: boolean;
510
+ nonegate?: boolean;
511
+ flipNegate?: boolean;
512
+ }
513
+ /**
514
+ * Applies glob patterns to a list of paths. Supports interleaved exclude patterns.
515
+ *
516
+ * @param list array of paths
517
+ * @param patterns patterns to apply. supports interleaved exclude patterns.
518
+ * @param patternRoot optional. default root to apply to unrooted patterns. not applied to basename-only patterns when matchBase:true.
519
+ * @param options optional. defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }.
520
+ */
521
+ export declare function match(list: string[], patterns: string[] | string, patternRoot?: string, options?: MatchOptions): string[];
522
+ /**
523
+ * Filter to apply glob patterns
524
+ *
525
+ * @param pattern pattern to apply
526
+ * @param options optional. defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }.
527
+ */
528
+ export declare function filter(pattern: string, options?: MatchOptions): (element: string, indexed: number, array: string[]) => boolean;
529
+ /**
530
+ * Determines the find root from a list of patterns. Performs the find and then applies the glob patterns.
531
+ * Supports interleaved exclude patterns. Unrooted patterns are rooted using defaultRoot, unless
532
+ * matchOptions.matchBase is specified and the pattern is a basename only. For matchBase cases, the
533
+ * defaultRoot is used as the find root.
534
+ *
535
+ * @param defaultRoot default path to root unrooted patterns. falls back to System.DefaultWorkingDirectory or process.cwd().
536
+ * @param patterns pattern or array of patterns to apply
537
+ * @param findOptions defaults to { followSymbolicLinks: true }. following soft links is generally appropriate unless deleting files.
538
+ * @param matchOptions defaults to { dot: true, nobrace: true, nocase: process.platform == 'win32' }
539
+ */
540
+ export declare function findMatch(defaultRoot: string, patterns: string[] | string, findOptions?: FindOptions, matchOptions?: MatchOptions): string[];
541
+ export interface ProxyConfiguration {
542
+ proxyUrl: string;
543
+ /**
544
+ * Proxy URI formated as: protocol://username:password@hostname:port
545
+ *
546
+ * For tools that require setting proxy configuration in the single environment variable
547
+ */
548
+ proxyFormattedUrl: string;
549
+ proxyUsername?: string;
550
+ proxyPassword?: string;
551
+ proxyBypassHosts?: string[];
552
+ }
553
+ /**
554
+ * Gets http proxy configuration used by Build/Release agent
555
+ *
556
+ * @return ProxyConfiguration
557
+ */
558
+ export declare function getHttpProxyConfiguration(requestUrl?: string): ProxyConfiguration | null;
559
+ export interface CertConfiguration {
560
+ caFile?: string;
561
+ certFile?: string;
562
+ keyFile?: string;
563
+ certArchiveFile?: string;
564
+ passphrase?: string;
565
+ }
566
+ /**
567
+ * Gets http certificate configuration used by Build/Release agent
568
+ *
569
+ * @return CertConfiguration
570
+ */
571
+ export declare function getHttpCertConfiguration(): CertConfiguration | null;
572
+ export declare class TestPublisher {
573
+ testRunner: string;
574
+ constructor(testRunner: string);
575
+ publish(resultFiles?: string | string[], mergeResults?: string, platform?: string, config?: string, runTitle?: string, publishRunAttachments?: string, testRunSystem?: string): void;
576
+ }
577
+ export declare class CodeCoveragePublisher {
578
+ constructor();
579
+ publish(codeCoverageTool?: string, summaryFileLocation?: string, reportDirectory?: string, additionalCodeCoverageFiles?: string | string[]): void;
580
+ }
581
+ export declare class CodeCoverageEnabler {
582
+ private buildTool;
583
+ private ccTool;
584
+ constructor(buildTool: string, ccTool: string);
585
+ enableCodeCoverage(buildProps: {
586
+ [key: string]: string;
587
+ }): void;
588
+ }
589
+ /**
590
+ * Upload user interested file as additional log information
591
+ * to the current timeline record.
592
+ *
593
+ * The file shall be available for download along with task logs.
594
+ *
595
+ * @param path Path to the file that should be uploaded.
596
+ * @returns void
597
+ */
598
+ export declare function uploadFile(path: string): void;
599
+ /**
600
+ * Instruction for the agent to update the PATH environment variable.
601
+ * The specified directory is prepended to the PATH.
602
+ * The updated environment variable will be reflected in subsequent tasks.
603
+ *
604
+ * @param path Local directory path.
605
+ * @returns void
606
+ */
607
+ export declare function prependPath(path: string): void;
608
+ /**
609
+ * Upload and attach summary markdown to current timeline record.
610
+ * This summary shall be added to the build/release summary and
611
+ * not available for download with logs.
612
+ *
613
+ * @param path Local directory path.
614
+ * @returns void
615
+ */
616
+ export declare function uploadSummary(path: string): void;
617
+ /**
618
+ * Upload and attach attachment to current timeline record.
619
+ * These files are not available for download with logs.
620
+ * These can only be referred to by extensions using the type or name values.
621
+ *
622
+ * @param type Attachment type.
623
+ * @param name Attachment name.
624
+ * @param path Attachment path.
625
+ * @returns void
626
+ */
627
+ export declare function addAttachment(type: string, name: string, path: string): void;
628
+ /**
629
+ * Set an endpoint field with given value.
630
+ * Value updated will be retained in the endpoint for
631
+ * the subsequent tasks that execute within the same job.
632
+ *
633
+ * @param id Endpoint id.
634
+ * @param field FieldType enum of AuthParameter, DataParameter or Url.
635
+ * @param key Key.
636
+ * @param value Value for key or url.
637
+ * @returns void
638
+ */
639
+ export declare function setEndpoint(id: string, field: FieldType, key: string, value: string): void;
640
+ /**
641
+ * Set progress and current operation for current task.
642
+ *
643
+ * @param percent Percentage of completion.
644
+ * @param currentOperation Current pperation.
645
+ * @returns void
646
+ */
647
+ export declare function setProgress(percent: number, currentOperation: string): void;
648
+ /**
649
+ * Indicates whether to write the logging command directly to the host or to the output pipeline.
650
+ *
651
+ * @param id Timeline record Guid.
652
+ * @param parentId Parent timeline record Guid.
653
+ * @param recordType Record type.
654
+ * @param recordName Record name.
655
+ * @param order Order of timeline record.
656
+ * @param startTime Start time.
657
+ * @param finishTime End time.
658
+ * @param progress Percentage of completion.
659
+ * @param state TaskState enum of Unknown, Initialized, InProgress or Completed.
660
+ * @param result TaskResult enum of Succeeded, SucceededWithIssues, Failed, Cancelled or Skipped.
661
+ * @param message current operation
662
+ * @returns void
663
+ */
664
+ export declare function logDetail(id: string, message: string, parentId?: string, recordType?: string, recordName?: string, order?: number, startTime?: string, finishTime?: string, progress?: number, state?: TaskState, result?: TaskResult): void;
665
+ /**
666
+ * Log error or warning issue to timeline record of current task.
667
+ *
668
+ * @param type IssueType enum of Error or Warning.
669
+ * @param sourcePath Source file location.
670
+ * @param lineNumber Line number.
671
+ * @param columnNumber Column number.
672
+ * @param code Error or warning code.
673
+ * @param message Error or warning message.
674
+ * @returns void
675
+ */
676
+ export declare function logIssue(type: IssueType, message: string, sourcePath?: string, lineNumber?: number, columnNumber?: number, errorCode?: string): void;
677
+ /**
678
+ * Upload user interested file as additional log information
679
+ * to the current timeline record.
680
+ *
681
+ * The file shall be available for download along with task logs.
682
+ *
683
+ * @param containerFolder Folder that the file will upload to, folder will be created if needed.
684
+ * @param path Path to the file that should be uploaded.
685
+ * @param name Artifact name.
686
+ * @returns void
687
+ */
688
+ export declare function uploadArtifact(containerFolder: string, path: string, name?: string): void;
689
+ /**
690
+ * Create an artifact link, artifact location is required to be
691
+ * a file container path, VC path or UNC share path.
692
+ *
693
+ * The file shall be available for download along with task logs.
694
+ *
695
+ * @param name Artifact name.
696
+ * @param path Path to the file that should be associated.
697
+ * @param artifactType ArtifactType enum of Container, FilePath, VersionControl, GitRef or TfvcLabel.
698
+ * @returns void
699
+ */
700
+ export declare function associateArtifact(name: string, path: string, artifactType: ArtifactType): void;
701
+ /**
702
+ * Upload user interested log to build’s container “logs\tool” folder.
703
+ *
704
+ * @param path Path to the file that should be uploaded.
705
+ * @returns void
706
+ */
707
+ export declare function uploadBuildLog(path: string): void;
708
+ /**
709
+ * Update build number for current build.
710
+ *
711
+ * @param value Value to be assigned as the build number.
712
+ * @returns void
713
+ */
714
+ export declare function updateBuildNumber(value: string): void;
715
+ /**
716
+ * Add a tag for current build.
717
+ *
718
+ * @param value Tag value.
719
+ * @returns void
720
+ */
721
+ export declare function addBuildTag(value: string): void;
722
+ /**
723
+ * Update release name for current release.
724
+ *
725
+ * @param value Value to be assigned as the release name.
726
+ * @returns void
727
+ */
728
+ export declare function updateReleaseName(name: string): void;