@actions/cache 1.0.5 → 1.0.9
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 +44 -44
- package/lib/cache.d.ts +26 -26
- package/lib/cache.js +164 -146
- package/lib/cache.js.map +1 -1
- package/lib/internal/cacheHttpClient.d.ts +8 -8
- package/lib/internal/cacheHttpClient.js +215 -214
- package/lib/internal/cacheHttpClient.js.map +1 -1
- package/lib/internal/cacheUtils.d.ts +11 -11
- package/lib/internal/cacheUtils.js +169 -169
- package/lib/internal/constants.d.ts +12 -12
- package/lib/internal/constants.js +23 -23
- package/lib/internal/downloadUtils.d.ts +74 -74
- package/lib/internal/downloadUtils.js +229 -229
- package/lib/internal/downloadUtils.js.map +1 -1
- package/lib/internal/requestUtils.d.ts +7 -7
- package/lib/internal/requestUtils.js +118 -118
- package/lib/internal/tar.d.ts +4 -3
- package/lib/internal/tar.js +163 -124
- package/lib/internal/tar.js.map +1 -1
- package/lib/options.d.ts +56 -56
- package/lib/options.js +61 -61
- package/package.json +55 -55
|
@@ -1,215 +1,216 @@
|
|
|
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 core = __importStar(require("@actions/core"));
|
|
20
|
-
const http_client_1 = require("@actions/http-client");
|
|
21
|
-
const auth_1 = require("@actions/http-client/auth");
|
|
22
|
-
const crypto = __importStar(require("crypto"));
|
|
23
|
-
const fs = __importStar(require("fs"));
|
|
24
|
-
const url_1 = require("url");
|
|
25
|
-
const utils = __importStar(require("./cacheUtils"));
|
|
26
|
-
const constants_1 = require("./constants");
|
|
27
|
-
const downloadUtils_1 = require("./downloadUtils");
|
|
28
|
-
const options_1 = require("../options");
|
|
29
|
-
const requestUtils_1 = require("./requestUtils");
|
|
30
|
-
const versionSalt = '1.0';
|
|
31
|
-
function getCacheApiUrl(resource) {
|
|
32
|
-
// Ideally we just use ACTIONS_CACHE_URL
|
|
33
|
-
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
|
34
|
-
process.env['ACTIONS_RUNTIME_URL'] ||
|
|
35
|
-
'').replace('pipelines', 'artifactcache');
|
|
36
|
-
if (!baseUrl) {
|
|
37
|
-
throw new Error('Cache Service Url not found, unable to restore cache.');
|
|
38
|
-
}
|
|
39
|
-
const url = `${baseUrl}_apis/artifactcache/${resource}`;
|
|
40
|
-
core.debug(`Resource Url: ${url}`);
|
|
41
|
-
return url;
|
|
42
|
-
}
|
|
43
|
-
function createAcceptHeader(type, apiVersion) {
|
|
44
|
-
return `${type};api-version=${apiVersion}`;
|
|
45
|
-
}
|
|
46
|
-
function getRequestOptions() {
|
|
47
|
-
const requestOptions = {
|
|
48
|
-
headers: {
|
|
49
|
-
Accept: createAcceptHeader('application/json', '6.0-preview.1')
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return requestOptions;
|
|
53
|
-
}
|
|
54
|
-
function createHttpClient() {
|
|
55
|
-
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
|
56
|
-
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
|
57
|
-
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
|
|
58
|
-
}
|
|
59
|
-
function getCacheVersion(paths, compressionMethod) {
|
|
60
|
-
const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip
|
|
61
|
-
? []
|
|
62
|
-
: [compressionMethod]);
|
|
63
|
-
// Add salt to cache version to support breaking changes in cache entry
|
|
64
|
-
components.push(versionSalt);
|
|
65
|
-
return crypto
|
|
66
|
-
.createHash('sha256')
|
|
67
|
-
.update(components.join('|'))
|
|
68
|
-
.digest('hex');
|
|
69
|
-
}
|
|
70
|
-
exports.getCacheVersion = getCacheVersion;
|
|
71
|
-
function getCacheEntry(keys, paths, options) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const httpClient = createHttpClient();
|
|
74
|
-
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
|
75
|
-
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
|
76
|
-
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
|
77
|
-
if (response.statusCode === 204) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
|
|
81
|
-
throw new Error(`Cache service responded with ${response.statusCode}`);
|
|
82
|
-
}
|
|
83
|
-
const cacheResult = response.result;
|
|
84
|
-
const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation;
|
|
85
|
-
if (!cacheDownloadUrl) {
|
|
86
|
-
throw new Error('Cache not found.');
|
|
87
|
-
}
|
|
88
|
-
core.setSecret(cacheDownloadUrl);
|
|
89
|
-
core.debug(`Cache Result:`);
|
|
90
|
-
core.debug(JSON.stringify(cacheResult));
|
|
91
|
-
return cacheResult;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
exports.getCacheEntry = getCacheEntry;
|
|
95
|
-
function downloadCache(archiveLocation, archivePath, options) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
const archiveUrl = new url_1.URL(archiveLocation);
|
|
98
|
-
const downloadOptions = options_1.getDownloadOptions(options);
|
|
99
|
-
if (downloadOptions.useAzureSdk &&
|
|
100
|
-
archiveUrl.hostname.endsWith('.blob.core.windows.net')) {
|
|
101
|
-
// Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability.
|
|
102
|
-
yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
// Otherwise, download using the Actions http-client.
|
|
106
|
-
yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
exports.downloadCache = downloadCache;
|
|
111
|
-
// Reserve Cache
|
|
112
|
-
function reserveCache(key, paths, options) {
|
|
113
|
-
var _a, _b;
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const httpClient = createHttpClient();
|
|
116
|
-
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
|
117
|
-
const reserveCacheRequest = {
|
|
118
|
-
key,
|
|
119
|
-
version
|
|
120
|
-
};
|
|
121
|
-
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
|
123
|
-
}));
|
|
124
|
-
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
exports.reserveCache = reserveCache;
|
|
128
|
-
function getContentRange(start, end) {
|
|
129
|
-
// Format: `bytes start-end/filesize
|
|
130
|
-
// start and end are inclusive
|
|
131
|
-
// filesize can be *
|
|
132
|
-
// For a 200 byte chunk starting at byte 0:
|
|
133
|
-
// Content-Range: bytes 0-199/*
|
|
134
|
-
return `bytes ${start}-${end}/*`;
|
|
135
|
-
}
|
|
136
|
-
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
|
|
137
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
core.debug(`Uploading chunk of size ${end -
|
|
139
|
-
start +
|
|
140
|
-
1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
|
|
141
|
-
const additionalHeaders = {
|
|
142
|
-
'Content-Type': 'application/octet-stream',
|
|
143
|
-
'Content-Range': getContentRange(start, end)
|
|
144
|
-
};
|
|
145
|
-
const uploadChunkResponse = yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
|
|
147
|
-
}));
|
|
148
|
-
if (!requestUtils_1.isSuccessStatusCode(uploadChunkResponse.message.statusCode)) {
|
|
149
|
-
throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function uploadFile(httpClient, cacheId, archivePath, options) {
|
|
154
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
// Upload Chunks
|
|
156
|
-
const fileSize =
|
|
157
|
-
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
|
|
158
|
-
const fd = fs.openSync(archivePath, 'r');
|
|
159
|
-
const uploadOptions = options_1.getUploadOptions(options);
|
|
160
|
-
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
|
|
161
|
-
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
|
|
162
|
-
const parallelUploads = [...new Array(concurrency).keys()];
|
|
163
|
-
core.debug('Awaiting all uploads');
|
|
164
|
-
let offset = 0;
|
|
165
|
-
try {
|
|
166
|
-
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
while (offset < fileSize) {
|
|
168
|
-
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
|
|
169
|
-
const start = offset;
|
|
170
|
-
const end = offset + chunkSize - 1;
|
|
171
|
-
offset += maxChunkSize;
|
|
172
|
-
yield uploadChunk(httpClient, resourceUrl, () => fs
|
|
173
|
-
.createReadStream(archivePath, {
|
|
174
|
-
fd,
|
|
175
|
-
start,
|
|
176
|
-
end,
|
|
177
|
-
autoClose: false
|
|
178
|
-
})
|
|
179
|
-
.on('error', error => {
|
|
180
|
-
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
|
|
181
|
-
}), start, end);
|
|
182
|
-
}
|
|
183
|
-
})));
|
|
184
|
-
}
|
|
185
|
-
finally {
|
|
186
|
-
fs.closeSync(fd);
|
|
187
|
-
}
|
|
188
|
-
return;
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
function commitCache(httpClient, cacheId, filesize) {
|
|
192
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
-
const commitCacheRequest = { size: filesize };
|
|
194
|
-
return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
|
|
196
|
-
}));
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
function saveCache(cacheId, archivePath, options) {
|
|
200
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
const httpClient = createHttpClient();
|
|
202
|
-
core.debug('Upload cache');
|
|
203
|
-
yield uploadFile(httpClient, cacheId, archivePath, options);
|
|
204
|
-
// Commit Cache
|
|
205
|
-
core.debug('Commiting cache');
|
|
206
|
-
const cacheSize = utils.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
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 core = __importStar(require("@actions/core"));
|
|
20
|
+
const http_client_1 = require("@actions/http-client");
|
|
21
|
+
const auth_1 = require("@actions/http-client/auth");
|
|
22
|
+
const crypto = __importStar(require("crypto"));
|
|
23
|
+
const fs = __importStar(require("fs"));
|
|
24
|
+
const url_1 = require("url");
|
|
25
|
+
const utils = __importStar(require("./cacheUtils"));
|
|
26
|
+
const constants_1 = require("./constants");
|
|
27
|
+
const downloadUtils_1 = require("./downloadUtils");
|
|
28
|
+
const options_1 = require("../options");
|
|
29
|
+
const requestUtils_1 = require("./requestUtils");
|
|
30
|
+
const versionSalt = '1.0';
|
|
31
|
+
function getCacheApiUrl(resource) {
|
|
32
|
+
// Ideally we just use ACTIONS_CACHE_URL
|
|
33
|
+
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
|
34
|
+
process.env['ACTIONS_RUNTIME_URL'] ||
|
|
35
|
+
'').replace('pipelines', 'artifactcache');
|
|
36
|
+
if (!baseUrl) {
|
|
37
|
+
throw new Error('Cache Service Url not found, unable to restore cache.');
|
|
38
|
+
}
|
|
39
|
+
const url = `${baseUrl}_apis/artifactcache/${resource}`;
|
|
40
|
+
core.debug(`Resource Url: ${url}`);
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
|
+
function createAcceptHeader(type, apiVersion) {
|
|
44
|
+
return `${type};api-version=${apiVersion}`;
|
|
45
|
+
}
|
|
46
|
+
function getRequestOptions() {
|
|
47
|
+
const requestOptions = {
|
|
48
|
+
headers: {
|
|
49
|
+
Accept: createAcceptHeader('application/json', '6.0-preview.1')
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return requestOptions;
|
|
53
|
+
}
|
|
54
|
+
function createHttpClient() {
|
|
55
|
+
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
|
56
|
+
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
|
57
|
+
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
|
|
58
|
+
}
|
|
59
|
+
function getCacheVersion(paths, compressionMethod) {
|
|
60
|
+
const components = paths.concat(!compressionMethod || compressionMethod === constants_1.CompressionMethod.Gzip
|
|
61
|
+
? []
|
|
62
|
+
: [compressionMethod]);
|
|
63
|
+
// Add salt to cache version to support breaking changes in cache entry
|
|
64
|
+
components.push(versionSalt);
|
|
65
|
+
return crypto
|
|
66
|
+
.createHash('sha256')
|
|
67
|
+
.update(components.join('|'))
|
|
68
|
+
.digest('hex');
|
|
69
|
+
}
|
|
70
|
+
exports.getCacheVersion = getCacheVersion;
|
|
71
|
+
function getCacheEntry(keys, paths, options) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const httpClient = createHttpClient();
|
|
74
|
+
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
|
75
|
+
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
|
76
|
+
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
|
77
|
+
if (response.statusCode === 204) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
|
|
81
|
+
throw new Error(`Cache service responded with ${response.statusCode}`);
|
|
82
|
+
}
|
|
83
|
+
const cacheResult = response.result;
|
|
84
|
+
const cacheDownloadUrl = cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.archiveLocation;
|
|
85
|
+
if (!cacheDownloadUrl) {
|
|
86
|
+
throw new Error('Cache not found.');
|
|
87
|
+
}
|
|
88
|
+
core.setSecret(cacheDownloadUrl);
|
|
89
|
+
core.debug(`Cache Result:`);
|
|
90
|
+
core.debug(JSON.stringify(cacheResult));
|
|
91
|
+
return cacheResult;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
exports.getCacheEntry = getCacheEntry;
|
|
95
|
+
function downloadCache(archiveLocation, archivePath, options) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const archiveUrl = new url_1.URL(archiveLocation);
|
|
98
|
+
const downloadOptions = options_1.getDownloadOptions(options);
|
|
99
|
+
if (downloadOptions.useAzureSdk &&
|
|
100
|
+
archiveUrl.hostname.endsWith('.blob.core.windows.net')) {
|
|
101
|
+
// Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability.
|
|
102
|
+
yield downloadUtils_1.downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// Otherwise, download using the Actions http-client.
|
|
106
|
+
yield downloadUtils_1.downloadCacheHttpClient(archiveLocation, archivePath);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
exports.downloadCache = downloadCache;
|
|
111
|
+
// Reserve Cache
|
|
112
|
+
function reserveCache(key, paths, options) {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const httpClient = createHttpClient();
|
|
116
|
+
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
|
|
117
|
+
const reserveCacheRequest = {
|
|
118
|
+
key,
|
|
119
|
+
version
|
|
120
|
+
};
|
|
121
|
+
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
|
123
|
+
}));
|
|
124
|
+
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
exports.reserveCache = reserveCache;
|
|
128
|
+
function getContentRange(start, end) {
|
|
129
|
+
// Format: `bytes start-end/filesize
|
|
130
|
+
// start and end are inclusive
|
|
131
|
+
// filesize can be *
|
|
132
|
+
// For a 200 byte chunk starting at byte 0:
|
|
133
|
+
// Content-Range: bytes 0-199/*
|
|
134
|
+
return `bytes ${start}-${end}/*`;
|
|
135
|
+
}
|
|
136
|
+
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
core.debug(`Uploading chunk of size ${end -
|
|
139
|
+
start +
|
|
140
|
+
1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
|
|
141
|
+
const additionalHeaders = {
|
|
142
|
+
'Content-Type': 'application/octet-stream',
|
|
143
|
+
'Content-Range': getContentRange(start, end)
|
|
144
|
+
};
|
|
145
|
+
const uploadChunkResponse = yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
|
|
147
|
+
}));
|
|
148
|
+
if (!requestUtils_1.isSuccessStatusCode(uploadChunkResponse.message.statusCode)) {
|
|
149
|
+
throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function uploadFile(httpClient, cacheId, archivePath, options) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
// Upload Chunks
|
|
156
|
+
const fileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
157
|
+
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
|
|
158
|
+
const fd = fs.openSync(archivePath, 'r');
|
|
159
|
+
const uploadOptions = options_1.getUploadOptions(options);
|
|
160
|
+
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
|
|
161
|
+
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
|
|
162
|
+
const parallelUploads = [...new Array(concurrency).keys()];
|
|
163
|
+
core.debug('Awaiting all uploads');
|
|
164
|
+
let offset = 0;
|
|
165
|
+
try {
|
|
166
|
+
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
while (offset < fileSize) {
|
|
168
|
+
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
|
|
169
|
+
const start = offset;
|
|
170
|
+
const end = offset + chunkSize - 1;
|
|
171
|
+
offset += maxChunkSize;
|
|
172
|
+
yield uploadChunk(httpClient, resourceUrl, () => fs
|
|
173
|
+
.createReadStream(archivePath, {
|
|
174
|
+
fd,
|
|
175
|
+
start,
|
|
176
|
+
end,
|
|
177
|
+
autoClose: false
|
|
178
|
+
})
|
|
179
|
+
.on('error', error => {
|
|
180
|
+
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
|
|
181
|
+
}), start, end);
|
|
182
|
+
}
|
|
183
|
+
})));
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
fs.closeSync(fd);
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function commitCache(httpClient, cacheId, filesize) {
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
const commitCacheRequest = { size: filesize };
|
|
194
|
+
return yield requestUtils_1.retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
|
|
196
|
+
}));
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function saveCache(cacheId, archivePath, options) {
|
|
200
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
const httpClient = createHttpClient();
|
|
202
|
+
core.debug('Upload cache');
|
|
203
|
+
yield uploadFile(httpClient, cacheId, archivePath, options);
|
|
204
|
+
// Commit Cache
|
|
205
|
+
core.debug('Commiting cache');
|
|
206
|
+
const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
207
|
+
core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
|
|
208
|
+
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
|
|
209
|
+
if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) {
|
|
210
|
+
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
|
211
|
+
}
|
|
212
|
+
core.info('Cache saved successfully');
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
exports.saveCache = saveCache;
|
|
215
216
|
//# sourceMappingURL=cacheHttpCl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AAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ,SAAS,KAAK,CAC5E,CAAA;QAED,MAAM,mBAAmB,GAAG,MAAM,WAAW,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;QAC7E,IAAI,CAAC,kCAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE;YACxD,MAAM,IAAI,KAAK,CACb,gCAAgC,mBAAmB,CAAC,UAAU,uBAAuB,CACtF,CAAA;SACF;QAED,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;IACvC,CAAC;CAAA;AAzBD,8BAyBC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import { CompressionMethod } from './constants';
|
|
4
|
-
export declare function createTempDirectory(): Promise<string>;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function resolvePaths(patterns: string[]): Promise<string[]>;
|
|
7
|
-
export declare function unlinkFile(filePath: fs.PathLike): Promise<void>;
|
|
8
|
-
export declare function getCompressionMethod(): Promise<CompressionMethod>;
|
|
9
|
-
export declare function getCacheFileName(compressionMethod: CompressionMethod): string;
|
|
10
|
-
export declare function isGnuTarInstalled(): Promise<boolean>;
|
|
11
|
-
export declare function assertDefined<T>(name: string, value?: T): T;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import { CompressionMethod } from './constants';
|
|
4
|
+
export declare function createTempDirectory(): Promise<string>;
|
|
5
|
+
export declare function getArchiveFileSizeInBytes(filePath: string): number;
|
|
6
|
+
export declare function resolvePaths(patterns: string[]): Promise<string[]>;
|
|
7
|
+
export declare function unlinkFile(filePath: fs.PathLike): Promise<void>;
|
|
8
|
+
export declare function getCompressionMethod(): Promise<CompressionMethod>;
|
|
9
|
+
export declare function getCacheFileName(compressionMethod: CompressionMethod): string;
|
|
10
|
+
export declare function isGnuTarInstalled(): Promise<boolean>;
|
|
11
|
+
export declare function assertDefined<T>(name: string, value?: T): T;
|