@actions/cache 5.0.5 → 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/lib/cache.d.ts +2 -1
- package/lib/cache.js +30 -72
- package/lib/cache.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/results/api/v1/cache.d.ts +1 -1
- package/lib/generated/results/api/v1/cache.js +73 -76
- package/lib/generated/results/api/v1/cache.js.map +1 -1
- package/lib/generated/results/api/v1/cache.twirp-client.d.ts +1 -1
- package/lib/generated/results/api/v1/cache.twirp-client.js +15 -20
- package/lib/generated/results/api/v1/cache.twirp-client.js.map +1 -1
- package/lib/generated/results/entities/v1/cachemetadata.d.ts +1 -1
- package/lib/generated/results/entities/v1/cachemetadata.js +16 -19
- package/lib/generated/results/entities/v1/cachemetadata.js.map +1 -1
- package/lib/generated/results/entities/v1/cachescope.js +13 -16
- package/lib/generated/results/entities/v1/cachescope.js.map +1 -1
- package/lib/internal/cacheHttpClient.d.ts +2 -2
- package/lib/internal/cacheHttpClient.js +36 -75
- package/lib/internal/cacheHttpClient.js.map +1 -1
- package/lib/internal/cacheUtils.d.ts +1 -1
- package/lib/internal/cacheUtils.js +27 -72
- package/lib/internal/cacheUtils.js.map +1 -1
- package/lib/internal/config.js +3 -8
- package/lib/internal/config.js.map +1 -1
- package/lib/internal/constants.js +14 -17
- package/lib/internal/constants.js.map +1 -1
- package/lib/internal/contracts.d.ts +37 -0
- package/lib/internal/contracts.js +2 -0
- package/lib/internal/contracts.js.map +1 -0
- package/lib/internal/downloadUtils.d.ts +1 -1
- package/lib/internal/downloadUtils.js +23 -64
- package/lib/internal/downloadUtils.js.map +1 -1
- package/lib/internal/requestUtils.d.ts +1 -1
- package/lib/internal/requestUtils.js +16 -57
- package/lib/internal/requestUtils.js.map +1 -1
- package/lib/internal/shared/cacheTwirpClient.d.ts +1 -1
- package/lib/internal/shared/cacheTwirpClient.js +36 -39
- package/lib/internal/shared/cacheTwirpClient.js.map +1 -1
- package/lib/internal/shared/errors.js +7 -17
- package/lib/internal/shared/errors.js.map +1 -1
- 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 +7 -11
- package/lib/internal/shared/util.js.map +1 -1
- package/lib/internal/tar.d.ts +1 -1
- package/lib/internal/tar.js +36 -74
- package/lib/internal/tar.js.map +1 -1
- package/lib/internal/uploadUtils.d.ts +1 -1
- package/lib/internal/uploadUtils.js +7 -45
- package/lib/internal/uploadUtils.js.map +1 -1
- package/lib/options.js +3 -40
- package/lib/options.js.map +1 -1
- package/package.json +20 -15
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const runtime_4 = require("@protobuf-ts/runtime");
|
|
8
|
-
const runtime_5 = require("@protobuf-ts/runtime");
|
|
9
|
-
const cachescope_1 = require("./cachescope");
|
|
1
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
2
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
3
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
4
|
+
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
|
|
5
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
6
|
+
import { CacheScope } from "./cachescope.js";
|
|
10
7
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
11
|
-
class CacheMetadata$Type extends
|
|
8
|
+
class CacheMetadata$Type extends MessageType {
|
|
12
9
|
constructor() {
|
|
13
10
|
super("github.actions.results.entities.v1.CacheMetadata", [
|
|
14
11
|
{ no: 1, name: "repository_id", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
|
15
|
-
{ no: 2, name: "scope", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () =>
|
|
12
|
+
{ no: 2, name: "scope", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => CacheScope }
|
|
16
13
|
]);
|
|
17
14
|
}
|
|
18
15
|
create(value) {
|
|
19
16
|
const message = { repositoryId: "0", scope: [] };
|
|
20
|
-
globalThis.Object.defineProperty(message,
|
|
17
|
+
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
|
21
18
|
if (value !== undefined)
|
|
22
|
-
|
|
19
|
+
reflectionMergePartial(this, message, value);
|
|
23
20
|
return message;
|
|
24
21
|
}
|
|
25
22
|
internalBinaryRead(reader, length, options, target) {
|
|
@@ -31,7 +28,7 @@ class CacheMetadata$Type extends runtime_5.MessageType {
|
|
|
31
28
|
message.repositoryId = reader.int64().toString();
|
|
32
29
|
break;
|
|
33
30
|
case /* repeated github.actions.results.entities.v1.CacheScope scope */ 2:
|
|
34
|
-
message.scope.push(
|
|
31
|
+
message.scope.push(CacheScope.internalBinaryRead(reader, reader.uint32(), options));
|
|
35
32
|
break;
|
|
36
33
|
default:
|
|
37
34
|
let u = options.readUnknownField;
|
|
@@ -39,7 +36,7 @@ class CacheMetadata$Type extends runtime_5.MessageType {
|
|
|
39
36
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
40
37
|
let d = reader.skip(wireType);
|
|
41
38
|
if (u !== false)
|
|
42
|
-
(u === true ?
|
|
39
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
return message;
|
|
@@ -47,18 +44,18 @@ class CacheMetadata$Type extends runtime_5.MessageType {
|
|
|
47
44
|
internalBinaryWrite(message, writer, options) {
|
|
48
45
|
/* int64 repository_id = 1; */
|
|
49
46
|
if (message.repositoryId !== "0")
|
|
50
|
-
writer.tag(1,
|
|
47
|
+
writer.tag(1, WireType.Varint).int64(message.repositoryId);
|
|
51
48
|
/* repeated github.actions.results.entities.v1.CacheScope scope = 2; */
|
|
52
49
|
for (let i = 0; i < message.scope.length; i++)
|
|
53
|
-
|
|
50
|
+
CacheScope.internalBinaryWrite(message.scope[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
54
51
|
let u = options.writeUnknownFields;
|
|
55
52
|
if (u !== false)
|
|
56
|
-
(u == true ?
|
|
53
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
57
54
|
return writer;
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
/**
|
|
61
58
|
* @generated MessageType for protobuf message github.actions.results.entities.v1.CacheMetadata
|
|
62
59
|
*/
|
|
63
|
-
|
|
60
|
+
export const CacheMetadata = new CacheMetadata$Type();
|
|
64
61
|
//# sourceMappingURL=cachemetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cachemetadata.js","sourceRoot":"","sources":["../../../../../src/generated/results/entities/v1/cachemetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cachemetadata.js","sourceRoot":"","sources":["../../../../../src/generated/results/entities/v1/cachemetadata.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkB7C,2FAA2F;AAC3F,MAAM,kBAAmB,SAAQ,WAA0B;IACvD;QACI,KAAK,CAAC,kDAAkD,EAAE;YACtD,EAAE,EAAE,EAAE,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AC,kBAAkB,CAAC;QACnC,IAAI,CAAC,KAAK,KAAK;YACX,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAClF,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AACD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const runtime_3 = require("@protobuf-ts/runtime");
|
|
7
|
-
const runtime_4 = require("@protobuf-ts/runtime");
|
|
8
|
-
const runtime_5 = require("@protobuf-ts/runtime");
|
|
1
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
2
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
3
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
4
|
+
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
|
|
5
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
9
6
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
10
|
-
class CacheScope$Type extends
|
|
7
|
+
class CacheScope$Type extends MessageType {
|
|
11
8
|
constructor() {
|
|
12
9
|
super("github.actions.results.entities.v1.CacheScope", [
|
|
13
10
|
{ no: 1, name: "scope", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
@@ -16,9 +13,9 @@ class CacheScope$Type extends runtime_5.MessageType {
|
|
|
16
13
|
}
|
|
17
14
|
create(value) {
|
|
18
15
|
const message = { scope: "", permission: "0" };
|
|
19
|
-
globalThis.Object.defineProperty(message,
|
|
16
|
+
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
|
20
17
|
if (value !== undefined)
|
|
21
|
-
|
|
18
|
+
reflectionMergePartial(this, message, value);
|
|
22
19
|
return message;
|
|
23
20
|
}
|
|
24
21
|
internalBinaryRead(reader, length, options, target) {
|
|
@@ -38,7 +35,7 @@ class CacheScope$Type extends runtime_5.MessageType {
|
|
|
38
35
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
39
36
|
let d = reader.skip(wireType);
|
|
40
37
|
if (u !== false)
|
|
41
|
-
(u === true ?
|
|
38
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
return message;
|
|
@@ -46,18 +43,18 @@ class CacheScope$Type extends runtime_5.MessageType {
|
|
|
46
43
|
internalBinaryWrite(message, writer, options) {
|
|
47
44
|
/* string scope = 1; */
|
|
48
45
|
if (message.scope !== "")
|
|
49
|
-
writer.tag(1,
|
|
46
|
+
writer.tag(1, WireType.LengthDelimited).string(message.scope);
|
|
50
47
|
/* int64 permission = 2; */
|
|
51
48
|
if (message.permission !== "0")
|
|
52
|
-
writer.tag(2,
|
|
49
|
+
writer.tag(2, WireType.Varint).int64(message.permission);
|
|
53
50
|
let u = options.writeUnknownFields;
|
|
54
51
|
if (u !== false)
|
|
55
|
-
(u == true ?
|
|
52
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
56
53
|
return writer;
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
/**
|
|
60
57
|
* @generated MessageType for protobuf message github.actions.results.entities.v1.CacheScope
|
|
61
58
|
*/
|
|
62
|
-
|
|
59
|
+
export const CacheScope = new CacheScope$Type();
|
|
63
60
|
//# sourceMappingURL=cachescope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cachescope.js","sourceRoot":"","sources":["../../../../../src/generated/results/entities/v1/cachescope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cachescope.js","sourceRoot":"","sources":["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U,KAAK,GAAG;YAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACnC,IAAI,CAAC,KAAK,KAAK;YACX,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAClF,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AACD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ArtifactCacheEntry, InternalCacheOptions, ReserveCacheResponse, ITypedResponseWithError } from './contracts';
|
|
2
|
-
import { DownloadOptions, UploadOptions } from '../options';
|
|
1
|
+
import { ArtifactCacheEntry, InternalCacheOptions, ReserveCacheResponse, ITypedResponseWithError } from './contracts.js';
|
|
2
|
+
import { DownloadOptions, UploadOptions } from '../options.js';
|
|
3
3
|
export declare function getCacheEntry(keys: string[], paths: string[], options?: InternalCacheOptions): Promise<ArtifactCacheEntry | null>;
|
|
4
4
|
export declare function downloadCache(archiveLocation: string, archivePath: string, options?: DownloadOptions): Promise<void>;
|
|
5
5
|
export declare function reserveCache(key: string, paths: string[], options?: InternalCacheOptions): Promise<ITypedResponseWithError<ReserveCacheResponse>>;
|
|
@@ -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,25 +7,20 @@ 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
|
-
|
|
56
|
-
const downloadUtils_1 = require("./downloadUtils");
|
|
57
|
-
const options_1 = require("../options");
|
|
58
|
-
const requestUtils_1 = require("./requestUtils");
|
|
59
|
-
const config_1 = require("./config");
|
|
60
|
-
const user_agent_1 = require("./shared/user-agent");
|
|
10
|
+
import * as core from '@actions/core';
|
|
11
|
+
import { HttpClient } from '@actions/http-client';
|
|
12
|
+
import { BearerCredentialHandler } from '@actions/http-client/lib/auth';
|
|
13
|
+
import * as fs from 'fs';
|
|
14
|
+
import { URL } from 'url';
|
|
15
|
+
import * as utils from './cacheUtils.js';
|
|
16
|
+
import { uploadCacheArchiveSDK } from './uploadUtils.js';
|
|
17
|
+
import { downloadCacheHttpClient, downloadCacheHttpClientConcurrent, downloadCacheStorageSDK } from './downloadUtils.js';
|
|
18
|
+
import { getDownloadOptions, getUploadOptions } from '../options.js';
|
|
19
|
+
import { isSuccessStatusCode, retryHttpClientResponse, retryTypedResponse } from './requestUtils.js';
|
|
20
|
+
import { getCacheServiceURL } from './config.js';
|
|
21
|
+
import { getUserAgentString } from './shared/user-agent.js';
|
|
61
22
|
function getCacheApiUrl(resource) {
|
|
62
|
-
const baseUrl =
|
|
23
|
+
const baseUrl = getCacheServiceURL();
|
|
63
24
|
if (!baseUrl) {
|
|
64
25
|
throw new Error('Cache Service Url not found, unable to restore cache.');
|
|
65
26
|
}
|
|
@@ -80,15 +41,15 @@ function getRequestOptions() {
|
|
|
80
41
|
}
|
|
81
42
|
function createHttpClient() {
|
|
82
43
|
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
|
83
|
-
const bearerCredentialHandler = new
|
|
84
|
-
return new
|
|
44
|
+
const bearerCredentialHandler = new BearerCredentialHandler(token);
|
|
45
|
+
return new HttpClient(getUserAgentString(), [bearerCredentialHandler], getRequestOptions());
|
|
85
46
|
}
|
|
86
|
-
function getCacheEntry(keys, paths, options) {
|
|
47
|
+
export function getCacheEntry(keys, paths, options) {
|
|
87
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
49
|
const httpClient = createHttpClient();
|
|
89
50
|
const version = utils.getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
|
|
90
51
|
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
|
91
|
-
const response = yield
|
|
52
|
+
const response = yield retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
|
92
53
|
// Cache not found
|
|
93
54
|
if (response.statusCode === 204) {
|
|
94
55
|
// List cache for primary key only if cache miss occurs
|
|
@@ -97,7 +58,7 @@ function getCacheEntry(keys, paths, options) {
|
|
|
97
58
|
}
|
|
98
59
|
return null;
|
|
99
60
|
}
|
|
100
|
-
if (!
|
|
61
|
+
if (!isSuccessStatusCode(response.statusCode)) {
|
|
101
62
|
throw new Error(`Cache service responded with ${response.statusCode}`);
|
|
102
63
|
}
|
|
103
64
|
const cacheResult = response.result;
|
|
@@ -115,7 +76,7 @@ function getCacheEntry(keys, paths, options) {
|
|
|
115
76
|
function printCachesListForDiagnostics(key, httpClient, version) {
|
|
116
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
78
|
const resource = `caches?key=${encodeURIComponent(key)}`;
|
|
118
|
-
const response = yield
|
|
79
|
+
const response = yield retryTypedResponse('listCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
|
119
80
|
if (response.statusCode === 200) {
|
|
120
81
|
const cacheListResult = response.result;
|
|
121
82
|
const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount;
|
|
@@ -128,31 +89,31 @@ function printCachesListForDiagnostics(key, httpClient, version) {
|
|
|
128
89
|
}
|
|
129
90
|
});
|
|
130
91
|
}
|
|
131
|
-
function downloadCache(archiveLocation, archivePath, options) {
|
|
92
|
+
export function downloadCache(archiveLocation, archivePath, options) {
|
|
132
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
const archiveUrl = new
|
|
134
|
-
const downloadOptions =
|
|
94
|
+
const archiveUrl = new URL(archiveLocation);
|
|
95
|
+
const downloadOptions = getDownloadOptions(options);
|
|
135
96
|
if (archiveUrl.hostname.endsWith('.blob.core.windows.net')) {
|
|
136
97
|
if (downloadOptions.useAzureSdk) {
|
|
137
98
|
// Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability.
|
|
138
|
-
yield
|
|
99
|
+
yield downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions);
|
|
139
100
|
}
|
|
140
101
|
else if (downloadOptions.concurrentBlobDownloads) {
|
|
141
102
|
// Use concurrent implementation with HttpClient to work around blob SDK issue
|
|
142
|
-
yield
|
|
103
|
+
yield downloadCacheHttpClientConcurrent(archiveLocation, archivePath, downloadOptions);
|
|
143
104
|
}
|
|
144
105
|
else {
|
|
145
106
|
// Otherwise, download using the Actions http-client.
|
|
146
|
-
yield
|
|
107
|
+
yield downloadCacheHttpClient(archiveLocation, archivePath);
|
|
147
108
|
}
|
|
148
109
|
}
|
|
149
110
|
else {
|
|
150
|
-
yield
|
|
111
|
+
yield downloadCacheHttpClient(archiveLocation, archivePath);
|
|
151
112
|
}
|
|
152
113
|
});
|
|
153
114
|
}
|
|
154
115
|
// Reserve Cache
|
|
155
|
-
function reserveCache(key, paths, options) {
|
|
116
|
+
export function reserveCache(key, paths, options) {
|
|
156
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
118
|
const httpClient = createHttpClient();
|
|
158
119
|
const version = utils.getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
|
|
@@ -161,7 +122,7 @@ function reserveCache(key, paths, options) {
|
|
|
161
122
|
version,
|
|
162
123
|
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
|
|
163
124
|
};
|
|
164
|
-
const response = yield
|
|
125
|
+
const response = yield retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
|
165
126
|
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
|
166
127
|
}));
|
|
167
128
|
return response;
|
|
@@ -182,10 +143,10 @@ function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
|
|
|
182
143
|
'Content-Type': 'application/octet-stream',
|
|
183
144
|
'Content-Range': getContentRange(start, end)
|
|
184
145
|
};
|
|
185
|
-
const uploadChunkResponse = yield
|
|
146
|
+
const uploadChunkResponse = yield retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
|
|
186
147
|
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
|
|
187
148
|
}));
|
|
188
|
-
if (!
|
|
149
|
+
if (!isSuccessStatusCode(uploadChunkResponse.message.statusCode)) {
|
|
189
150
|
throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`);
|
|
190
151
|
}
|
|
191
152
|
});
|
|
@@ -196,7 +157,7 @@ function uploadFile(httpClient, cacheId, archivePath, options) {
|
|
|
196
157
|
const fileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
197
158
|
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
|
|
198
159
|
const fd = fs.openSync(archivePath, 'r');
|
|
199
|
-
const uploadOptions =
|
|
160
|
+
const uploadOptions = getUploadOptions(options);
|
|
200
161
|
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
|
|
201
162
|
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
|
|
202
163
|
const parallelUploads = [...new Array(concurrency).keys()];
|
|
@@ -231,20 +192,20 @@ function uploadFile(httpClient, cacheId, archivePath, options) {
|
|
|
231
192
|
function commitCache(httpClient, cacheId, filesize) {
|
|
232
193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
233
194
|
const commitCacheRequest = { size: filesize };
|
|
234
|
-
return yield
|
|
195
|
+
return yield retryTypedResponse('commitCache', () => __awaiter(this, void 0, void 0, function* () {
|
|
235
196
|
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
|
|
236
197
|
}));
|
|
237
198
|
});
|
|
238
199
|
}
|
|
239
|
-
function saveCache(cacheId, archivePath, signedUploadURL, options) {
|
|
200
|
+
export function saveCache(cacheId, archivePath, signedUploadURL, options) {
|
|
240
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
const uploadOptions =
|
|
202
|
+
const uploadOptions = getUploadOptions(options);
|
|
242
203
|
if (uploadOptions.useAzureSdk) {
|
|
243
204
|
// Use Azure storage SDK to upload caches directly to Azure
|
|
244
205
|
if (!signedUploadURL) {
|
|
245
206
|
throw new Error('Azure Storage SDK can only be used when a signed URL is provided.');
|
|
246
207
|
}
|
|
247
|
-
yield
|
|
208
|
+
yield uploadCacheArchiveSDK(signedUploadURL, archivePath, options);
|
|
248
209
|
}
|
|
249
210
|
else {
|
|
250
211
|
const httpClient = createHttpClient();
|
|
@@ -255,7 +216,7 @@ function saveCache(cacheId, archivePath, signedUploadURL, options) {
|
|
|
255
216
|
const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);
|
|
256
217
|
core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
|
|
257
218
|
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
|
|
258
|
-
if (!
|
|
219
|
+
if (!isSuccessStatusCode(commitCacheResponse.statusCode)) {
|
|
259
220
|
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
|
260
221
|
}
|
|
261
222
|
core.info('Cache saved successfully');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheHttpClient.js","sourceRoot":"","sources":["../../src/internal/cacheHttpClient.ts"],"names":[],"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AAI,CAAC,eAAe,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAA;YACH,CAAC;YACD,MAAM,qBAAqB,CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;QACpE,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAA;YAErC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;YAC1B,MAAM,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;YAE3D,eAAe;YACf,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;YAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAA;YAC9D,IAAI,CAAC,IAAI,CACP,gBAAgB,IAAI,CAAC,KAAK,CACxB,SAAS,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAC1B,QAAQ,SAAS,KAAK,CACxB,CAAA;YAED,MAAM,mBAAmB,GAAG,MAAM,WAAW,CAC3C,UAAU,EACV,OAAO,EACP,SAAS,CACV,CAAA;YACD,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;gBACzD,MAAM,IAAI,KAAK,CACb,gCAAgC,mBAAmB,CAAC,UAAU,uBAAuB,CACtF,CAAA;YACH,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
-
import { CompressionMethod } from './constants';
|
|
2
|
+
import { CompressionMethod } from './constants.js';
|
|
3
3
|
export declare function createTempDirectory(): Promise<string>;
|
|
4
4
|
export declare function getArchiveFileSizeInBytes(filePath: string): number;
|
|
5
5
|
export declare function resolvePaths(patterns: string[]): Promise<string[]>;
|
|
@@ -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) {
|
|
@@ -48,30 +14,19 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
48
14
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
49
15
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
50
16
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
exports.getRuntimeToken = getRuntimeToken;
|
|
62
|
-
const core = __importStar(require("@actions/core"));
|
|
63
|
-
const exec = __importStar(require("@actions/exec"));
|
|
64
|
-
const glob = __importStar(require("@actions/glob"));
|
|
65
|
-
const io = __importStar(require("@actions/io"));
|
|
66
|
-
const crypto = __importStar(require("crypto"));
|
|
67
|
-
const fs = __importStar(require("fs"));
|
|
68
|
-
const path = __importStar(require("path"));
|
|
69
|
-
const semver = __importStar(require("semver"));
|
|
70
|
-
const util = __importStar(require("util"));
|
|
71
|
-
const constants_1 = require("./constants");
|
|
17
|
+
import * as core from '@actions/core';
|
|
18
|
+
import * as exec from '@actions/exec';
|
|
19
|
+
import * as glob from '@actions/glob';
|
|
20
|
+
import * as io from '@actions/io';
|
|
21
|
+
import * as crypto from 'crypto';
|
|
22
|
+
import * as fs from 'fs';
|
|
23
|
+
import * as path from 'path';
|
|
24
|
+
import * as semver from 'semver';
|
|
25
|
+
import * as util from 'util';
|
|
26
|
+
import { CacheFilename, CompressionMethod, GnuTarPathOnWindows } from './constants.js';
|
|
72
27
|
const versionSalt = '1.0';
|
|
73
28
|
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
|
74
|
-
function createTempDirectory() {
|
|
29
|
+
export function createTempDirectory() {
|
|
75
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
31
|
const IS_WINDOWS = process.platform === 'win32';
|
|
77
32
|
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
|
@@ -96,10 +51,10 @@ function createTempDirectory() {
|
|
|
96
51
|
return dest;
|
|
97
52
|
});
|
|
98
53
|
}
|
|
99
|
-
function getArchiveFileSizeInBytes(filePath) {
|
|
54
|
+
export function getArchiveFileSizeInBytes(filePath) {
|
|
100
55
|
return fs.statSync(filePath).size;
|
|
101
56
|
}
|
|
102
|
-
function resolvePaths(patterns) {
|
|
57
|
+
export function resolvePaths(patterns) {
|
|
103
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
59
|
var _a, e_1, _b, _c;
|
|
105
60
|
var _d;
|
|
@@ -137,7 +92,7 @@ function resolvePaths(patterns) {
|
|
|
137
92
|
return paths;
|
|
138
93
|
});
|
|
139
94
|
}
|
|
140
|
-
function unlinkFile(filePath) {
|
|
95
|
+
export function unlinkFile(filePath) {
|
|
141
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
97
|
return util.promisify(fs.unlink)(filePath);
|
|
143
98
|
});
|
|
@@ -166,40 +121,40 @@ function getVersion(app_1) {
|
|
|
166
121
|
});
|
|
167
122
|
}
|
|
168
123
|
// Use zstandard if possible to maximize cache performance
|
|
169
|
-
function getCompressionMethod() {
|
|
124
|
+
export function getCompressionMethod() {
|
|
170
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
171
126
|
const versionOutput = yield getVersion('zstd', ['--quiet']);
|
|
172
127
|
const version = semver.clean(versionOutput);
|
|
173
128
|
core.debug(`zstd version: ${version}`);
|
|
174
129
|
if (versionOutput === '') {
|
|
175
|
-
return
|
|
130
|
+
return CompressionMethod.Gzip;
|
|
176
131
|
}
|
|
177
132
|
else {
|
|
178
|
-
return
|
|
133
|
+
return CompressionMethod.ZstdWithoutLong;
|
|
179
134
|
}
|
|
180
135
|
});
|
|
181
136
|
}
|
|
182
|
-
function getCacheFileName(compressionMethod) {
|
|
183
|
-
return compressionMethod ===
|
|
184
|
-
?
|
|
185
|
-
:
|
|
137
|
+
export function getCacheFileName(compressionMethod) {
|
|
138
|
+
return compressionMethod === CompressionMethod.Gzip
|
|
139
|
+
? CacheFilename.Gzip
|
|
140
|
+
: CacheFilename.Zstd;
|
|
186
141
|
}
|
|
187
|
-
function getGnuTarPathOnWindows() {
|
|
142
|
+
export function getGnuTarPathOnWindows() {
|
|
188
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
-
if (fs.existsSync(
|
|
190
|
-
return
|
|
144
|
+
if (fs.existsSync(GnuTarPathOnWindows)) {
|
|
145
|
+
return GnuTarPathOnWindows;
|
|
191
146
|
}
|
|
192
147
|
const versionOutput = yield getVersion('tar');
|
|
193
148
|
return versionOutput.toLowerCase().includes('gnu tar') ? io.which('tar') : '';
|
|
194
149
|
});
|
|
195
150
|
}
|
|
196
|
-
function assertDefined(name, value) {
|
|
151
|
+
export function assertDefined(name, value) {
|
|
197
152
|
if (value === undefined) {
|
|
198
153
|
throw Error(`Expected ${name} but value was undefiend`);
|
|
199
154
|
}
|
|
200
155
|
return value;
|
|
201
156
|
}
|
|
202
|
-
function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
|
|
157
|
+
export function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
|
|
203
158
|
// don't pass changes upstream
|
|
204
159
|
const components = paths.slice();
|
|
205
160
|
// Add compression method to cache version to restore
|
|
@@ -215,7 +170,7 @@ function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false)
|
|
|
215
170
|
components.push(versionSalt);
|
|
216
171
|
return crypto.createHash('sha256').update(components.join('|')).digest('hex');
|
|
217
172
|
}
|
|
218
|
-
function getRuntimeToken() {
|
|
173
|
+
export function getRuntimeToken() {
|
|
219
174
|
const token = process.env['ACTIONS_RUNTIME_TOKEN'];
|
|
220
175
|
if (!token) {
|
|
221
176
|
throw new Error('Unable to get the ACTIONS_RUNTIME_TOKEN env variable');
|