@actions/artifact 0.5.0 → 0.6.1

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.
Files changed (47) hide show
  1. package/LICENSE.md +8 -8
  2. package/README.md +213 -213
  3. package/lib/artifact-client.d.ts +10 -10
  4. package/lib/artifact-client.js +10 -10
  5. package/lib/internal/artifact-client.d.ts +41 -41
  6. package/lib/internal/artifact-client.js +164 -148
  7. package/lib/internal/artifact-client.js.map +1 -1
  8. package/lib/internal/config-variables.d.ts +11 -11
  9. package/lib/internal/config-variables.js +70 -70
  10. package/lib/internal/contracts.d.ts +67 -57
  11. package/lib/internal/contracts.js +2 -2
  12. package/lib/internal/download-http-client.d.ts +39 -39
  13. package/lib/internal/download-http-client.js +271 -274
  14. package/lib/internal/download-http-client.js.map +1 -1
  15. package/lib/internal/download-options.d.ts +7 -7
  16. package/lib/internal/download-options.js +2 -2
  17. package/lib/internal/download-response.d.ts +10 -10
  18. package/lib/internal/download-response.js +2 -2
  19. package/lib/internal/download-specification.d.ts +19 -19
  20. package/lib/internal/download-specification.js +60 -60
  21. package/lib/internal/http-manager.d.ts +12 -12
  22. package/lib/internal/http-manager.js +30 -30
  23. package/lib/internal/path-and-artifact-name-validation.d.ts +8 -0
  24. package/lib/internal/path-and-artifact-name-validation.js +66 -0
  25. package/lib/internal/path-and-artifact-name-validation.js.map +1 -0
  26. package/lib/internal/requestUtils.d.ts +3 -3
  27. package/lib/internal/requestUtils.js +74 -74
  28. package/lib/internal/status-reporter.d.ts +21 -22
  29. package/lib/internal/status-reporter.js +50 -63
  30. package/lib/internal/status-reporter.js.map +1 -1
  31. package/lib/internal/upload-gzip.d.ts +14 -14
  32. package/lib/internal/upload-gzip.js +107 -88
  33. package/lib/internal/upload-gzip.js.map +1 -1
  34. package/lib/internal/upload-http-client.d.ts +48 -48
  35. package/lib/internal/upload-http-client.js +393 -378
  36. package/lib/internal/upload-http-client.js.map +1 -1
  37. package/lib/internal/upload-options.d.ts +34 -34
  38. package/lib/internal/upload-options.js +2 -2
  39. package/lib/internal/upload-response.d.ts +19 -19
  40. package/lib/internal/upload-response.js +2 -2
  41. package/lib/internal/upload-specification.d.ts +11 -11
  42. package/lib/internal/upload-specification.js +87 -87
  43. package/lib/internal/upload-specification.js.map +1 -1
  44. package/lib/internal/utils.d.ts +66 -74
  45. package/lib/internal/utils.js +262 -303
  46. package/lib/internal/utils.js.map +1 -1
  47. package/package.json +49 -49
@@ -1,275 +1,272 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importStar = (this && this.__importStar) || function (mod) {
12
- if (mod && mod.__esModule) return mod;
13
- var result = {};
14
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15
- result["default"] = mod;
16
- return result;
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- const fs = __importStar(require("fs"));
20
- const core = __importStar(require("@actions/core"));
21
- const zlib = __importStar(require("zlib"));
22
- const utils_1 = require("./utils");
23
- const url_1 = require("url");
24
- const status_reporter_1 = require("./status-reporter");
25
- const perf_hooks_1 = require("perf_hooks");
26
- const http_manager_1 = require("./http-manager");
27
- const config_variables_1 = require("./config-variables");
28
- const requestUtils_1 = require("./requestUtils");
29
- class DownloadHttpClient {
30
- constructor() {
31
- this.downloadHttpManager = new http_manager_1.HttpManager(config_variables_1.getDownloadFileConcurrency(), '@actions/artifact-download');
32
- // downloads are usually significantly faster than uploads so display status information every second
33
- this.statusReporter = new status_reporter_1.StatusReporter(1000);
34
- }
35
- /**
36
- * Gets a list of all artifacts that are in a specific container
37
- */
38
- listArtifacts() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const artifactUrl = utils_1.getArtifactUrl();
41
- // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
42
- const client = this.downloadHttpManager.getClient(0);
43
- const headers = utils_1.getDownloadHeaders('application/json');
44
- const response = yield requestUtils_1.retryHttpClientRequest('List Artifacts', () => __awaiter(this, void 0, void 0, function* () { return client.get(artifactUrl, headers); }));
45
- const body = yield response.readBody();
46
- return JSON.parse(body);
47
- });
48
- }
49
- /**
50
- * Fetches a set of container items that describe the contents of an artifact
51
- * @param artifactName the name of the artifact
52
- * @param containerUrl the artifact container URL for the run
53
- */
54
- getContainerItems(artifactName, containerUrl) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- // the itemPath search parameter controls which containers will be returned
57
- const resourceUrl = new url_1.URL(containerUrl);
58
- resourceUrl.searchParams.append('itemPath', artifactName);
59
- // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
60
- const client = this.downloadHttpManager.getClient(0);
61
- const headers = utils_1.getDownloadHeaders('application/json');
62
- const response = yield requestUtils_1.retryHttpClientRequest('Get Container Items', () => __awaiter(this, void 0, void 0, function* () { return client.get(resourceUrl.toString(), headers); }));
63
- const body = yield response.readBody();
64
- return JSON.parse(body);
65
- });
66
- }
67
- /**
68
- * Concurrently downloads all the files that are part of an artifact
69
- * @param downloadItems information about what items to download and where to save them
70
- */
71
- downloadSingleArtifact(downloadItems) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- const DOWNLOAD_CONCURRENCY = config_variables_1.getDownloadFileConcurrency();
74
- // limit the number of files downloaded at a single time
75
- core.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`);
76
- const parallelDownloads = [...new Array(DOWNLOAD_CONCURRENCY).keys()];
77
- let currentFile = 0;
78
- let downloadedFiles = 0;
79
- core.info(`Total number of files that will be downloaded: ${downloadItems.length}`);
80
- this.statusReporter.setTotalNumberOfFilesToProcess(downloadItems.length);
81
- this.statusReporter.start();
82
- yield Promise.all(parallelDownloads.map((index) => __awaiter(this, void 0, void 0, function* () {
83
- while (currentFile < downloadItems.length) {
84
- const currentFileToDownload = downloadItems[currentFile];
85
- currentFile += 1;
86
- const startTime = perf_hooks_1.performance.now();
87
- yield this.downloadIndividualFile(index, currentFileToDownload.sourceLocation, currentFileToDownload.targetPath);
88
- if (core.isDebug()) {
89
- core.debug(`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish downloading`);
90
- }
91
- this.statusReporter.incrementProcessedCount();
92
- }
93
- })))
94
- .catch(error => {
95
- throw new Error(`Unable to download the artifact: ${error}`);
96
- })
97
- .finally(() => {
98
- this.statusReporter.stop();
99
- // safety dispose all connections
100
- this.downloadHttpManager.disposeAndReplaceAllClients();
101
- });
102
- });
103
- }
104
- /**
105
- * Downloads an individual file
106
- * @param httpClientIndex the index of the http client that is used to make all of the calls
107
- * @param artifactLocation origin location where a file will be downloaded from
108
- * @param downloadPath destination location for the file being downloaded
109
- */
110
- downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath) {
111
- return __awaiter(this, void 0, void 0, function* () {
112
- let retryCount = 0;
113
- const retryLimit = config_variables_1.getRetryLimit();
114
- let destinationStream = fs.createWriteStream(downloadPath);
115
- const headers = utils_1.getDownloadHeaders('application/json', true, true);
116
- // a single GET request is used to download a file
117
- const makeDownloadRequest = () => __awaiter(this, void 0, void 0, function* () {
118
- const client = this.downloadHttpManager.getClient(httpClientIndex);
119
- return yield client.get(artifactLocation, headers);
120
- });
121
- // check the response headers to determine if the file was compressed using gzip
122
- const isGzip = (incomingHeaders) => {
123
- return ('content-encoding' in incomingHeaders &&
124
- incomingHeaders['content-encoding'] === 'gzip');
125
- };
126
- // Increments the current retry count and then checks if the retry limit has been reached
127
- // If there have been too many retries, fail so the download stops. If there is a retryAfterValue value provided,
128
- // it will be used
129
- const backOff = (retryAfterValue) => __awaiter(this, void 0, void 0, function* () {
130
- retryCount++;
131
- if (retryCount > retryLimit) {
132
- return Promise.reject(new Error(`Retry limit has been reached. Unable to download ${artifactLocation}`));
133
- }
134
- else {
135
- this.downloadHttpManager.disposeAndReplaceClient(httpClientIndex);
136
- if (retryAfterValue) {
137
- // Back off by waiting the specified time denoted by the retry-after header
138
- core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`);
139
- yield utils_1.sleep(retryAfterValue);
140
- }
141
- else {
142
- // Back off using an exponential value that depends on the retry count
143
- const backoffTime = utils_1.getExponentialRetryTimeInMilliseconds(retryCount);
144
- core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`);
145
- yield utils_1.sleep(backoffTime);
146
- }
147
- core.info(`Finished backoff for retry #${retryCount}, continuing with download`);
148
- }
149
- });
150
- const isAllBytesReceived = (expected, received) => {
151
- // be lenient, if any input is missing, assume success, i.e. not truncated
152
- if (!expected ||
153
- !received ||
154
- process.env['ACTIONS_ARTIFACT_SKIP_DOWNLOAD_VALIDATION']) {
155
- core.info('Skipping download validation.');
156
- return true;
157
- }
158
- return parseInt(expected) === received;
159
- };
160
- const resetDestinationStream = (fileDownloadPath) => __awaiter(this, void 0, void 0, function* () {
161
- destinationStream.close();
162
- yield utils_1.rmFile(fileDownloadPath);
163
- destinationStream = fs.createWriteStream(fileDownloadPath);
164
- });
165
- // keep trying to download a file until a retry limit has been reached
166
- while (retryCount <= retryLimit) {
167
- let response;
168
- try {
169
- response = yield makeDownloadRequest();
170
- if (core.isDebug()) {
171
- utils_1.displayHttpDiagnostics(response);
172
- }
173
- }
174
- catch (error) {
175
- // if an error is caught, it is usually indicative of a timeout so retry the download
176
- core.info('An error occurred while attempting to download a file');
177
- // eslint-disable-next-line no-console
178
- console.log(error);
179
- // increment the retryCount and use exponential backoff to wait before making the next request
180
- yield backOff();
181
- continue;
182
- }
183
- let forceRetry = false;
184
- if (utils_1.isSuccessStatusCode(response.message.statusCode)) {
185
- // The body contains the contents of the file however calling response.readBody() causes all the content to be converted to a string
186
- // which can cause some gzip encoded data to be lost
187
- // Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents
188
- try {
189
- const isGzipped = isGzip(response.message.headers);
190
- yield this.pipeResponseToFile(response, destinationStream, isGzipped);
191
- if (isGzipped ||
192
- isAllBytesReceived(response.message.headers['content-length'], yield utils_1.getFileSize(downloadPath))) {
193
- return;
194
- }
195
- else {
196
- forceRetry = true;
197
- }
198
- }
199
- catch (error) {
200
- // retry on error, most likely streams were corrupted
201
- forceRetry = true;
202
- }
203
- }
204
- if (forceRetry || utils_1.isRetryableStatusCode(response.message.statusCode)) {
205
- core.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`);
206
- resetDestinationStream(downloadPath);
207
- // if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
208
- utils_1.isThrottledStatusCode(response.message.statusCode)
209
- ? yield backOff(utils_1.tryGetRetryAfterValueTimeInMilliseconds(response.message.headers))
210
- : yield backOff();
211
- }
212
- else {
213
- // Some unexpected response code, fail immediately and stop the download
214
- utils_1.displayHttpDiagnostics(response);
215
- return Promise.reject(new Error(`Unexpected http ${response.message.statusCode} during download for ${artifactLocation}`));
216
- }
217
- }
218
- });
219
- }
220
- /**
221
- * Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary
222
- * @param response the http response received when downloading a file
223
- * @param destinationStream the stream where the file should be written to
224
- * @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
225
- */
226
- pipeResponseToFile(response, destinationStream, isGzip) {
227
- return __awaiter(this, void 0, void 0, function* () {
228
- yield new Promise((resolve, reject) => {
229
- if (isGzip) {
230
- const gunzip = zlib.createGunzip();
231
- response.message
232
- .on('error', error => {
233
- core.error(`An error occurred while attempting to read the response stream`);
234
- gunzip.close();
235
- destinationStream.close();
236
- reject(error);
237
- })
238
- .pipe(gunzip)
239
- .on('error', error => {
240
- core.error(`An error occurred while attempting to decompress the response stream`);
241
- destinationStream.close();
242
- reject(error);
243
- })
244
- .pipe(destinationStream)
245
- .on('close', () => {
246
- resolve();
247
- })
248
- .on('error', error => {
249
- core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
250
- reject(error);
251
- });
252
- }
253
- else {
254
- response.message
255
- .on('error', error => {
256
- core.error(`An error occurred while attempting to read the response stream`);
257
- destinationStream.close();
258
- reject(error);
259
- })
260
- .pipe(destinationStream)
261
- .on('close', () => {
262
- resolve();
263
- })
264
- .on('error', error => {
265
- core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
266
- reject(error);
267
- });
268
- }
269
- });
270
- return;
271
- });
272
- }
273
- }
274
- exports.DownloadHttpClient = DownloadHttpClient;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importStar = (this && this.__importStar) || function (mod) {
12
+ if (mod && mod.__esModule) return mod;
13
+ var result = {};
14
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
15
+ result["default"] = mod;
16
+ return result;
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const fs = __importStar(require("fs"));
20
+ const core = __importStar(require("@actions/core"));
21
+ const zlib = __importStar(require("zlib"));
22
+ const utils_1 = require("./utils");
23
+ const url_1 = require("url");
24
+ const status_reporter_1 = require("./status-reporter");
25
+ const perf_hooks_1 = require("perf_hooks");
26
+ const http_manager_1 = require("./http-manager");
27
+ const config_variables_1 = require("./config-variables");
28
+ const requestUtils_1 = require("./requestUtils");
29
+ class DownloadHttpClient {
30
+ constructor() {
31
+ this.downloadHttpManager = new http_manager_1.HttpManager(config_variables_1.getDownloadFileConcurrency(), '@actions/artifact-download');
32
+ // downloads are usually significantly faster than uploads so display status information every second
33
+ this.statusReporter = new status_reporter_1.StatusReporter(1000);
34
+ }
35
+ /**
36
+ * Gets a list of all artifacts that are in a specific container
37
+ */
38
+ listArtifacts() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const artifactUrl = utils_1.getArtifactUrl();
41
+ // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
42
+ const client = this.downloadHttpManager.getClient(0);
43
+ const headers = utils_1.getDownloadHeaders('application/json');
44
+ const response = yield requestUtils_1.retryHttpClientRequest('List Artifacts', () => __awaiter(this, void 0, void 0, function* () { return client.get(artifactUrl, headers); }));
45
+ const body = yield response.readBody();
46
+ return JSON.parse(body);
47
+ });
48
+ }
49
+ /**
50
+ * Fetches a set of container items that describe the contents of an artifact
51
+ * @param artifactName the name of the artifact
52
+ * @param containerUrl the artifact container URL for the run
53
+ */
54
+ getContainerItems(artifactName, containerUrl) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ // the itemPath search parameter controls which containers will be returned
57
+ const resourceUrl = new url_1.URL(containerUrl);
58
+ resourceUrl.searchParams.append('itemPath', artifactName);
59
+ // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
60
+ const client = this.downloadHttpManager.getClient(0);
61
+ const headers = utils_1.getDownloadHeaders('application/json');
62
+ const response = yield requestUtils_1.retryHttpClientRequest('Get Container Items', () => __awaiter(this, void 0, void 0, function* () { return client.get(resourceUrl.toString(), headers); }));
63
+ const body = yield response.readBody();
64
+ return JSON.parse(body);
65
+ });
66
+ }
67
+ /**
68
+ * Concurrently downloads all the files that are part of an artifact
69
+ * @param downloadItems information about what items to download and where to save them
70
+ */
71
+ downloadSingleArtifact(downloadItems) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const DOWNLOAD_CONCURRENCY = config_variables_1.getDownloadFileConcurrency();
74
+ // limit the number of files downloaded at a single time
75
+ core.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`);
76
+ const parallelDownloads = [...new Array(DOWNLOAD_CONCURRENCY).keys()];
77
+ let currentFile = 0;
78
+ let downloadedFiles = 0;
79
+ core.info(`Total number of files that will be downloaded: ${downloadItems.length}`);
80
+ this.statusReporter.setTotalNumberOfFilesToProcess(downloadItems.length);
81
+ this.statusReporter.start();
82
+ yield Promise.all(parallelDownloads.map((index) => __awaiter(this, void 0, void 0, function* () {
83
+ while (currentFile < downloadItems.length) {
84
+ const currentFileToDownload = downloadItems[currentFile];
85
+ currentFile += 1;
86
+ const startTime = perf_hooks_1.performance.now();
87
+ yield this.downloadIndividualFile(index, currentFileToDownload.sourceLocation, currentFileToDownload.targetPath);
88
+ if (core.isDebug()) {
89
+ core.debug(`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish downloading`);
90
+ }
91
+ this.statusReporter.incrementProcessedCount();
92
+ }
93
+ })))
94
+ .catch(error => {
95
+ throw new Error(`Unable to download the artifact: ${error}`);
96
+ })
97
+ .finally(() => {
98
+ this.statusReporter.stop();
99
+ // safety dispose all connections
100
+ this.downloadHttpManager.disposeAndReplaceAllClients();
101
+ });
102
+ });
103
+ }
104
+ /**
105
+ * Downloads an individual file
106
+ * @param httpClientIndex the index of the http client that is used to make all of the calls
107
+ * @param artifactLocation origin location where a file will be downloaded from
108
+ * @param downloadPath destination location for the file being downloaded
109
+ */
110
+ downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ let retryCount = 0;
113
+ const retryLimit = config_variables_1.getRetryLimit();
114
+ let destinationStream = fs.createWriteStream(downloadPath);
115
+ const headers = utils_1.getDownloadHeaders('application/json', true, true);
116
+ // a single GET request is used to download a file
117
+ const makeDownloadRequest = () => __awaiter(this, void 0, void 0, function* () {
118
+ const client = this.downloadHttpManager.getClient(httpClientIndex);
119
+ return yield client.get(artifactLocation, headers);
120
+ });
121
+ // check the response headers to determine if the file was compressed using gzip
122
+ const isGzip = (incomingHeaders) => {
123
+ return ('content-encoding' in incomingHeaders &&
124
+ incomingHeaders['content-encoding'] === 'gzip');
125
+ };
126
+ // Increments the current retry count and then checks if the retry limit has been reached
127
+ // If there have been too many retries, fail so the download stops. If there is a retryAfterValue value provided,
128
+ // it will be used
129
+ const backOff = (retryAfterValue) => __awaiter(this, void 0, void 0, function* () {
130
+ retryCount++;
131
+ if (retryCount > retryLimit) {
132
+ return Promise.reject(new Error(`Retry limit has been reached. Unable to download ${artifactLocation}`));
133
+ }
134
+ else {
135
+ this.downloadHttpManager.disposeAndReplaceClient(httpClientIndex);
136
+ if (retryAfterValue) {
137
+ // Back off by waiting the specified time denoted by the retry-after header
138
+ core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`);
139
+ yield utils_1.sleep(retryAfterValue);
140
+ }
141
+ else {
142
+ // Back off using an exponential value that depends on the retry count
143
+ const backoffTime = utils_1.getExponentialRetryTimeInMilliseconds(retryCount);
144
+ core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`);
145
+ yield utils_1.sleep(backoffTime);
146
+ }
147
+ core.info(`Finished backoff for retry #${retryCount}, continuing with download`);
148
+ }
149
+ });
150
+ const isAllBytesReceived = (expected, received) => {
151
+ // be lenient, if any input is missing, assume success, i.e. not truncated
152
+ if (!expected ||
153
+ !received ||
154
+ process.env['ACTIONS_ARTIFACT_SKIP_DOWNLOAD_VALIDATION']) {
155
+ core.info('Skipping download validation.');
156
+ return true;
157
+ }
158
+ return parseInt(expected) === received;
159
+ };
160
+ const resetDestinationStream = (fileDownloadPath) => __awaiter(this, void 0, void 0, function* () {
161
+ destinationStream.close();
162
+ yield utils_1.rmFile(fileDownloadPath);
163
+ destinationStream = fs.createWriteStream(fileDownloadPath);
164
+ });
165
+ // keep trying to download a file until a retry limit has been reached
166
+ while (retryCount <= retryLimit) {
167
+ let response;
168
+ try {
169
+ response = yield makeDownloadRequest();
170
+ }
171
+ catch (error) {
172
+ // if an error is caught, it is usually indicative of a timeout so retry the download
173
+ core.info('An error occurred while attempting to download a file');
174
+ // eslint-disable-next-line no-console
175
+ console.log(error);
176
+ // increment the retryCount and use exponential backoff to wait before making the next request
177
+ yield backOff();
178
+ continue;
179
+ }
180
+ let forceRetry = false;
181
+ if (utils_1.isSuccessStatusCode(response.message.statusCode)) {
182
+ // The body contains the contents of the file however calling response.readBody() causes all the content to be converted to a string
183
+ // which can cause some gzip encoded data to be lost
184
+ // Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents
185
+ try {
186
+ const isGzipped = isGzip(response.message.headers);
187
+ yield this.pipeResponseToFile(response, destinationStream, isGzipped);
188
+ if (isGzipped ||
189
+ isAllBytesReceived(response.message.headers['content-length'], yield utils_1.getFileSize(downloadPath))) {
190
+ return;
191
+ }
192
+ else {
193
+ forceRetry = true;
194
+ }
195
+ }
196
+ catch (error) {
197
+ // retry on error, most likely streams were corrupted
198
+ forceRetry = true;
199
+ }
200
+ }
201
+ if (forceRetry || utils_1.isRetryableStatusCode(response.message.statusCode)) {
202
+ core.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`);
203
+ resetDestinationStream(downloadPath);
204
+ // if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
205
+ utils_1.isThrottledStatusCode(response.message.statusCode)
206
+ ? yield backOff(utils_1.tryGetRetryAfterValueTimeInMilliseconds(response.message.headers))
207
+ : yield backOff();
208
+ }
209
+ else {
210
+ // Some unexpected response code, fail immediately and stop the download
211
+ utils_1.displayHttpDiagnostics(response);
212
+ return Promise.reject(new Error(`Unexpected http ${response.message.statusCode} during download for ${artifactLocation}`));
213
+ }
214
+ }
215
+ });
216
+ }
217
+ /**
218
+ * Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary
219
+ * @param response the http response received when downloading a file
220
+ * @param destinationStream the stream where the file should be written to
221
+ * @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
222
+ */
223
+ pipeResponseToFile(response, destinationStream, isGzip) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ yield new Promise((resolve, reject) => {
226
+ if (isGzip) {
227
+ const gunzip = zlib.createGunzip();
228
+ response.message
229
+ .on('error', error => {
230
+ core.error(`An error occurred while attempting to read the response stream`);
231
+ gunzip.close();
232
+ destinationStream.close();
233
+ reject(error);
234
+ })
235
+ .pipe(gunzip)
236
+ .on('error', error => {
237
+ core.error(`An error occurred while attempting to decompress the response stream`);
238
+ destinationStream.close();
239
+ reject(error);
240
+ })
241
+ .pipe(destinationStream)
242
+ .on('close', () => {
243
+ resolve();
244
+ })
245
+ .on('error', error => {
246
+ core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
247
+ reject(error);
248
+ });
249
+ }
250
+ else {
251
+ response.message
252
+ .on('error', error => {
253
+ core.error(`An error occurred while attempting to read the response stream`);
254
+ destinationStream.close();
255
+ reject(error);
256
+ })
257
+ .pipe(destinationStream)
258
+ .on('close', () => {
259
+ resolve();
260
+ })
261
+ .on('error', error => {
262
+ core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
263
+ reject(error);
264
+ });
265
+ }
266
+ });
267
+ return;
268
+ });
269
+ }
270
+ }
271
+ exports.DownloadHttpClient = DownloadHttpClient;
275
272
  //# sourceMappingURL=download-http-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"download-http-client.js","sourceRoot":"","sources":["../../src/internal/download-http-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,oDAAqC;AACrC,2CAA4B;AAC5B,mCAYg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CAAC;yBACZ,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;wBACnB,IAAI,CAAC,KAAK,CACR,sEAAsE,CACvE,CAAA;wBACD,iBAAiB,CAAC,KAAK,EAAE,CAAA;wBACzB,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC;yBACD,IAAI,CAAC,iBAAiB,CAAC;yBACvB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;wBAChB,OAAO,EAAE,CAAA;oBACX,CAAC,CAAC;yBACD,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;wBACnB,IAAI,CAAC,KAAK,CACR,wDAAwD,iBAAiB,CAAC,IAAI,EAAE,CACjF,CAAA;wBACD,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC,CAAA;iBACL;qBAAM;oBACL,QAAQ,CAAC,OAAO;yBACb,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;wBACnB,IAAI,CAAC,KAAK,CACR,gEAAgE,CACjE,CAAA;wBACD,iBAAiB,CAAC,KAAK,EAAE,CAAA;wBACzB,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC;yBACD,IAAI,CAAC,iBAAiB,CAAC;yBACvB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;wBAChB,OAAO,EAAE,CAAA;oBACX,CAAC,CAAC;yBACD,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;wBACnB,IAAI,CAAC,KAAK,CACR,wDAAwD,iBAAiB,CAAC,IAAI,EAAE,CACjF,CAAA;wBACD,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC,CAAA;iBACL;YACH,CAAC,CAAC,CAAA;YACF,OAAM;QACR,CAAC;KAAA;CACF;AA1UD,gDA0UC"}
1
+ {"version":3,"file":"download-http-client.js","sourceRoot":"","sources":["../../src/internal/download-http-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AAC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AAE;wBACnB,IAAI,CAAC,KAAK,CACR,sEAAsE,CACvE,CAAA;wBACD,iBAAiB,CAAC,KAAK,EAAE,CAAA;wBACzB,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC;yBACD,IAAI,CAAC,iBAAiB,CAAC;yBACvB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;wBAChB,OAAO,EAAE,CAAA;oBACX,CAAC,CAAC;yBACD,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;wBACnB,IAAI,CAAC,KAAK,CACR,wDAAwD,iBAAiB,CAAC,IAAI,EAAE,CACjF,CAAA;wBACD,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC,CAAA;iBACL;qBAAM;oBACL,QAAQ,CAAC,OAAO;yBACb,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;wBACnB,IAAI,CAAC,KAAK,CACR,gEAAgE,CACjE,CAAA;wBACD,iBAAiB,CAAC,KAAK,EAAE,CAAA;wBACzB,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC;yBACD,IAAI,CAAC,iBAAiB,CAAC;yBACvB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;wBAChB,OAAO,EAAE,CAAA;oBACX,CAAC,CAAC;yBACD,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;wBACnB,IAAI,CAAC,KAAK,CACR,wDAAwD,iBAAiB,CAAC,IAAI,EAAE,CACjF,CAAA;wBACD,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC,CAAC,CAAA;iBACL;YACH,CAAC,CAAC,CAAA;YACF,OAAM;QACR,CAAC;KAAA;CACF;AAvUD,gDAuUC"}
@@ -1,7 +1,7 @@
1
- export interface DownloadOptions {
2
- /**
3
- * Specifies if a folder is created for the artifact that is downloaded (contents downloaded into this folder),
4
- * defaults to false if not specified
5
- * */
6
- createArtifactFolder?: boolean;
7
- }
1
+ export interface DownloadOptions {
2
+ /**
3
+ * Specifies if a folder is created for the artifact that is downloaded (contents downloaded into this folder),
4
+ * defaults to false if not specified
5
+ * */
6
+ createArtifactFolder?: boolean;
7
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=download-options.js.map