artifact-engine 1.2.0 → 1.3.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/Engine/artifactEngine.d.ts +12 -12
- package/Engine/artifactEngine.js +166 -166
- package/Engine/artifactEngineOptions.d.ts +8 -8
- package/Engine/artifactEngineOptions.js +13 -15
- package/Engine/cilogger.d.ts +6 -6
- package/Engine/cilogger.js +44 -46
- package/Engine/index.d.ts +2 -2
- package/Engine/index.js +6 -8
- package/Engine/logger.d.ts +13 -13
- package/Engine/logger.js +109 -112
- package/Engine/worker.d.ts +10 -10
- package/Engine/worker.js +49 -51
- package/Models/artifactDownloadTicket.d.ts +11 -11
- package/Models/artifactDownloadTicket.js +5 -7
- package/Models/artifactItem.d.ts +12 -12
- package/Models/artifactItem.js +8 -10
- package/Models/artifactprovider.d.ts +10 -11
- package/Models/artifactprovider.js +2 -3
- package/Models/constants.d.ts +3 -3
- package/Models/constants.js +6 -8
- package/Models/index.d.ts +6 -6
- package/Models/index.js +12 -14
- package/Models/itemType.d.ts +5 -5
- package/Models/itemType.js +8 -10
- package/Models/ticketState.d.ts +7 -7
- package/Models/ticketState.js +10 -12
- package/Providers/filesystemProvider.d.ts +14 -15
- package/Providers/filesystemProvider.js +123 -123
- package/Providers/index.d.ts +4 -4
- package/Providers/index.js +10 -12
- package/Providers/stubProvider.d.ts +20 -21
- package/Providers/stubProvider.js +85 -88
- package/Providers/typed-rest-client/Handlers.d.ts +4 -4
- package/Providers/typed-rest-client/Handlers.js +10 -12
- package/Providers/typed-rest-client/HttpClient.d.ts +84 -77
- package/Providers/typed-rest-client/HttpClient.js +351 -328
- package/Providers/typed-rest-client/Index.d.ts +0 -1
- package/Providers/typed-rest-client/Index.js +2 -3
- package/Providers/typed-rest-client/Interfaces.d.ts +38 -38
- package/Providers/typed-rest-client/Interfaces.js +3 -4
- package/Providers/typed-rest-client/RestClient.d.ts +73 -27
- package/Providers/typed-rest-client/RestClient.js +186 -134
- package/Providers/typed-rest-client/Util.d.ts +7 -1
- package/Providers/typed-rest-client/Util.js +24 -18
- package/Providers/typed-rest-client/handlers/basiccreds.d.ts +9 -9
- package/Providers/typed-rest-client/handlers/basiccreds.js +23 -20
- package/Providers/typed-rest-client/handlers/bearertoken.d.ts +8 -8
- package/Providers/typed-rest-client/handlers/bearertoken.js +22 -19
- package/Providers/typed-rest-client/handlers/ntlm.d.ts +13 -13
- package/Providers/typed-rest-client/handlers/ntlm.js +115 -96
- package/Providers/typed-rest-client/handlers/personalaccesstoken.d.ts +8 -8
- package/Providers/typed-rest-client/handlers/personalaccesstoken.js +22 -19
- package/Providers/typed-rest-client/opensource/node-http-ntlm/readme.txt +6 -0
- package/Providers/webClient.d.ts +8 -8
- package/Providers/webClient.js +60 -60
- package/Providers/webClientFactory.d.ts +5 -5
- package/Providers/webClientFactory.js +59 -55
- package/Providers/webProvider.d.ts +21 -22
- package/Providers/webProvider.js +120 -116
- package/Providers/zipProvider.d.ts +15 -16
- package/Providers/zipProvider.js +53 -55
- package/Store/artifactItemStore.d.ts +18 -18
- package/Store/artifactItemStore.js +94 -96
- package/Store/index.d.ts +1 -1
- package/Store/index.js +4 -6
- package/Strings/resources.resjson/de-DE/resources.resjson +11 -11
- package/Strings/resources.resjson/en-US/resources.resjson +11 -11
- package/Strings/resources.resjson/es-ES/resources.resjson +11 -11
- package/Strings/resources.resjson/fr-FR/resources.resjson +11 -11
- package/Strings/resources.resjson/it-IT/resources.resjson +11 -11
- package/Strings/resources.resjson/ja-JP/resources.resjson +11 -11
- package/Strings/resources.resjson/ko-KR/resources.resjson +11 -11
- package/Strings/resources.resjson/ru-RU/resources.resjson +11 -11
- package/Strings/resources.resjson/zh-CN/resources.resjson +11 -11
- package/Strings/resources.resjson/zh-TW/resources.resjson +11 -11
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as models from '../Models';
|
|
2
|
-
import { ArtifactEngineOptions } from "./artifactEngineOptions";
|
|
3
|
-
export declare class ArtifactEngine {
|
|
4
|
-
processItems(sourceProvider: models.IArtifactProvider, destProvider: models.IArtifactProvider, artifactEngineOptions?: ArtifactEngineOptions): Promise<models.ArtifactDownloadTicket[]>;
|
|
5
|
-
processArtifactItem(sourceProvider: models.IArtifactProvider, item: models.ArtifactItem, destProvider: models.IArtifactProvider, artifactEngineOptions: ArtifactEngineOptions): Promise<void>;
|
|
6
|
-
processArtifactItemImplementation(sourceProvider: models.IArtifactProvider, item: models.ArtifactItem, destProvider: models.IArtifactProvider, artifactEngineOptions: ArtifactEngineOptions, resolve: any, reject: any, retryCount?: number): void;
|
|
7
|
-
private getRetryIntervalInSeconds;
|
|
8
|
-
createPatternList(artifactEngineOptions: ArtifactEngineOptions): void;
|
|
9
|
-
private artifactItemStore;
|
|
10
|
-
private logger;
|
|
11
|
-
private patternList;
|
|
12
|
-
}
|
|
1
|
+
import * as models from '../Models';
|
|
2
|
+
import { ArtifactEngineOptions } from "./artifactEngineOptions";
|
|
3
|
+
export declare class ArtifactEngine {
|
|
4
|
+
processItems(sourceProvider: models.IArtifactProvider, destProvider: models.IArtifactProvider, artifactEngineOptions?: ArtifactEngineOptions): Promise<models.ArtifactDownloadTicket[]>;
|
|
5
|
+
processArtifactItem(sourceProvider: models.IArtifactProvider, item: models.ArtifactItem, destProvider: models.IArtifactProvider, artifactEngineOptions: ArtifactEngineOptions): Promise<void>;
|
|
6
|
+
processArtifactItemImplementation(sourceProvider: models.IArtifactProvider, item: models.ArtifactItem, destProvider: models.IArtifactProvider, artifactEngineOptions: ArtifactEngineOptions, resolve: any, reject: any, retryCount?: number): void;
|
|
7
|
+
private getRetryIntervalInSeconds(baseRetryInterval, retryCount);
|
|
8
|
+
createPatternList(artifactEngineOptions: ArtifactEngineOptions): void;
|
|
9
|
+
private artifactItemStore;
|
|
10
|
+
private logger;
|
|
11
|
+
private patternList;
|
|
12
|
+
}
|
package/Engine/artifactEngine.js
CHANGED
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.logger
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this.artifactItemStore.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
var tl = require('azure-pipelines-task-lib/task');
|
|
5
|
+
const models = require("../Models");
|
|
6
|
+
const ci = require("./cilogger");
|
|
7
|
+
const artifactItemStore_1 = require("../Store/artifactItemStore");
|
|
8
|
+
const artifactEngineOptions_1 = require("./artifactEngineOptions");
|
|
9
|
+
const logger_1 = require("./logger");
|
|
10
|
+
const worker_1 = require("./worker");
|
|
11
|
+
class ArtifactEngine {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.artifactItemStore = new artifactItemStore_1.ArtifactItemStore();
|
|
14
|
+
}
|
|
15
|
+
processItems(sourceProvider, destProvider, artifactEngineOptions) {
|
|
16
|
+
var artifactDownloadTicketsPromise = new Promise((resolve, reject) => {
|
|
17
|
+
const workers = [];
|
|
18
|
+
artifactEngineOptions = artifactEngineOptions || new artifactEngineOptions_1.ArtifactEngineOptions();
|
|
19
|
+
this.createPatternList(artifactEngineOptions);
|
|
20
|
+
this.artifactItemStore.flush();
|
|
21
|
+
logger_1.Logger.verbose = artifactEngineOptions.verbose;
|
|
22
|
+
this.logger = new logger_1.Logger(this.artifactItemStore);
|
|
23
|
+
this.logger.logProgress();
|
|
24
|
+
sourceProvider.artifactItemStore = this.artifactItemStore;
|
|
25
|
+
destProvider.artifactItemStore = this.artifactItemStore;
|
|
26
|
+
sourceProvider.getRootItems().then((itemsToProcess) => {
|
|
27
|
+
this.artifactItemStore.addItems(itemsToProcess);
|
|
28
|
+
for (let i = 0; i < artifactEngineOptions.parallelProcessingLimit; ++i) {
|
|
29
|
+
var worker = new worker_1.Worker(i + 1, item => this.processArtifactItem(sourceProvider, item, destProvider, artifactEngineOptions), () => this.artifactItemStore.getNextItemToProcess(), () => !this.artifactItemStore.itemsPendingProcessing(), () => this.artifactItemStore.hasDownloadFailed());
|
|
30
|
+
workers.push(worker.init());
|
|
31
|
+
}
|
|
32
|
+
Promise.all(workers).then(() => {
|
|
33
|
+
this.logger.logSummary();
|
|
34
|
+
sourceProvider.dispose();
|
|
35
|
+
destProvider.dispose();
|
|
36
|
+
resolve(this.artifactItemStore.getTickets());
|
|
37
|
+
}, (err) => {
|
|
38
|
+
ci.publishEvent('reliability', { issueType: 'error', errorMessage: JSON.stringify(err, Object.getOwnPropertyNames(err)) });
|
|
39
|
+
sourceProvider.dispose();
|
|
40
|
+
destProvider.dispose();
|
|
41
|
+
reject(err);
|
|
42
|
+
});
|
|
43
|
+
}, (err) => {
|
|
44
|
+
ci.publishEvent('reliability', { issueType: 'error', errorMessage: JSON.stringify(err, Object.getOwnPropertyNames(err)) });
|
|
45
|
+
sourceProvider.dispose();
|
|
46
|
+
destProvider.dispose();
|
|
47
|
+
reject(err);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
return artifactDownloadTicketsPromise;
|
|
51
|
+
}
|
|
52
|
+
processArtifactItem(sourceProvider, item, destProvider, artifactEngineOptions) {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
this.processArtifactItemImplementation(sourceProvider, item, destProvider, artifactEngineOptions, resolve, reject);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
processArtifactItemImplementation(sourceProvider, item, destProvider, artifactEngineOptions, resolve, reject, retryCount) {
|
|
58
|
+
var retryIfRequired = (err) => {
|
|
59
|
+
if (retryCount === artifactEngineOptions.retryLimit - 1) {
|
|
60
|
+
this.artifactItemStore.updateState(item, models.TicketState.Failed);
|
|
61
|
+
reject(err);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.artifactItemStore.increaseRetryCount(item);
|
|
65
|
+
logger_1.Logger.logMessage(tl.loc("RetryingDownload", item.path, (retryCount + 1)));
|
|
66
|
+
// retry interval sequence 5s 15s 45s 135s
|
|
67
|
+
// 2 min is the time limit for freeing of ports
|
|
68
|
+
setTimeout(() => this
|
|
69
|
+
.processArtifactItemImplementation(sourceProvider, item, destProvider, artifactEngineOptions, resolve, reject, retryCount + 1), this.getRetryIntervalInSeconds(artifactEngineOptions.retryIntervalInSeconds, retryCount) * 1000);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
retryCount = retryCount ? retryCount : 0;
|
|
73
|
+
if (item.itemType === models.ItemType.File) {
|
|
74
|
+
var pathToMatch = item.path.replace(/\\/g, '/');
|
|
75
|
+
var matchOptions = {
|
|
76
|
+
debug: false,
|
|
77
|
+
nobrace: true,
|
|
78
|
+
noglobstar: false,
|
|
79
|
+
dot: true,
|
|
80
|
+
noext: false,
|
|
81
|
+
nocase: false,
|
|
82
|
+
nonull: false,
|
|
83
|
+
matchBase: false,
|
|
84
|
+
nocomment: false,
|
|
85
|
+
nonegate: false,
|
|
86
|
+
flipNegate: false
|
|
87
|
+
};
|
|
88
|
+
if (tl.match([pathToMatch], this.patternList, null, matchOptions).length > 0) {
|
|
89
|
+
logger_1.Logger.logInfo("Processing " + item.path);
|
|
90
|
+
sourceProvider.getArtifactItem(item).then((contentStream) => {
|
|
91
|
+
logger_1.Logger.logInfo("Got download stream for item: " + item.path);
|
|
92
|
+
destProvider.putArtifactItem(item, contentStream)
|
|
93
|
+
.then((item) => {
|
|
94
|
+
this.artifactItemStore.updateState(item, models.TicketState.Processed);
|
|
95
|
+
resolve();
|
|
96
|
+
}, (err) => {
|
|
97
|
+
logger_1.Logger.logInfo("Error placing file " + item.path + ": " + err);
|
|
98
|
+
retryIfRequired(err);
|
|
99
|
+
});
|
|
100
|
+
}, (err) => {
|
|
101
|
+
logger_1.Logger.logInfo("Error getting file " + item.path + ": " + err);
|
|
102
|
+
retryIfRequired(err);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
logger_1.Logger.logMessage(tl.loc("SkippingItem", pathToMatch));
|
|
107
|
+
this.artifactItemStore.updateState(item, models.TicketState.Skipped);
|
|
108
|
+
resolve();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
sourceProvider.getArtifactItems(item).then((items) => {
|
|
113
|
+
items = items.map((value, index) => {
|
|
114
|
+
if (!value.path.toLowerCase().startsWith(item.path.toLowerCase())) {
|
|
115
|
+
value.path = path.join(item.path, value.path);
|
|
116
|
+
}
|
|
117
|
+
return value;
|
|
118
|
+
});
|
|
119
|
+
if (items.length > 0) {
|
|
120
|
+
this.artifactItemStore.addItems(items);
|
|
121
|
+
this.artifactItemStore.updateState(item, models.TicketState.Processed);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
destProvider.putArtifactItem(item, null)
|
|
125
|
+
.then((item) => {
|
|
126
|
+
this.artifactItemStore.updateState(item, models.TicketState.Processed);
|
|
127
|
+
resolve();
|
|
128
|
+
}, (err) => {
|
|
129
|
+
logger_1.Logger.logInfo("Error creating folder " + item.path + ": " + err);
|
|
130
|
+
retryIfRequired(err);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
logger_1.Logger.logInfo("Enqueued " + items.length + " for processing.");
|
|
134
|
+
resolve();
|
|
135
|
+
}, (err) => {
|
|
136
|
+
logger_1.Logger.logInfo("Error getting " + item.path + ":" + err);
|
|
137
|
+
retryIfRequired(err);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
getRetryIntervalInSeconds(baseRetryInterval, retryCount) {
|
|
142
|
+
let MaxRetryLimitInSeconds = 360;
|
|
143
|
+
var exponentialBackOff = baseRetryInterval * Math.pow(3, (retryCount + 1));
|
|
144
|
+
return exponentialBackOff < MaxRetryLimitInSeconds ? exponentialBackOff : MaxRetryLimitInSeconds;
|
|
145
|
+
}
|
|
146
|
+
createPatternList(artifactEngineOptions) {
|
|
147
|
+
if (!artifactEngineOptions.itemPattern) {
|
|
148
|
+
this.patternList = ['**'];
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.patternList = artifactEngineOptions.itemPattern.split('\n');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.ArtifactEngine = ArtifactEngine;
|
|
156
|
+
tl.setResourcePath(path.join(path.dirname(__dirname), 'lib.json'));
|
|
157
|
+
process.on('unhandledRejection', (err) => {
|
|
158
|
+
ci.publishEvent('reliability', { issueType: 'unhandledRejection', errorMessage: JSON.stringify(err, Object.getOwnPropertyNames(err)) });
|
|
159
|
+
logger_1.Logger.logError(tl.loc("UnhandledRejection", err));
|
|
160
|
+
throw err;
|
|
161
|
+
});
|
|
162
|
+
process.on('uncaughtException', (err) => {
|
|
163
|
+
ci.publishEvent('reliability', { issueType: 'uncaughtException', errorMessage: JSON.stringify(err, Object.getOwnPropertyNames(err)) });
|
|
164
|
+
logger_1.Logger.logError(tl.loc("UnhandledException", err));
|
|
165
|
+
throw err;
|
|
166
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare class ArtifactEngineOptions {
|
|
2
|
-
retryLimit: number;
|
|
3
|
-
retryIntervalInSeconds: number;
|
|
4
|
-
fileProcessingTimeoutInMinutes: number;
|
|
5
|
-
parallelProcessingLimit: number;
|
|
6
|
-
itemPattern: string;
|
|
7
|
-
verbose: boolean;
|
|
8
|
-
}
|
|
1
|
+
export declare class ArtifactEngineOptions {
|
|
2
|
+
retryLimit: number;
|
|
3
|
+
retryIntervalInSeconds: number;
|
|
4
|
+
fileProcessingTimeoutInMinutes: number;
|
|
5
|
+
parallelProcessingLimit: number;
|
|
6
|
+
itemPattern: string;
|
|
7
|
+
verbose: boolean;
|
|
8
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.ArtifactEngineOptions = ArtifactEngineOptions;
|
|
15
|
-
//# sourceMappingURL=artifactEngineOptions.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class ArtifactEngineOptions {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.retryLimit = 5;
|
|
6
|
+
this.retryIntervalInSeconds = 5;
|
|
7
|
+
this.fileProcessingTimeoutInMinutes = 5;
|
|
8
|
+
this.parallelProcessingLimit = 4;
|
|
9
|
+
this.itemPattern = '**';
|
|
10
|
+
this.verbose = false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ArtifactEngineOptions = ArtifactEngineOptions;
|
package/Engine/cilogger.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare function publishEvent(feature: any, properties: any | IReliabilityData): void;
|
|
2
|
-
export interface IReliabilityData {
|
|
3
|
-
issueType: string;
|
|
4
|
-
errorMessage: string;
|
|
5
|
-
stack: string;
|
|
6
|
-
}
|
|
1
|
+
export declare function publishEvent(feature: any, properties: any | IReliabilityData): void;
|
|
2
|
+
export interface IReliabilityData {
|
|
3
|
+
issueType: string;
|
|
4
|
+
errorMessage: string;
|
|
5
|
+
stack: string;
|
|
6
|
+
}
|
package/Engine/cilogger.js
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
exports.publishEvent = publishEvent;
|
|
46
|
-
//# sourceMappingURL=cilogger.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tl = require('azure-pipelines-task-lib');
|
|
4
|
+
var packagejson = require('../package.json');
|
|
5
|
+
const area = 'artifact-engine';
|
|
6
|
+
function getDefaultProps() {
|
|
7
|
+
var hostType = (tl.getVariable('SYSTEM.HOSTTYPE') || "").toLowerCase();
|
|
8
|
+
var isReleaseHost = hostType === 'release' || hostType === "deployment";
|
|
9
|
+
return {
|
|
10
|
+
hostType: hostType,
|
|
11
|
+
definitionName: '[NonEmail:' + (isReleaseHost ? tl.getVariable('RELEASE.DEFINITIONNAME') : tl.getVariable('BUILD.DEFINITIONNAME')) + ']',
|
|
12
|
+
processId: isReleaseHost ? tl.getVariable('RELEASE.RELEASEID') : tl.getVariable('BUILD.BUILDID'),
|
|
13
|
+
processUrl: isReleaseHost ? tl.getVariable('RELEASE.RELEASEWEBURL') : (tl.getVariable('SYSTEM.TEAMFOUNDATIONSERVERURI') + tl.getVariable('SYSTEM.TEAMPROJECT') + '/_build?buildId=' + tl.getVariable('BUILD.BUILDID')),
|
|
14
|
+
taskDisplayName: tl.getVariable('TASK.DISPLAYNAME'),
|
|
15
|
+
jobid: tl.getVariable('SYSTEM.JOBID'),
|
|
16
|
+
agentVersion: tl.getVariable('AGENT.VERSION'),
|
|
17
|
+
agentOS: tl.getVariable('AGENT.OS'),
|
|
18
|
+
agentName: tl.getVariable('AGENT.NAME'),
|
|
19
|
+
version: packagejson.version
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function publishEvent(feature, properties) {
|
|
23
|
+
try {
|
|
24
|
+
var splitVersion = (process.env.AGENT_VERSION || '').split('.');
|
|
25
|
+
var major = parseInt(splitVersion[0] || '0');
|
|
26
|
+
var minor = parseInt(splitVersion[1] || '0');
|
|
27
|
+
let telemetry = '';
|
|
28
|
+
if (major > 2 || (major == 2 && minor >= 120)) {
|
|
29
|
+
telemetry = `##vso[telemetry.publish area=${area};feature=${feature}]${JSON.stringify(Object.assign(getDefaultProps(), properties))}`;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (feature === 'reliability') {
|
|
33
|
+
let reliabilityData = properties;
|
|
34
|
+
telemetry = "##vso[task.logissue type=error;code=" + reliabilityData.issueType + ";agentVersion=" + tl.getVariable('Agent.Version') + ";taskId=" + area + "-" + packagejson.version + ";]" + reliabilityData.errorMessage;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
console.log(telemetry);
|
|
38
|
+
;
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
tl.warning("Failed to log telemetry, error: " + err);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.publishEvent = publishEvent;
|
package/Engine/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ArtifactEngineOptions } from "./artifactEngineOptions";
|
|
2
|
-
export { ArtifactEngine } from "./artifactEngine";
|
|
1
|
+
export { ArtifactEngineOptions } from "./artifactEngineOptions";
|
|
2
|
+
export { ArtifactEngine } from "./artifactEngine";
|
package/Engine/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "ArtifactEngine", { enumerable: true, get: function () { return artifactEngine_1.ArtifactEngine; } });
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var artifactEngineOptions_1 = require("./artifactEngineOptions");
|
|
4
|
+
exports.ArtifactEngineOptions = artifactEngineOptions_1.ArtifactEngineOptions;
|
|
5
|
+
var artifactEngine_1 = require("./artifactEngine");
|
|
6
|
+
exports.ArtifactEngine = artifactEngine_1.ArtifactEngine;
|
package/Engine/logger.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ArtifactItemStore } from '../Store/artifactItemStore';
|
|
2
|
-
export declare class Logger {
|
|
3
|
-
constructor(store: ArtifactItemStore);
|
|
4
|
-
static logInfo(message: string): void;
|
|
5
|
-
static logError(message: string): void;
|
|
6
|
-
static logMessage(message: string): void;
|
|
7
|
-
logProgress(): void;
|
|
8
|
-
logSummary(): void;
|
|
9
|
-
private padText;
|
|
10
|
-
static verbose: boolean;
|
|
11
|
-
private store;
|
|
12
|
-
private startTime;
|
|
13
|
-
}
|
|
1
|
+
import { ArtifactItemStore } from '../Store/artifactItemStore';
|
|
2
|
+
export declare class Logger {
|
|
3
|
+
constructor(store: ArtifactItemStore);
|
|
4
|
+
static logInfo(message: string): void;
|
|
5
|
+
static logError(message: string): void;
|
|
6
|
+
static logMessage(message: string): void;
|
|
7
|
+
logProgress(): void;
|
|
8
|
+
logSummary(): void;
|
|
9
|
+
private padText(textToPad, maxTextLength, padChar?);
|
|
10
|
+
static verbose: boolean;
|
|
11
|
+
private store;
|
|
12
|
+
private startTime;
|
|
13
|
+
}
|