@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.
- package/LICENSE.md +8 -8
- package/README.md +213 -213
- package/lib/artifact-client.d.ts +10 -10
- package/lib/artifact-client.js +10 -10
- package/lib/internal/artifact-client.d.ts +41 -41
- package/lib/internal/artifact-client.js +164 -148
- package/lib/internal/artifact-client.js.map +1 -1
- package/lib/internal/config-variables.d.ts +11 -11
- package/lib/internal/config-variables.js +70 -70
- package/lib/internal/contracts.d.ts +67 -57
- package/lib/internal/contracts.js +2 -2
- package/lib/internal/download-http-client.d.ts +39 -39
- package/lib/internal/download-http-client.js +271 -274
- package/lib/internal/download-http-client.js.map +1 -1
- package/lib/internal/download-options.d.ts +7 -7
- package/lib/internal/download-options.js +2 -2
- package/lib/internal/download-response.d.ts +10 -10
- package/lib/internal/download-response.js +2 -2
- package/lib/internal/download-specification.d.ts +19 -19
- package/lib/internal/download-specification.js +60 -60
- package/lib/internal/http-manager.d.ts +12 -12
- package/lib/internal/http-manager.js +30 -30
- package/lib/internal/path-and-artifact-name-validation.d.ts +8 -0
- package/lib/internal/path-and-artifact-name-validation.js +66 -0
- package/lib/internal/path-and-artifact-name-validation.js.map +1 -0
- package/lib/internal/requestUtils.d.ts +3 -3
- package/lib/internal/requestUtils.js +74 -74
- package/lib/internal/status-reporter.d.ts +21 -22
- package/lib/internal/status-reporter.js +50 -63
- package/lib/internal/status-reporter.js.map +1 -1
- package/lib/internal/upload-gzip.d.ts +14 -14
- package/lib/internal/upload-gzip.js +107 -88
- package/lib/internal/upload-gzip.js.map +1 -1
- package/lib/internal/upload-http-client.d.ts +48 -48
- package/lib/internal/upload-http-client.js +393 -378
- package/lib/internal/upload-http-client.js.map +1 -1
- package/lib/internal/upload-options.d.ts +34 -34
- package/lib/internal/upload-options.js +2 -2
- package/lib/internal/upload-response.d.ts +19 -19
- package/lib/internal/upload-response.js +2 -2
- package/lib/internal/upload-specification.d.ts +11 -11
- package/lib/internal/upload-specification.js +87 -87
- package/lib/internal/upload-specification.js.map +1 -1
- package/lib/internal/utils.d.ts +66 -74
- package/lib/internal/utils.js +262 -303
- package/lib/internal/utils.js.map +1 -1
- package/package.json +49 -49
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface DownloadResponse {
|
|
2
|
-
/**
|
|
3
|
-
* The name of the artifact that was downloaded
|
|
4
|
-
*/
|
|
5
|
-
artifactName: string;
|
|
6
|
-
/**
|
|
7
|
-
* The full Path to where the artifact was downloaded
|
|
8
|
-
*/
|
|
9
|
-
downloadPath: string;
|
|
10
|
-
}
|
|
1
|
+
export interface DownloadResponse {
|
|
2
|
+
/**
|
|
3
|
+
* The name of the artifact that was downloaded
|
|
4
|
+
*/
|
|
5
|
+
artifactName: string;
|
|
6
|
+
/**
|
|
7
|
+
* The full Path to where the artifact was downloaded
|
|
8
|
+
*/
|
|
9
|
+
downloadPath: string;
|
|
10
|
+
}
|
|
@@ -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-response.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ContainerEntry } from './contracts';
|
|
2
|
-
export interface DownloadSpecification {
|
|
3
|
-
rootDownloadLocation: string;
|
|
4
|
-
directoryStructure: string[];
|
|
5
|
-
emptyFilesToCreate: string[];
|
|
6
|
-
filesToDownload: DownloadItem[];
|
|
7
|
-
}
|
|
8
|
-
export interface DownloadItem {
|
|
9
|
-
sourceLocation: string;
|
|
10
|
-
targetPath: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Creates a specification for a set of files that will be downloaded
|
|
14
|
-
* @param artifactName the name of the artifact
|
|
15
|
-
* @param artifactEntries a set of container entries that describe that files that make up an artifact
|
|
16
|
-
* @param downloadPath the path where the artifact will be downloaded to
|
|
17
|
-
* @param includeRootDirectory specifies if there should be an extra directory (denoted by the artifact name) where the artifact files should be downloaded to
|
|
18
|
-
*/
|
|
19
|
-
export declare function getDownloadSpecification(artifactName: string, artifactEntries: ContainerEntry[], downloadPath: string, includeRootDirectory: boolean): DownloadSpecification;
|
|
1
|
+
import { ContainerEntry } from './contracts';
|
|
2
|
+
export interface DownloadSpecification {
|
|
3
|
+
rootDownloadLocation: string;
|
|
4
|
+
directoryStructure: string[];
|
|
5
|
+
emptyFilesToCreate: string[];
|
|
6
|
+
filesToDownload: DownloadItem[];
|
|
7
|
+
}
|
|
8
|
+
export interface DownloadItem {
|
|
9
|
+
sourceLocation: string;
|
|
10
|
+
targetPath: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a specification for a set of files that will be downloaded
|
|
14
|
+
* @param artifactName the name of the artifact
|
|
15
|
+
* @param artifactEntries a set of container entries that describe that files that make up an artifact
|
|
16
|
+
* @param downloadPath the path where the artifact will be downloaded to
|
|
17
|
+
* @param includeRootDirectory specifies if there should be an extra directory (denoted by the artifact name) where the artifact files should be downloaded to
|
|
18
|
+
*/
|
|
19
|
+
export declare function getDownloadSpecification(artifactName: string, artifactEntries: ContainerEntry[], downloadPath: string, includeRootDirectory: boolean): DownloadSpecification;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
-
if (mod && mod.__esModule) return mod;
|
|
4
|
-
var result = {};
|
|
5
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
-
result["default"] = mod;
|
|
7
|
-
return result;
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const path = __importStar(require("path"));
|
|
11
|
-
/**
|
|
12
|
-
* Creates a specification for a set of files that will be downloaded
|
|
13
|
-
* @param artifactName the name of the artifact
|
|
14
|
-
* @param artifactEntries a set of container entries that describe that files that make up an artifact
|
|
15
|
-
* @param downloadPath the path where the artifact will be downloaded to
|
|
16
|
-
* @param includeRootDirectory specifies if there should be an extra directory (denoted by the artifact name) where the artifact files should be downloaded to
|
|
17
|
-
*/
|
|
18
|
-
function getDownloadSpecification(artifactName, artifactEntries, downloadPath, includeRootDirectory) {
|
|
19
|
-
// use a set for the directory paths so that there are no duplicates
|
|
20
|
-
const directories = new Set();
|
|
21
|
-
const specifications = {
|
|
22
|
-
rootDownloadLocation: includeRootDirectory
|
|
23
|
-
? path.join(downloadPath, artifactName)
|
|
24
|
-
: downloadPath,
|
|
25
|
-
directoryStructure: [],
|
|
26
|
-
emptyFilesToCreate: [],
|
|
27
|
-
filesToDownload: []
|
|
28
|
-
};
|
|
29
|
-
for (const entry of artifactEntries) {
|
|
30
|
-
// Ignore artifacts in the container that don't begin with the same name
|
|
31
|
-
if (entry.path.startsWith(`${artifactName}/`) ||
|
|
32
|
-
entry.path.startsWith(`${artifactName}\\`)) {
|
|
33
|
-
// normalize all separators to the local OS
|
|
34
|
-
const normalizedPathEntry = path.normalize(entry.path);
|
|
35
|
-
// entry.path always starts with the artifact name, if includeRootDirectory is false, remove the name from the beginning of the path
|
|
36
|
-
const filePath = path.join(downloadPath, includeRootDirectory
|
|
37
|
-
? normalizedPathEntry
|
|
38
|
-
: normalizedPathEntry.replace(artifactName, ''));
|
|
39
|
-
// Case insensitive folder structure maintained in the backend, not every folder is created so the 'folder'
|
|
40
|
-
// itemType cannot be relied upon. The file must be used to determine the directory structure
|
|
41
|
-
if (entry.itemType === 'file') {
|
|
42
|
-
// Get the directories that we need to create from the filePath for each individual file
|
|
43
|
-
directories.add(path.dirname(filePath));
|
|
44
|
-
if (entry.fileLength === 0) {
|
|
45
|
-
// An empty file was uploaded, create the empty files locally so that no extra http calls are made
|
|
46
|
-
specifications.emptyFilesToCreate.push(filePath);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
specifications.filesToDownload.push({
|
|
50
|
-
sourceLocation: entry.contentLocation,
|
|
51
|
-
targetPath: filePath
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
specifications.directoryStructure = Array.from(directories);
|
|
58
|
-
return specifications;
|
|
59
|
-
}
|
|
60
|
-
exports.getDownloadSpecification = getDownloadSpecification;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const path = __importStar(require("path"));
|
|
11
|
+
/**
|
|
12
|
+
* Creates a specification for a set of files that will be downloaded
|
|
13
|
+
* @param artifactName the name of the artifact
|
|
14
|
+
* @param artifactEntries a set of container entries that describe that files that make up an artifact
|
|
15
|
+
* @param downloadPath the path where the artifact will be downloaded to
|
|
16
|
+
* @param includeRootDirectory specifies if there should be an extra directory (denoted by the artifact name) where the artifact files should be downloaded to
|
|
17
|
+
*/
|
|
18
|
+
function getDownloadSpecification(artifactName, artifactEntries, downloadPath, includeRootDirectory) {
|
|
19
|
+
// use a set for the directory paths so that there are no duplicates
|
|
20
|
+
const directories = new Set();
|
|
21
|
+
const specifications = {
|
|
22
|
+
rootDownloadLocation: includeRootDirectory
|
|
23
|
+
? path.join(downloadPath, artifactName)
|
|
24
|
+
: downloadPath,
|
|
25
|
+
directoryStructure: [],
|
|
26
|
+
emptyFilesToCreate: [],
|
|
27
|
+
filesToDownload: []
|
|
28
|
+
};
|
|
29
|
+
for (const entry of artifactEntries) {
|
|
30
|
+
// Ignore artifacts in the container that don't begin with the same name
|
|
31
|
+
if (entry.path.startsWith(`${artifactName}/`) ||
|
|
32
|
+
entry.path.startsWith(`${artifactName}\\`)) {
|
|
33
|
+
// normalize all separators to the local OS
|
|
34
|
+
const normalizedPathEntry = path.normalize(entry.path);
|
|
35
|
+
// entry.path always starts with the artifact name, if includeRootDirectory is false, remove the name from the beginning of the path
|
|
36
|
+
const filePath = path.join(downloadPath, includeRootDirectory
|
|
37
|
+
? normalizedPathEntry
|
|
38
|
+
: normalizedPathEntry.replace(artifactName, ''));
|
|
39
|
+
// Case insensitive folder structure maintained in the backend, not every folder is created so the 'folder'
|
|
40
|
+
// itemType cannot be relied upon. The file must be used to determine the directory structure
|
|
41
|
+
if (entry.itemType === 'file') {
|
|
42
|
+
// Get the directories that we need to create from the filePath for each individual file
|
|
43
|
+
directories.add(path.dirname(filePath));
|
|
44
|
+
if (entry.fileLength === 0) {
|
|
45
|
+
// An empty file was uploaded, create the empty files locally so that no extra http calls are made
|
|
46
|
+
specifications.emptyFilesToCreate.push(filePath);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
specifications.filesToDownload.push({
|
|
50
|
+
sourceLocation: entry.contentLocation,
|
|
51
|
+
targetPath: filePath
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
specifications.directoryStructure = Array.from(directories);
|
|
58
|
+
return specifications;
|
|
59
|
+
}
|
|
60
|
+
exports.getDownloadSpecification = getDownloadSpecification;
|
|
61
61
|
//# sourceMappingURL=download-specification.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { HttpClient } from '@actions/http-client/index';
|
|
2
|
-
/**
|
|
3
|
-
* Used for managing http clients during either upload or download
|
|
4
|
-
*/
|
|
5
|
-
export declare class HttpManager {
|
|
6
|
-
private clients;
|
|
7
|
-
private userAgent;
|
|
8
|
-
constructor(clientCount: number, userAgent: string);
|
|
9
|
-
getClient(index: number): HttpClient;
|
|
10
|
-
disposeAndReplaceClient(index: number): void;
|
|
11
|
-
disposeAndReplaceAllClients(): void;
|
|
12
|
-
}
|
|
1
|
+
import { HttpClient } from '@actions/http-client/index';
|
|
2
|
+
/**
|
|
3
|
+
* Used for managing http clients during either upload or download
|
|
4
|
+
*/
|
|
5
|
+
export declare class HttpManager {
|
|
6
|
+
private clients;
|
|
7
|
+
private userAgent;
|
|
8
|
+
constructor(clientCount: number, userAgent: string);
|
|
9
|
+
getClient(index: number): HttpClient;
|
|
10
|
+
disposeAndReplaceClient(index: number): void;
|
|
11
|
+
disposeAndReplaceAllClients(): void;
|
|
12
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("./utils");
|
|
4
|
-
/**
|
|
5
|
-
* Used for managing http clients during either upload or download
|
|
6
|
-
*/
|
|
7
|
-
class HttpManager {
|
|
8
|
-
constructor(clientCount, userAgent) {
|
|
9
|
-
if (clientCount < 1) {
|
|
10
|
-
throw new Error('There must be at least one client');
|
|
11
|
-
}
|
|
12
|
-
this.userAgent = userAgent;
|
|
13
|
-
this.clients = new Array(clientCount).fill(utils_1.createHttpClient(userAgent));
|
|
14
|
-
}
|
|
15
|
-
getClient(index) {
|
|
16
|
-
return this.clients[index];
|
|
17
|
-
}
|
|
18
|
-
// client disposal is necessary if a keep-alive connection is used to properly close the connection
|
|
19
|
-
// for more information see: https://github.com/actions/http-client/blob/04e5ad73cd3fd1f5610a32116b0759eddf6570d2/index.ts#L292
|
|
20
|
-
disposeAndReplaceClient(index) {
|
|
21
|
-
this.clients[index].dispose();
|
|
22
|
-
this.clients[index] = utils_1.createHttpClient(this.userAgent);
|
|
23
|
-
}
|
|
24
|
-
disposeAndReplaceAllClients() {
|
|
25
|
-
for (const [index] of this.clients.entries()) {
|
|
26
|
-
this.disposeAndReplaceClient(index);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.HttpManager = HttpManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("./utils");
|
|
4
|
+
/**
|
|
5
|
+
* Used for managing http clients during either upload or download
|
|
6
|
+
*/
|
|
7
|
+
class HttpManager {
|
|
8
|
+
constructor(clientCount, userAgent) {
|
|
9
|
+
if (clientCount < 1) {
|
|
10
|
+
throw new Error('There must be at least one client');
|
|
11
|
+
}
|
|
12
|
+
this.userAgent = userAgent;
|
|
13
|
+
this.clients = new Array(clientCount).fill(utils_1.createHttpClient(userAgent));
|
|
14
|
+
}
|
|
15
|
+
getClient(index) {
|
|
16
|
+
return this.clients[index];
|
|
17
|
+
}
|
|
18
|
+
// client disposal is necessary if a keep-alive connection is used to properly close the connection
|
|
19
|
+
// for more information see: https://github.com/actions/http-client/blob/04e5ad73cd3fd1f5610a32116b0759eddf6570d2/index.ts#L292
|
|
20
|
+
disposeAndReplaceClient(index) {
|
|
21
|
+
this.clients[index].dispose();
|
|
22
|
+
this.clients[index] = utils_1.createHttpClient(this.userAgent);
|
|
23
|
+
}
|
|
24
|
+
disposeAndReplaceAllClients() {
|
|
25
|
+
for (const [index] of this.clients.entries()) {
|
|
26
|
+
this.disposeAndReplaceClient(index);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.HttpManager = HttpManager;
|
|
31
31
|
//# sourceMappingURL=http-manager.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scans the name of the artifact to make sure there are no illegal characters
|
|
3
|
+
*/
|
|
4
|
+
export declare function checkArtifactName(name: string): void;
|
|
5
|
+
/**
|
|
6
|
+
* Scans the name of the filePath used to make sure there are no illegal characters
|
|
7
|
+
*/
|
|
8
|
+
export declare function checkArtifactFilePath(path: string): void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@actions/core");
|
|
4
|
+
/**
|
|
5
|
+
* Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected
|
|
6
|
+
* from the server if attempted to be sent over. These characters are not allowed due to limitations with certain
|
|
7
|
+
* file systems such as NTFS. To maintain platform-agnostic behavior, all characters that are not supported by an
|
|
8
|
+
* individual filesystem/platform will not be supported on all fileSystems/platforms
|
|
9
|
+
*
|
|
10
|
+
* FilePaths can include characters such as \ and / which are not permitted in the artifact name alone
|
|
11
|
+
*/
|
|
12
|
+
const invalidArtifactFilePathCharacters = new Map([
|
|
13
|
+
['"', ' Double quote "'],
|
|
14
|
+
[':', ' Colon :'],
|
|
15
|
+
['<', ' Less than <'],
|
|
16
|
+
['>', ' Greater than >'],
|
|
17
|
+
['|', ' Vertical bar |'],
|
|
18
|
+
['*', ' Asterisk *'],
|
|
19
|
+
['?', ' Question mark ?'],
|
|
20
|
+
['\r', ' Carriage return \\r'],
|
|
21
|
+
['\n', ' Line feed \\n']
|
|
22
|
+
]);
|
|
23
|
+
const invalidArtifactNameCharacters = new Map([
|
|
24
|
+
...invalidArtifactFilePathCharacters,
|
|
25
|
+
['\\', ' Backslash \\'],
|
|
26
|
+
['/', ' Forward slash /']
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* Scans the name of the artifact to make sure there are no illegal characters
|
|
30
|
+
*/
|
|
31
|
+
function checkArtifactName(name) {
|
|
32
|
+
if (!name) {
|
|
33
|
+
throw new Error(`Artifact name: ${name}, is incorrectly provided`);
|
|
34
|
+
}
|
|
35
|
+
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactNameCharacters) {
|
|
36
|
+
if (name.includes(invalidCharacterKey)) {
|
|
37
|
+
throw new Error(`Artifact name is not valid: ${name}. Contains the following character: ${errorMessageForCharacter}
|
|
38
|
+
|
|
39
|
+
Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values()).toString()}
|
|
40
|
+
|
|
41
|
+
These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
core_1.info(`Artifact name is valid!`);
|
|
45
|
+
}
|
|
46
|
+
exports.checkArtifactName = checkArtifactName;
|
|
47
|
+
/**
|
|
48
|
+
* Scans the name of the filePath used to make sure there are no illegal characters
|
|
49
|
+
*/
|
|
50
|
+
function checkArtifactFilePath(path) {
|
|
51
|
+
if (!path) {
|
|
52
|
+
throw new Error(`Artifact path: ${path}, is incorrectly provided`);
|
|
53
|
+
}
|
|
54
|
+
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactFilePathCharacters) {
|
|
55
|
+
if (path.includes(invalidCharacterKey)) {
|
|
56
|
+
throw new Error(`Artifact path is not valid: ${path}. Contains the following character: ${errorMessageForCharacter}
|
|
57
|
+
|
|
58
|
+
Invalid characters include: ${Array.from(invalidArtifactFilePathCharacters.values()).toString()}
|
|
59
|
+
|
|
60
|
+
The following characters are not allowed in files that are uploaded due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.
|
|
61
|
+
`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.checkArtifactFilePath = checkArtifactFilePath;
|
|
66
|
+
//# sourceMappingURL=path-and-artifact-name-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-and-artifact-name-validation.js","sourceRoot":"","sources":["../../src/internal/path-and-artifact-name-validation.ts"],"names":[],"mappings":";;AAAA,wCAAkC;AAElC;;;;;;;GAOG;AACH,MAAM,iCAAiC,GAAG,IAAI,GAAG,CAAiB;IAChE,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,UAAU,CAAC;IACjB,CAAC,GAAG,EAAE,cAAc,CAAC;IACrB,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,aAAa,CAAC;IACpB,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAC9B,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACzB,CAAC,CAAA;AAEF,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAiB;IAC5D,GAAG,iCAAiC;IACpC,CAAC,IAAI,EAAE,eAAe,CAAC;IACvB,CAAC,GAAG,EAAE,kBAAkB,CAAC;CAC1B,CAAC,CAAA;AAEF;;GAEG;AACH,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,2BAA2B,CAAC,CAAA;KACnE;IAED,KAAK,MAAM,CACT,mBAAmB,EACnB,wBAAwB,CACzB,IAAI,6BAA6B,EAAE;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,uCAAuC,wBAAwB;;8BAE5E,KAAK,CAAC,IAAI,CAC9B,6BAA6B,CAAC,MAAM,EAAE,CACvC,CAAC,QAAQ,EAAE;;mRAE+P,CAC5Q,CAAA;SACF;KACF;IAED,WAAI,CAAC,yBAAyB,CAAC,CAAA;AACjC,CAAC;AAvBD,8CAuBC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,IAAY;IAChD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,2BAA2B,CAAC,CAAA;KACnE;IAED,KAAK,MAAM,CACT,mBAAmB,EACnB,wBAAwB,CACzB,IAAI,iCAAiC,EAAE;QACtC,IAAI,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,uCAAuC,wBAAwB;;8BAE5E,KAAK,CAAC,IAAI,CAC9B,iCAAiC,CAAC,MAAM,EAAE,CAC3C,CAAC,QAAQ,EAAE;;;WAGT,CACJ,CAAA;SACF;KACF;AACH,CAAC;AAtBD,sDAsBC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IHttpClientResponse } from '@actions/http-client/interfaces';
|
|
2
|
-
export declare function retry(name: string, operation: () => Promise<IHttpClientResponse>, customErrorMessages: Map<number, string>, maxAttempts: number): Promise<IHttpClientResponse>;
|
|
3
|
-
export declare function retryHttpClientRequest
|
|
1
|
+
import { IHttpClientResponse } from '@actions/http-client/interfaces';
|
|
2
|
+
export declare function retry(name: string, operation: () => Promise<IHttpClientResponse>, customErrorMessages: Map<number, string>, maxAttempts: number): Promise<IHttpClientResponse>;
|
|
3
|
+
export declare function retryHttpClientRequest(name: string, method: () => Promise<IHttpClientResponse>, customErrorMessages?: Map<number, string>, maxAttempts?: number): Promise<IHttpClientResponse>;
|
|
@@ -1,75 +1,75 @@
|
|
|
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 utils_1 = require("./utils");
|
|
20
|
-
const core = __importStar(require("@actions/core"));
|
|
21
|
-
const config_variables_1 = require("./config-variables");
|
|
22
|
-
function retry(name, operation, customErrorMessages, maxAttempts) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
let response = undefined;
|
|
25
|
-
let statusCode = undefined;
|
|
26
|
-
let isRetryable = false;
|
|
27
|
-
let errorMessage = '';
|
|
28
|
-
let customErrorInformation = undefined;
|
|
29
|
-
let attempt = 1;
|
|
30
|
-
while (attempt <= maxAttempts) {
|
|
31
|
-
try {
|
|
32
|
-
response = yield operation();
|
|
33
|
-
statusCode = response.message.statusCode;
|
|
34
|
-
if (utils_1.isSuccessStatusCode(statusCode)) {
|
|
35
|
-
return response;
|
|
36
|
-
}
|
|
37
|
-
// Extra error information that we want to display if a particular response code is hit
|
|
38
|
-
if (statusCode) {
|
|
39
|
-
customErrorInformation = customErrorMessages.get(statusCode);
|
|
40
|
-
}
|
|
41
|
-
isRetryable = utils_1.isRetryableStatusCode(statusCode);
|
|
42
|
-
errorMessage = `Artifact service responded with ${statusCode}`;
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
isRetryable = true;
|
|
46
|
-
errorMessage = error.message;
|
|
47
|
-
}
|
|
48
|
-
if (!isRetryable) {
|
|
49
|
-
core.info(`${name} - Error is not retryable`);
|
|
50
|
-
if (response) {
|
|
51
|
-
utils_1.displayHttpDiagnostics(response);
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
core.info(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
|
|
56
|
-
yield utils_1.sleep(utils_1.getExponentialRetryTimeInMilliseconds(attempt));
|
|
57
|
-
attempt++;
|
|
58
|
-
}
|
|
59
|
-
if (response) {
|
|
60
|
-
utils_1.displayHttpDiagnostics(response);
|
|
61
|
-
}
|
|
62
|
-
if (customErrorInformation) {
|
|
63
|
-
throw Error(`${name} failed: ${customErrorInformation}`);
|
|
64
|
-
}
|
|
65
|
-
throw Error(`${name} failed: ${errorMessage}`);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
exports.retry = retry;
|
|
69
|
-
function retryHttpClientRequest(name, method, customErrorMessages = new Map(), maxAttempts = config_variables_1.getRetryLimit()) {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
return yield retry(name, method, customErrorMessages, maxAttempts);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
exports.retryHttpClientRequest = retryHttpClientRequest;
|
|
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 utils_1 = require("./utils");
|
|
20
|
+
const core = __importStar(require("@actions/core"));
|
|
21
|
+
const config_variables_1 = require("./config-variables");
|
|
22
|
+
function retry(name, operation, customErrorMessages, maxAttempts) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
let response = undefined;
|
|
25
|
+
let statusCode = undefined;
|
|
26
|
+
let isRetryable = false;
|
|
27
|
+
let errorMessage = '';
|
|
28
|
+
let customErrorInformation = undefined;
|
|
29
|
+
let attempt = 1;
|
|
30
|
+
while (attempt <= maxAttempts) {
|
|
31
|
+
try {
|
|
32
|
+
response = yield operation();
|
|
33
|
+
statusCode = response.message.statusCode;
|
|
34
|
+
if (utils_1.isSuccessStatusCode(statusCode)) {
|
|
35
|
+
return response;
|
|
36
|
+
}
|
|
37
|
+
// Extra error information that we want to display if a particular response code is hit
|
|
38
|
+
if (statusCode) {
|
|
39
|
+
customErrorInformation = customErrorMessages.get(statusCode);
|
|
40
|
+
}
|
|
41
|
+
isRetryable = utils_1.isRetryableStatusCode(statusCode);
|
|
42
|
+
errorMessage = `Artifact service responded with ${statusCode}`;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
isRetryable = true;
|
|
46
|
+
errorMessage = error.message;
|
|
47
|
+
}
|
|
48
|
+
if (!isRetryable) {
|
|
49
|
+
core.info(`${name} - Error is not retryable`);
|
|
50
|
+
if (response) {
|
|
51
|
+
utils_1.displayHttpDiagnostics(response);
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
core.info(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
|
|
56
|
+
yield utils_1.sleep(utils_1.getExponentialRetryTimeInMilliseconds(attempt));
|
|
57
|
+
attempt++;
|
|
58
|
+
}
|
|
59
|
+
if (response) {
|
|
60
|
+
utils_1.displayHttpDiagnostics(response);
|
|
61
|
+
}
|
|
62
|
+
if (customErrorInformation) {
|
|
63
|
+
throw Error(`${name} failed: ${customErrorInformation}`);
|
|
64
|
+
}
|
|
65
|
+
throw Error(`${name} failed: ${errorMessage}`);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.retry = retry;
|
|
69
|
+
function retryHttpClientRequest(name, method, customErrorMessages = new Map(), maxAttempts = config_variables_1.getRetryLimit()) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
return yield retry(name, method, customErrorMessages, maxAttempts);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
exports.retryHttpClientRequest = retryHttpClientRequest;
|
|
75
75
|
//# sourceMappingURL=requestUtils.js.map
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Status Reporter that displays information about the progress/status of an artifact that is being uploaded or downloaded
|
|
3
|
-
*
|
|
4
|
-
* Variable display time that can be adjusted using the displayFrequencyInMilliseconds variable
|
|
5
|
-
* The total status of the upload/download gets displayed according to this value
|
|
6
|
-
* If there is a large file that is being uploaded, extra information about the individual status can also be displayed using the updateLargeFileStatus function
|
|
7
|
-
*/
|
|
8
|
-
export declare class StatusReporter {
|
|
9
|
-
private totalNumberOfFilesToProcess;
|
|
10
|
-
private processedCount;
|
|
11
|
-
private displayFrequencyInMilliseconds;
|
|
12
|
-
private largeFiles;
|
|
13
|
-
private totalFileStatus;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Status Reporter that displays information about the progress/status of an artifact that is being uploaded or downloaded
|
|
3
|
+
*
|
|
4
|
+
* Variable display time that can be adjusted using the displayFrequencyInMilliseconds variable
|
|
5
|
+
* The total status of the upload/download gets displayed according to this value
|
|
6
|
+
* If there is a large file that is being uploaded, extra information about the individual status can also be displayed using the updateLargeFileStatus function
|
|
7
|
+
*/
|
|
8
|
+
export declare class StatusReporter {
|
|
9
|
+
private totalNumberOfFilesToProcess;
|
|
10
|
+
private processedCount;
|
|
11
|
+
private displayFrequencyInMilliseconds;
|
|
12
|
+
private largeFiles;
|
|
13
|
+
private totalFileStatus;
|
|
14
|
+
constructor(displayFrequencyInMilliseconds: number);
|
|
15
|
+
setTotalNumberOfFilesToProcess(fileTotal: number): void;
|
|
16
|
+
start(): void;
|
|
17
|
+
updateLargeFileStatus(fileName: string, chunkStartIndex: number, chunkEndIndex: number, totalUploadFileSize: number): void;
|
|
18
|
+
stop(): void;
|
|
19
|
+
incrementProcessedCount(): void;
|
|
20
|
+
private formatPercentage;
|
|
21
|
+
}
|