@actions/artifact 5.0.2 → 6.0.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/README.md +0 -1
- package/lib/artifact.d.ts +4 -4
- package/lib/artifact.js +6 -22
- package/lib/artifact.js.map +1 -1
- package/lib/generated/google/protobuf/timestamp.js +21 -24
- package/lib/generated/google/protobuf/timestamp.js.map +1 -1
- package/lib/generated/google/protobuf/wrappers.js +74 -77
- package/lib/generated/google/protobuf/wrappers.js.map +1 -1
- package/lib/generated/index.d.ts +4 -4
- package/lib/generated/index.js +4 -20
- package/lib/generated/index.js.map +1 -1
- package/lib/generated/results/api/v1/artifact.d.ts +3 -3
- package/lib/generated/results/api/v1/artifact.js +168 -171
- package/lib/generated/results/api/v1/artifact.js.map +1 -1
- package/lib/generated/results/api/v1/artifact.twirp-client.d.ts +1 -1
- package/lib/generated/results/api/v1/artifact.twirp-client.js +23 -28
- package/lib/generated/results/api/v1/artifact.twirp-client.js.map +1 -1
- package/lib/internal/client.d.ts +1 -1
- package/lib/internal/client.js +33 -37
- package/lib/internal/client.js.map +1 -1
- package/lib/internal/delete/delete-artifact.d.ts +1 -1
- package/lib/internal/delete/delete-artifact.js +25 -29
- package/lib/internal/delete/delete-artifact.js.map +1 -1
- package/lib/internal/download/download-artifact.d.ts +1 -1
- package/lib/internal/download/download-artifact.js +25 -66
- package/lib/internal/download/download-artifact.js.map +1 -1
- package/lib/internal/find/get-artifact.d.ts +1 -1
- package/lib/internal/find/get-artifact.js +23 -60
- package/lib/internal/find/get-artifact.js.map +1 -1
- package/lib/internal/find/list-artifacts.d.ts +1 -1
- package/lib/internal/find/list-artifacts.js +25 -29
- package/lib/internal/find/list-artifacts.js.map +1 -1
- package/lib/internal/find/retry-options.d.ts +1 -1
- package/lib/internal/find/retry-options.js +2 -38
- package/lib/internal/find/retry-options.js.map +1 -1
- package/lib/internal/shared/artifact-twirp-client.d.ts +1 -1
- package/lib/internal/shared/artifact-twirp-client.js +32 -35
- package/lib/internal/shared/artifact-twirp-client.js.map +1 -1
- package/lib/internal/shared/config.js +13 -26
- package/lib/internal/shared/config.js.map +1 -1
- package/lib/internal/shared/errors.js +6 -15
- package/lib/internal/shared/errors.js.map +1 -1
- package/lib/internal/shared/interfaces.js +1 -2
- package/lib/internal/shared/package-version.cjs +7 -0
- package/lib/internal/shared/user-agent.js +3 -7
- package/lib/internal/shared/user-agent.js.map +1 -1
- package/lib/internal/shared/util.js +13 -54
- package/lib/internal/shared/util.js.map +1 -1
- package/lib/internal/upload/blob-upload.d.ts +1 -1
- package/lib/internal/upload/blob-upload.js +13 -49
- package/lib/internal/upload/blob-upload.js.map +1 -1
- package/lib/internal/upload/path-and-artifact-name-validation.js +4 -8
- package/lib/internal/upload/path-and-artifact-name-validation.js.map +1 -1
- package/lib/internal/upload/retention.d.ts +1 -1
- package/lib/internal/upload/retention.js +4 -40
- package/lib/internal/upload/retention.js.map +1 -1
- package/lib/internal/upload/upload-artifact.d.ts +1 -1
- package/lib/internal/upload/upload-artifact.js +23 -59
- package/lib/internal/upload/upload-artifact.js.map +1 -1
- package/lib/internal/upload/upload-zip-specification.js +13 -50
- package/lib/internal/upload/upload-zip-specification.js.map +1 -1
- package/lib/internal/upload/zip.d.ts +1 -1
- package/lib/internal/upload/zip.js +12 -50
- package/lib/internal/upload/zip.js.map +1 -1
- package/package.json +24 -16
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,15 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
8
|
});
|
|
43
9
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const errors_1 = require("../shared/errors");
|
|
52
|
-
function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
10
|
+
import { BlobClient } from '@azure/storage-blob';
|
|
11
|
+
import { getUploadChunkSize, getConcurrency, getUploadChunkTimeout } from '../shared/config.js';
|
|
12
|
+
import * as core from '@actions/core';
|
|
13
|
+
import * as crypto from 'crypto';
|
|
14
|
+
import * as stream from 'stream';
|
|
15
|
+
import { NetworkError } from '../shared/errors.js';
|
|
16
|
+
export function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
53
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
18
|
let uploadByteCount = 0;
|
|
55
19
|
let lastProgressTime = Date.now();
|
|
@@ -67,9 +31,9 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
|
67
31
|
});
|
|
68
32
|
});
|
|
69
33
|
});
|
|
70
|
-
const maxConcurrency =
|
|
71
|
-
const bufferSize =
|
|
72
|
-
const blobClient = new
|
|
34
|
+
const maxConcurrency = getConcurrency();
|
|
35
|
+
const bufferSize = getUploadChunkSize();
|
|
36
|
+
const blobClient = new BlobClient(authenticatedUploadURL);
|
|
73
37
|
const blockBlobClient = blobClient.getBlockBlobClient();
|
|
74
38
|
core.debug(`Uploading artifact zip to blob storage with maxConcurrency: ${maxConcurrency}, bufferSize: ${bufferSize}`);
|
|
75
39
|
const uploadCallback = (progress) => {
|
|
@@ -91,12 +55,12 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|
|
91
55
|
try {
|
|
92
56
|
yield Promise.race([
|
|
93
57
|
blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options),
|
|
94
|
-
chunkTimer(
|
|
58
|
+
chunkTimer(getUploadChunkTimeout())
|
|
95
59
|
]);
|
|
96
60
|
}
|
|
97
61
|
catch (error) {
|
|
98
|
-
if (
|
|
99
|
-
throw new
|
|
62
|
+
if (NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
|
|
63
|
+
throw new NetworkError(error === null || error === void 0 ? void 0 : error.code);
|
|
100
64
|
}
|
|
101
65
|
throw error;
|
|
102
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-upload.js","sourceRoot":"","sources":["../../../src/internal/upload/blob-upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blob-upload.js","sourceRoot":"","sources":["../../../src/internal/upload/blob-upload.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAA+B,MAAM,qBAAqB,CAAA;AAG5E,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAA;AAchD,MAAM,UAAgB,sBAAsB,CAC1C,sBAA8B,EAC9B,eAAgC;;QAEhC,IAAI,eAAe,GAAG,CAAC,CAAA;QACvB,IAAI,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACjC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;QAE7C,MAAM,UAAU,GAAG,CAAO,QAAgB,EAAiB,EAAE;YAC3D,OAAA,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;oBAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,gBAAgB,GAAG,QAAQ,EAAE,CAAC;wBAC7C,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAA;oBAC/C,CAAC;gBACH,CAAC,EAAE,QAAQ,CAAC,CAAA;gBAEZ,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;oBACpD,aAAa,CAAC,KAAK,CAAC,CAAA;oBACpB,OAAO,EAAE,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OAAO,CACR;gBACD,UAAU,CAAC,qBAAqB,EAAE,CAAC;aACpC,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,YAAY,CAAC,kBAAkB,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,EAAE,CAAC;gBACjD,MAAM,IAAI,YAAY,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,CAAA;YACrC,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;gBAAS,CAAC;YACT,eAAe,CAAC,KAAK,EAAE,CAAA;QACzB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAA;QAEjE,UAAU,CAAC,GAAG,EAAE,CAAA;QAChB,UAAU,GAAG,UAAU,CAAC,IAAI,EAAY,CAAA;QACxC,IAAI,CAAC,IAAI,CAAC,6CAA6C,UAAU,EAAE,CAAC,CAAA;QAEpE,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CACV,wEAAwE,CACzE,CAAA;QACH,CAAC;QACD,OAAO;YACL,UAAU,EAAE,eAAe;YAC3B,UAAU;SACX,CAAA;IACH,CAAC;CAAA"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateArtifactName = validateArtifactName;
|
|
4
|
-
exports.validateFilePath = validateFilePath;
|
|
5
|
-
const core_1 = require("@actions/core");
|
|
1
|
+
import { info } from '@actions/core';
|
|
6
2
|
/**
|
|
7
3
|
* Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected
|
|
8
4
|
* from the server if attempted to be sent over. These characters are not allowed due to limitations with certain
|
|
@@ -30,7 +26,7 @@ const invalidArtifactNameCharacters = new Map([
|
|
|
30
26
|
/**
|
|
31
27
|
* Validates the name of the artifact to check to make sure there are no illegal characters
|
|
32
28
|
*/
|
|
33
|
-
function validateArtifactName(name) {
|
|
29
|
+
export function validateArtifactName(name) {
|
|
34
30
|
if (!name) {
|
|
35
31
|
throw new Error(`Provided artifact name input during validation is empty`);
|
|
36
32
|
}
|
|
@@ -43,12 +39,12 @@ Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values())
|
|
|
43
39
|
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.`);
|
|
44
40
|
}
|
|
45
41
|
}
|
|
46
|
-
|
|
42
|
+
info(`Artifact name is valid!`);
|
|
47
43
|
}
|
|
48
44
|
/**
|
|
49
45
|
* Validates file paths to check for any illegal characters that can cause problems on different file systems
|
|
50
46
|
*/
|
|
51
|
-
function validateFilePath(path) {
|
|
47
|
+
export function validateFilePath(path) {
|
|
52
48
|
if (!path) {
|
|
53
49
|
throw new Error(`Provided file path input during validation is empty`);
|
|
54
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-and-artifact-name-validation.js","sourceRoot":"","sources":["../../../src/internal/upload/path-and-artifact-name-validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path-and-artifact-name-validation.js","sourceRoot":"","sources":["../../../src/internal/upload/path-and-artifact-name-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAA;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,CA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;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Timestamp } from '../../generated';
|
|
1
|
+
import { Timestamp } from '../../generated/index.js';
|
|
2
2
|
export declare function getExpiration(retentionDays?: number): Timestamp | undefined;
|
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.getExpiration = getExpiration;
|
|
37
|
-
const generated_1 = require("../../generated");
|
|
38
|
-
const core = __importStar(require("@actions/core"));
|
|
39
|
-
function getExpiration(retentionDays) {
|
|
1
|
+
import { Timestamp } from '../../generated/index.js';
|
|
2
|
+
import * as core from '@actions/core';
|
|
3
|
+
export function getExpiration(retentionDays) {
|
|
40
4
|
if (!retentionDays) {
|
|
41
5
|
return undefined;
|
|
42
6
|
}
|
|
@@ -47,7 +11,7 @@ function getExpiration(retentionDays) {
|
|
|
47
11
|
}
|
|
48
12
|
const expirationDate = new Date();
|
|
49
13
|
expirationDate.setDate(expirationDate.getDate() + retentionDays);
|
|
50
|
-
return
|
|
14
|
+
return Timestamp.fromDate(expirationDate);
|
|
51
15
|
}
|
|
52
16
|
function getRetentionDays() {
|
|
53
17
|
const retentionDays = process.env['GITHUB_RETENTION_DAYS'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retention.js","sourceRoot":"","sources":["../../../src/internal/upload/retention.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retention.js","sourceRoot":"","sources":["../../../src/internal/upload/retention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AAErC,MAAM,UAAU,aAAa,CAAC,aAAsB;IAClD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,CAAA;IAC3C,IAAI,gBAAgB,IAAI,gBAAgB,GAAG,aAAa,EAAE,CAAC;QACzD,IAAI,CAAC,OAAO,CACV,wGAAwG,gBAAgB,WAAW,CACpI,CAAA;QACD,aAAa,GAAG,gBAAgB,CAAA;IAClC,CAAC;IAED,MAAM,cAAc,GAAG,IAAI,IAAI,EAAE,CAAA;IACjC,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,aAAa,CAAC,CAAA;IAEhE,OAAO,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAC1D,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;IACpC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAChB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UploadArtifactOptions, UploadArtifactResponse } from '../shared/interfaces';
|
|
1
|
+
import { UploadArtifactOptions, UploadArtifactResponse } from '../shared/interfaces.js';
|
|
2
2
|
export declare function uploadArtifact(name: string, files: string[], rootDirectory: string, options?: UploadArtifactOptions | undefined): Promise<UploadArtifactResponse>;
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,30 +7,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
8
|
});
|
|
43
9
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const errors_1 = require("../shared/errors");
|
|
56
|
-
function uploadArtifact(name, files, rootDirectory, options) {
|
|
10
|
+
import * as core from '@actions/core';
|
|
11
|
+
import { getExpiration } from './retention.js';
|
|
12
|
+
import { validateArtifactName } from './path-and-artifact-name-validation.js';
|
|
13
|
+
import { internalArtifactTwirpClient } from '../shared/artifact-twirp-client.js';
|
|
14
|
+
import { getUploadZipSpecification, validateRootDirectory } from './upload-zip-specification.js';
|
|
15
|
+
import { getBackendIdsFromToken } from '../shared/util.js';
|
|
16
|
+
import { uploadZipToBlobStorage } from './blob-upload.js';
|
|
17
|
+
import { createZipUploadStream } from './zip.js';
|
|
18
|
+
import { StringValue } from '../../generated/index.js';
|
|
19
|
+
import { FilesNotFoundError, InvalidResponseError } from '../shared/errors.js';
|
|
20
|
+
export function uploadArtifact(name, files, rootDirectory, options) {
|
|
57
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const zipSpecification =
|
|
22
|
+
validateArtifactName(name);
|
|
23
|
+
validateRootDirectory(rootDirectory);
|
|
24
|
+
const zipSpecification = getUploadZipSpecification(files, rootDirectory);
|
|
61
25
|
if (zipSpecification.length === 0) {
|
|
62
|
-
throw new
|
|
26
|
+
throw new FilesNotFoundError(zipSpecification.flatMap(s => (s.sourcePath ? [s.sourcePath] : [])));
|
|
63
27
|
}
|
|
64
28
|
// get the IDs needed for the artifact creation
|
|
65
|
-
const backendIds =
|
|
29
|
+
const backendIds = getBackendIdsFromToken();
|
|
66
30
|
// create the artifact client
|
|
67
|
-
const artifactClient =
|
|
31
|
+
const artifactClient = internalArtifactTwirpClient();
|
|
68
32
|
// create the artifact
|
|
69
33
|
const createArtifactReq = {
|
|
70
34
|
workflowRunBackendId: backendIds.workflowRunBackendId,
|
|
@@ -73,17 +37,17 @@ function uploadArtifact(name, files, rootDirectory, options) {
|
|
|
73
37
|
version: 4
|
|
74
38
|
};
|
|
75
39
|
// if there is a retention period, add it to the request
|
|
76
|
-
const expiresAt =
|
|
40
|
+
const expiresAt = getExpiration(options === null || options === void 0 ? void 0 : options.retentionDays);
|
|
77
41
|
if (expiresAt) {
|
|
78
42
|
createArtifactReq.expiresAt = expiresAt;
|
|
79
43
|
}
|
|
80
44
|
const createArtifactResp = yield artifactClient.CreateArtifact(createArtifactReq);
|
|
81
45
|
if (!createArtifactResp.ok) {
|
|
82
|
-
throw new
|
|
46
|
+
throw new InvalidResponseError('CreateArtifact: response from backend was not ok');
|
|
83
47
|
}
|
|
84
|
-
const zipUploadStream = yield
|
|
48
|
+
const zipUploadStream = yield createZipUploadStream(zipSpecification, options === null || options === void 0 ? void 0 : options.compressionLevel);
|
|
85
49
|
// Upload zip to blob storage
|
|
86
|
-
const uploadResult = yield
|
|
50
|
+
const uploadResult = yield uploadZipToBlobStorage(createArtifactResp.signedUploadUrl, zipUploadStream);
|
|
87
51
|
// finalize the artifact
|
|
88
52
|
const finalizeArtifactReq = {
|
|
89
53
|
workflowRunBackendId: backendIds.workflowRunBackendId,
|
|
@@ -92,14 +56,14 @@ function uploadArtifact(name, files, rootDirectory, options) {
|
|
|
92
56
|
size: uploadResult.uploadSize ? uploadResult.uploadSize.toString() : '0'
|
|
93
57
|
};
|
|
94
58
|
if (uploadResult.sha256Hash) {
|
|
95
|
-
finalizeArtifactReq.hash =
|
|
59
|
+
finalizeArtifactReq.hash = StringValue.create({
|
|
96
60
|
value: `sha256:${uploadResult.sha256Hash}`
|
|
97
61
|
});
|
|
98
62
|
}
|
|
99
63
|
core.info(`Finalizing artifact upload`);
|
|
100
64
|
const finalizeArtifactResp = yield artifactClient.FinalizeArtifact(finalizeArtifactReq);
|
|
101
65
|
if (!finalizeArtifactResp.ok) {
|
|
102
|
-
throw new
|
|
66
|
+
throw new InvalidResponseError('FinalizeArtifact: response from backend was not ok');
|
|
103
67
|
}
|
|
104
68
|
const artifactId = BigInt(finalizeArtifactResp.artifactId);
|
|
105
69
|
core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-artifact.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-artifact.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-artifact.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-artifact.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO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c,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;QAC5D,IAAI,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC;YAC7B,MAAM,IAAI,oBAAoB,CAC5B,oDAAoD,CACrD,CAAA;QACH,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAA;QAC1D,IAAI,CAAC,IAAI,CACP,YAAY,IAAI,4CAA4C,UAAU,EAAE,CACzE,CAAA;QAED,OAAO;YACL,IAAI,EAAE,YAAY,CAAC,UAAU;YAC7B,MAAM,EAAE,YAAY,CAAC,UAAU;YAC/B,EAAE,EAAE,MAAM,CAAC,UAAU,CAAC;SACvB,CAAA;IACH,CAAC;CAAA"}
|
|
@@ -1,67 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.validateRootDirectory = validateRootDirectory;
|
|
37
|
-
exports.getUploadZipSpecification = getUploadZipSpecification;
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const core_1 = require("@actions/core");
|
|
40
|
-
const path_1 = require("path");
|
|
41
|
-
const path_and_artifact_name_validation_1 = require("./path-and-artifact-name-validation");
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import { info } from '@actions/core';
|
|
3
|
+
import { normalize, resolve } from 'path';
|
|
4
|
+
import { validateFilePath } from './path-and-artifact-name-validation.js';
|
|
42
5
|
/**
|
|
43
6
|
* Checks if a root directory exists and is valid
|
|
44
7
|
* @param rootDirectory an absolute root directory path common to all input files that that will be trimmed from the final zip structure
|
|
45
8
|
*/
|
|
46
|
-
function validateRootDirectory(rootDirectory) {
|
|
9
|
+
export function validateRootDirectory(rootDirectory) {
|
|
47
10
|
if (!fs.existsSync(rootDirectory)) {
|
|
48
11
|
throw new Error(`The provided rootDirectory ${rootDirectory} does not exist`);
|
|
49
12
|
}
|
|
50
13
|
if (!fs.statSync(rootDirectory).isDirectory()) {
|
|
51
14
|
throw new Error(`The provided rootDirectory ${rootDirectory} is not a valid directory`);
|
|
52
15
|
}
|
|
53
|
-
|
|
16
|
+
info(`Root directory input is valid!`);
|
|
54
17
|
}
|
|
55
18
|
/**
|
|
56
19
|
* Creates a specification that describes how a zip file will be created for a set of input files
|
|
57
20
|
* @param filesToZip a list of file that should be included in the zip
|
|
58
21
|
* @param rootDirectory an absolute root directory path common to all input files that that will be trimmed from the final zip structure
|
|
59
22
|
*/
|
|
60
|
-
function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
23
|
+
export function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
61
24
|
const specification = [];
|
|
62
25
|
// Normalize and resolve, this allows for either absolute or relative paths to be used
|
|
63
|
-
rootDirectory =
|
|
64
|
-
rootDirectory =
|
|
26
|
+
rootDirectory = normalize(rootDirectory);
|
|
27
|
+
rootDirectory = resolve(rootDirectory);
|
|
65
28
|
/*
|
|
66
29
|
Example
|
|
67
30
|
|
|
@@ -95,14 +58,14 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
|
95
58
|
}
|
|
96
59
|
if (!stats.isDirectory()) {
|
|
97
60
|
// Normalize and resolve, this allows for either absolute or relative paths to be used
|
|
98
|
-
file =
|
|
99
|
-
file =
|
|
61
|
+
file = normalize(file);
|
|
62
|
+
file = resolve(file);
|
|
100
63
|
if (!file.startsWith(rootDirectory)) {
|
|
101
64
|
throw new Error(`The rootDirectory: ${rootDirectory} is not a parent directory of the file: ${file}`);
|
|
102
65
|
}
|
|
103
66
|
// Check for forbidden characters in file paths that may cause ambiguous behavior if downloaded on different file systems
|
|
104
67
|
const uploadPath = file.replace(rootDirectory, '');
|
|
105
|
-
|
|
68
|
+
validateFilePath(uploadPath);
|
|
106
69
|
specification.push({
|
|
107
70
|
sourcePath: file,
|
|
108
71
|
destinationPath: uploadPath,
|
|
@@ -112,7 +75,7 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
|
|
|
112
75
|
else {
|
|
113
76
|
// Empty directory
|
|
114
77
|
const directoryPath = file.replace(rootDirectory, '');
|
|
115
|
-
|
|
78
|
+
validateFilePath(directoryPath);
|
|
116
79
|
specification.push({
|
|
117
80
|
sourcePath: null,
|
|
118
81
|
destinationPath: directoryPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-zip-specification.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-zip-specification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-zip-specification.js","sourceRoot":"","sources":["../../../src/internal/upload/upload-zip-specification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAA;AAClC,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,MAAM,CAAA;AACvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,wCAAwC,CAAA;AAoBvE;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAqB;IACzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,iBAAiB,CAC7D,CAAA;IACH,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,2BAA2B,CACvE,CAAA;IACH,CAAC;IACD,IAAI,CAAC,gCAAgC,CAAC,CAAA;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAoB,EACpB,aAAqB;IAErB,MAAM,aAAa,GAA6B,EAAE,CAAA;IAElD,sFAAsF;IACtF,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC,CAAA;IACxC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAEtC;;;;;;;;;;;;;;;;;;;;;;;;;MAyBE;IACF,KAAK,IAAI,IAAI,IAAI,UAAU,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAC,cAAc,EAAE,KAAK,EAAC,CAAC,CAAA;QACzD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,iBAAiB,CAAC,CAAA;QAChD,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACzB,sFAAsF;YACtF,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;YACtB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;YACpB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;gBACpC,MAAM,IAAI,KAAK,CACb,sBAAsB,aAAa,2CAA2C,IAAI,EAAE,CACrF,CAAA;YACH,CAAC;YAED,yHAAyH;YACzH,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YAClD,gBAAgB,CAAC,UAAU,CAAC,CAAA;YAE5B,aAAa,CAAC,IAAI,CAAC;gBACjB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,UAAU;gBAC3B,KAAK;aACN,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,kBAAkB;YAClB,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YACrD,gBAAgB,CAAC,aAAa,CAAC,CAAA;YAE/B,aAAa,CAAC,IAAI,CAAC;gBACjB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,aAAa;gBAC9B,KAAK;aACN,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as stream from 'stream';
|
|
2
|
-
import { UploadZipSpecification } from './upload-zip-specification';
|
|
2
|
+
import { UploadZipSpecification } from './upload-zip-specification.js';
|
|
3
3
|
export declare const DEFAULT_COMPRESSION_LEVEL = 6;
|
|
4
4
|
export declare class ZipUploadStream extends stream.Transform {
|
|
5
5
|
constructor(bufferSize: number);
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,18 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
8
|
});
|
|
43
9
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
const core = __importStar(require("@actions/core"));
|
|
51
|
-
const config_1 = require("../shared/config");
|
|
52
|
-
exports.DEFAULT_COMPRESSION_LEVEL = 6;
|
|
10
|
+
import * as stream from 'stream';
|
|
11
|
+
import { realpath } from 'fs/promises';
|
|
12
|
+
import archiver from 'archiver';
|
|
13
|
+
import * as core from '@actions/core';
|
|
14
|
+
import { getUploadChunkSize } from '../shared/config.js';
|
|
15
|
+
export const DEFAULT_COMPRESSION_LEVEL = 6;
|
|
53
16
|
// Custom stream transformer so we can set the highWaterMark property
|
|
54
17
|
// See https://github.com/nodejs/node/issues/8855
|
|
55
|
-
class ZipUploadStream extends stream.Transform {
|
|
18
|
+
export class ZipUploadStream extends stream.Transform {
|
|
56
19
|
constructor(bufferSize) {
|
|
57
20
|
super({
|
|
58
21
|
highWaterMark: bufferSize
|
|
@@ -63,12 +26,11 @@ class ZipUploadStream extends stream.Transform {
|
|
|
63
26
|
cb(null, chunk);
|
|
64
27
|
}
|
|
65
28
|
}
|
|
66
|
-
|
|
67
|
-
function
|
|
68
|
-
return __awaiter(this, arguments, void 0, function* (uploadSpecification, compressionLevel = exports.DEFAULT_COMPRESSION_LEVEL) {
|
|
29
|
+
export function createZipUploadStream(uploadSpecification_1) {
|
|
30
|
+
return __awaiter(this, arguments, void 0, function* (uploadSpecification, compressionLevel = DEFAULT_COMPRESSION_LEVEL) {
|
|
69
31
|
core.debug(`Creating Artifact archive with compressionLevel: ${compressionLevel}`);
|
|
70
32
|
const zip = archiver.create('zip', {
|
|
71
|
-
highWaterMark:
|
|
33
|
+
highWaterMark: getUploadChunkSize(),
|
|
72
34
|
zlib: { level: compressionLevel }
|
|
73
35
|
});
|
|
74
36
|
// register callbacks for various events during the zip lifecycle
|
|
@@ -81,7 +43,7 @@ function createZipUploadStream(uploadSpecification_1) {
|
|
|
81
43
|
// Check if symlink and resolve the source path
|
|
82
44
|
let sourcePath = file.sourcePath;
|
|
83
45
|
if (file.stats.isSymbolicLink()) {
|
|
84
|
-
sourcePath = yield
|
|
46
|
+
sourcePath = yield realpath(file.sourcePath);
|
|
85
47
|
}
|
|
86
48
|
// Add the file to the zip
|
|
87
49
|
zip.file(sourcePath, {
|
|
@@ -93,7 +55,7 @@ function createZipUploadStream(uploadSpecification_1) {
|
|
|
93
55
|
zip.append('', { name: file.destinationPath });
|
|
94
56
|
}
|
|
95
57
|
}
|
|
96
|
-
const bufferSize =
|
|
58
|
+
const bufferSize = getUploadChunkSize();
|
|
97
59
|
const zipUploadStream = new ZipUploadStream(bufferSize);
|
|
98
60
|
core.debug(`Zip write high watermark value ${zipUploadStream.writableHighWaterMark}`);
|
|
99
61
|
core.debug(`Zip read high watermark value ${zipUploadStream.readableHighWaterMark}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../../src/internal/upload/zip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../../src/internal/upload/zip.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AACpC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AAErC,OAAO,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAA;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAA;AAE1C,qEAAqE;AACrE,iDAAiD;AACjD,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,SAAS;IACnD,YAAY,UAAkB;QAC5B,KAAK,CAAC;YACJ,aAAa,EAAE,UAAU;SAC1B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