Tiny fixes

pull/1766/head
Boris Staal 3 years ago
parent f12187b90c
commit 180001d529
No known key found for this signature in database

@ -68358,11 +68358,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0; exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0;
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const exec = __importStar(__nccwpck_require__(71514)); const exec = __importStar(__nccwpck_require__(71514));
const io = __importStar(__nccwpck_require__(47351));
const glob = __importStar(__nccwpck_require__(28090)); const glob = __importStar(__nccwpck_require__(28090));
const semver = __importStar(__nccwpck_require__(11383)); const io = __importStar(__nccwpck_require__(47351));
const path = __importStar(__nccwpck_require__(71017));
const fs = __importStar(__nccwpck_require__(57147)); const fs = __importStar(__nccwpck_require__(57147));
const path = __importStar(__nccwpck_require__(71017));
const semver = __importStar(__nccwpck_require__(11383));
const uuid_1 = __nccwpck_require__(75840); const uuid_1 = __nccwpck_require__(75840);
var CacheFilename; var CacheFilename;
(function (CacheFilename) { (function (CacheFilename) {
@ -68628,7 +68628,7 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const primaryKey = keys[0]; const primaryKey = keys[0];
const s3client = new client_s3_1.S3Client(s3Options); const s3client = new client_s3_1.S3Client(s3Options);
let contents = new Array(); const contents = [];
let s3ContinuationToken = null; let s3ContinuationToken = null;
let count = 0; let count = 0;
const param = { const param = {
@ -68647,7 +68647,8 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
throw new Error(`Error from S3: ${e}`); throw new Error(`Error from S3: ${e}`);
} }
if (!response.Contents) { if (!response.Contents) {
throw new Error(`Cannot found object in bucket ${s3BucketName}`); return null;
// throw new Error(`Cannot found object in bucket ${s3BucketName}`);
} }
core.debug(`Found objects ${response.Contents.length}`); core.debug(`Found objects ${response.Contents.length}`);
const found = response.Contents.find((content) => content.Key === primaryKey); const found = response.Contents.find((content) => content.Key === primaryKey);
@ -68693,7 +68694,7 @@ function searchRestoreKeyEntry(notPrimaryKey, entries) {
} }
function _searchRestoreKeyEntry(notPrimaryKey, entries) { function _searchRestoreKeyEntry(notPrimaryKey, entries) {
var _a; var _a;
let matchPrefix = new Array(); const matchPrefix = [];
for (const entry of entries) { for (const entry of entries) {
if (entry.Key === notPrimaryKey) { if (entry.Key === notPrimaryKey) {
// extractly match, Use this entry // extractly match, Use this entry
@ -69080,10 +69081,10 @@ function getUploadOptions(copy) {
uploadChunkSize: 32 * 1024 * 1024 uploadChunkSize: 32 * 1024 * 1024
}; };
if (copy) { if (copy) {
if (typeof copy.uploadConcurrency === 'number') { if (typeof copy.uploadConcurrency === "number") {
result.uploadConcurrency = copy.uploadConcurrency; result.uploadConcurrency = copy.uploadConcurrency;
} }
if (typeof copy.uploadChunkSize === 'number') { if (typeof copy.uploadChunkSize === "number") {
result.uploadChunkSize = copy.uploadChunkSize; result.uploadChunkSize = copy.uploadChunkSize;
} }
} }
@ -69104,13 +69105,13 @@ function getDownloadOptions(copy) {
timeoutInMs: 30000 timeoutInMs: 30000
}; };
if (copy) { if (copy) {
if (typeof copy.useAzureSdk === 'boolean') { if (typeof copy.useAzureSdk === "boolean") {
result.useAzureSdk = copy.useAzureSdk; result.useAzureSdk = copy.useAzureSdk;
} }
if (typeof copy.downloadConcurrency === 'number') { if (typeof copy.downloadConcurrency === "number") {
result.downloadConcurrency = copy.downloadConcurrency; result.downloadConcurrency = copy.downloadConcurrency;
} }
if (typeof copy.timeoutInMs === 'number') { if (typeof copy.timeoutInMs === "number") {
result.timeoutInMs = copy.timeoutInMs; result.timeoutInMs = copy.timeoutInMs;
} }
} }

@ -68358,11 +68358,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0; exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0;
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const exec = __importStar(__nccwpck_require__(71514)); const exec = __importStar(__nccwpck_require__(71514));
const io = __importStar(__nccwpck_require__(47351));
const glob = __importStar(__nccwpck_require__(28090)); const glob = __importStar(__nccwpck_require__(28090));
const semver = __importStar(__nccwpck_require__(11383)); const io = __importStar(__nccwpck_require__(47351));
const path = __importStar(__nccwpck_require__(71017));
const fs = __importStar(__nccwpck_require__(57147)); const fs = __importStar(__nccwpck_require__(57147));
const path = __importStar(__nccwpck_require__(71017));
const semver = __importStar(__nccwpck_require__(11383));
const uuid_1 = __nccwpck_require__(75840); const uuid_1 = __nccwpck_require__(75840);
var CacheFilename; var CacheFilename;
(function (CacheFilename) { (function (CacheFilename) {
@ -68628,7 +68628,7 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const primaryKey = keys[0]; const primaryKey = keys[0];
const s3client = new client_s3_1.S3Client(s3Options); const s3client = new client_s3_1.S3Client(s3Options);
let contents = new Array(); const contents = [];
let s3ContinuationToken = null; let s3ContinuationToken = null;
let count = 0; let count = 0;
const param = { const param = {
@ -68647,7 +68647,8 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
throw new Error(`Error from S3: ${e}`); throw new Error(`Error from S3: ${e}`);
} }
if (!response.Contents) { if (!response.Contents) {
throw new Error(`Cannot found object in bucket ${s3BucketName}`); return null;
// throw new Error(`Cannot found object in bucket ${s3BucketName}`);
} }
core.debug(`Found objects ${response.Contents.length}`); core.debug(`Found objects ${response.Contents.length}`);
const found = response.Contents.find((content) => content.Key === primaryKey); const found = response.Contents.find((content) => content.Key === primaryKey);
@ -68693,7 +68694,7 @@ function searchRestoreKeyEntry(notPrimaryKey, entries) {
} }
function _searchRestoreKeyEntry(notPrimaryKey, entries) { function _searchRestoreKeyEntry(notPrimaryKey, entries) {
var _a; var _a;
let matchPrefix = new Array(); const matchPrefix = [];
for (const entry of entries) { for (const entry of entries) {
if (entry.Key === notPrimaryKey) { if (entry.Key === notPrimaryKey) {
// extractly match, Use this entry // extractly match, Use this entry
@ -69080,10 +69081,10 @@ function getUploadOptions(copy) {
uploadChunkSize: 32 * 1024 * 1024 uploadChunkSize: 32 * 1024 * 1024
}; };
if (copy) { if (copy) {
if (typeof copy.uploadConcurrency === 'number') { if (typeof copy.uploadConcurrency === "number") {
result.uploadConcurrency = copy.uploadConcurrency; result.uploadConcurrency = copy.uploadConcurrency;
} }
if (typeof copy.uploadChunkSize === 'number') { if (typeof copy.uploadChunkSize === "number") {
result.uploadChunkSize = copy.uploadChunkSize; result.uploadChunkSize = copy.uploadChunkSize;
} }
} }
@ -69104,13 +69105,13 @@ function getDownloadOptions(copy) {
timeoutInMs: 30000 timeoutInMs: 30000
}; };
if (copy) { if (copy) {
if (typeof copy.useAzureSdk === 'boolean') { if (typeof copy.useAzureSdk === "boolean") {
result.useAzureSdk = copy.useAzureSdk; result.useAzureSdk = copy.useAzureSdk;
} }
if (typeof copy.downloadConcurrency === 'number') { if (typeof copy.downloadConcurrency === "number") {
result.downloadConcurrency = copy.downloadConcurrency; result.downloadConcurrency = copy.downloadConcurrency;
} }
if (typeof copy.timeoutInMs === 'number') { if (typeof copy.timeoutInMs === "number") {
result.timeoutInMs = copy.timeoutInMs; result.timeoutInMs = copy.timeoutInMs;
} }
} }

@ -68381,11 +68381,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0; exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0;
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const exec = __importStar(__nccwpck_require__(71514)); const exec = __importStar(__nccwpck_require__(71514));
const io = __importStar(__nccwpck_require__(47351));
const glob = __importStar(__nccwpck_require__(28090)); const glob = __importStar(__nccwpck_require__(28090));
const semver = __importStar(__nccwpck_require__(11383)); const io = __importStar(__nccwpck_require__(47351));
const path = __importStar(__nccwpck_require__(71017));
const fs = __importStar(__nccwpck_require__(57147)); const fs = __importStar(__nccwpck_require__(57147));
const path = __importStar(__nccwpck_require__(71017));
const semver = __importStar(__nccwpck_require__(11383));
const uuid_1 = __nccwpck_require__(75840); const uuid_1 = __nccwpck_require__(75840);
var CacheFilename; var CacheFilename;
(function (CacheFilename) { (function (CacheFilename) {
@ -68651,7 +68651,7 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const primaryKey = keys[0]; const primaryKey = keys[0];
const s3client = new client_s3_1.S3Client(s3Options); const s3client = new client_s3_1.S3Client(s3Options);
let contents = new Array(); const contents = [];
let s3ContinuationToken = null; let s3ContinuationToken = null;
let count = 0; let count = 0;
const param = { const param = {
@ -68670,7 +68670,8 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
throw new Error(`Error from S3: ${e}`); throw new Error(`Error from S3: ${e}`);
} }
if (!response.Contents) { if (!response.Contents) {
throw new Error(`Cannot found object in bucket ${s3BucketName}`); return null;
// throw new Error(`Cannot found object in bucket ${s3BucketName}`);
} }
core.debug(`Found objects ${response.Contents.length}`); core.debug(`Found objects ${response.Contents.length}`);
const found = response.Contents.find((content) => content.Key === primaryKey); const found = response.Contents.find((content) => content.Key === primaryKey);
@ -68716,7 +68717,7 @@ function searchRestoreKeyEntry(notPrimaryKey, entries) {
} }
function _searchRestoreKeyEntry(notPrimaryKey, entries) { function _searchRestoreKeyEntry(notPrimaryKey, entries) {
var _a; var _a;
let matchPrefix = new Array(); const matchPrefix = [];
for (const entry of entries) { for (const entry of entries) {
if (entry.Key === notPrimaryKey) { if (entry.Key === notPrimaryKey) {
// extractly match, Use this entry // extractly match, Use this entry
@ -69103,10 +69104,10 @@ function getUploadOptions(copy) {
uploadChunkSize: 32 * 1024 * 1024 uploadChunkSize: 32 * 1024 * 1024
}; };
if (copy) { if (copy) {
if (typeof copy.uploadConcurrency === 'number') { if (typeof copy.uploadConcurrency === "number") {
result.uploadConcurrency = copy.uploadConcurrency; result.uploadConcurrency = copy.uploadConcurrency;
} }
if (typeof copy.uploadChunkSize === 'number') { if (typeof copy.uploadChunkSize === "number") {
result.uploadChunkSize = copy.uploadChunkSize; result.uploadChunkSize = copy.uploadChunkSize;
} }
} }
@ -69127,13 +69128,13 @@ function getDownloadOptions(copy) {
timeoutInMs: 30000 timeoutInMs: 30000
}; };
if (copy) { if (copy) {
if (typeof copy.useAzureSdk === 'boolean') { if (typeof copy.useAzureSdk === "boolean") {
result.useAzureSdk = copy.useAzureSdk; result.useAzureSdk = copy.useAzureSdk;
} }
if (typeof copy.downloadConcurrency === 'number') { if (typeof copy.downloadConcurrency === "number") {
result.downloadConcurrency = copy.downloadConcurrency; result.downloadConcurrency = copy.downloadConcurrency;
} }
if (typeof copy.timeoutInMs === 'number') { if (typeof copy.timeoutInMs === "number") {
result.timeoutInMs = copy.timeoutInMs; result.timeoutInMs = copy.timeoutInMs;
} }
} }

23
dist/save/index.js vendored

@ -68354,11 +68354,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0; exports.assertDefined = exports.unlinkFile = exports.getCompressionMethod = exports.isGnuTarInstalled = exports.isZstdInstalled = exports.resolvePaths = exports.createTempDirectory = exports.getCacheFileName = exports.getArchiveFileSizeInBytes = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.CompressionMethod = exports.CacheFilename = void 0;
const core = __importStar(__nccwpck_require__(42186)); const core = __importStar(__nccwpck_require__(42186));
const exec = __importStar(__nccwpck_require__(71514)); const exec = __importStar(__nccwpck_require__(71514));
const io = __importStar(__nccwpck_require__(47351));
const glob = __importStar(__nccwpck_require__(28090)); const glob = __importStar(__nccwpck_require__(28090));
const semver = __importStar(__nccwpck_require__(11383)); const io = __importStar(__nccwpck_require__(47351));
const path = __importStar(__nccwpck_require__(71017));
const fs = __importStar(__nccwpck_require__(57147)); const fs = __importStar(__nccwpck_require__(57147));
const path = __importStar(__nccwpck_require__(71017));
const semver = __importStar(__nccwpck_require__(11383));
const uuid_1 = __nccwpck_require__(75840); const uuid_1 = __nccwpck_require__(75840);
var CacheFilename; var CacheFilename;
(function (CacheFilename) { (function (CacheFilename) {
@ -68624,7 +68624,7 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const primaryKey = keys[0]; const primaryKey = keys[0];
const s3client = new client_s3_1.S3Client(s3Options); const s3client = new client_s3_1.S3Client(s3Options);
let contents = new Array(); const contents = [];
let s3ContinuationToken = null; let s3ContinuationToken = null;
let count = 0; let count = 0;
const param = { const param = {
@ -68643,7 +68643,8 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
throw new Error(`Error from S3: ${e}`); throw new Error(`Error from S3: ${e}`);
} }
if (!response.Contents) { if (!response.Contents) {
throw new Error(`Cannot found object in bucket ${s3BucketName}`); return null;
// throw new Error(`Cannot found object in bucket ${s3BucketName}`);
} }
core.debug(`Found objects ${response.Contents.length}`); core.debug(`Found objects ${response.Contents.length}`);
const found = response.Contents.find((content) => content.Key === primaryKey); const found = response.Contents.find((content) => content.Key === primaryKey);
@ -68689,7 +68690,7 @@ function searchRestoreKeyEntry(notPrimaryKey, entries) {
} }
function _searchRestoreKeyEntry(notPrimaryKey, entries) { function _searchRestoreKeyEntry(notPrimaryKey, entries) {
var _a; var _a;
let matchPrefix = new Array(); const matchPrefix = [];
for (const entry of entries) { for (const entry of entries) {
if (entry.Key === notPrimaryKey) { if (entry.Key === notPrimaryKey) {
// extractly match, Use this entry // extractly match, Use this entry
@ -69076,10 +69077,10 @@ function getUploadOptions(copy) {
uploadChunkSize: 32 * 1024 * 1024 uploadChunkSize: 32 * 1024 * 1024
}; };
if (copy) { if (copy) {
if (typeof copy.uploadConcurrency === 'number') { if (typeof copy.uploadConcurrency === "number") {
result.uploadConcurrency = copy.uploadConcurrency; result.uploadConcurrency = copy.uploadConcurrency;
} }
if (typeof copy.uploadChunkSize === 'number') { if (typeof copy.uploadChunkSize === "number") {
result.uploadChunkSize = copy.uploadChunkSize; result.uploadChunkSize = copy.uploadChunkSize;
} }
} }
@ -69100,13 +69101,13 @@ function getDownloadOptions(copy) {
timeoutInMs: 30000 timeoutInMs: 30000
}; };
if (copy) { if (copy) {
if (typeof copy.useAzureSdk === 'boolean') { if (typeof copy.useAzureSdk === "boolean") {
result.useAzureSdk = copy.useAzureSdk; result.useAzureSdk = copy.useAzureSdk;
} }
if (typeof copy.downloadConcurrency === 'number') { if (typeof copy.downloadConcurrency === "number") {
result.downloadConcurrency = copy.downloadConcurrency; result.downloadConcurrency = copy.downloadConcurrency;
} }
if (typeof copy.timeoutInMs === 'number') { if (typeof copy.timeoutInMs === "number") {
result.timeoutInMs = copy.timeoutInMs; result.timeoutInMs = copy.timeoutInMs;
} }
} }

@ -1,10 +1,10 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as exec from "@actions/exec"; import * as exec from "@actions/exec";
import * as io from "@actions/io";
import * as glob from "@actions/glob"; import * as glob from "@actions/glob";
import * as semver from "semver"; import * as io from "@actions/io";
import * as path from "path";
import * as fs from "fs"; import * as fs from "fs";
import * as path from "path";
import * as semver from "semver";
import { v4 as uuidV4 } from "uuid"; import { v4 as uuidV4 } from "uuid";
export enum CacheFilename { export enum CacheFilename {

@ -5,14 +5,13 @@ import {
RequestOptions, RequestOptions,
TypedResponse TypedResponse
} from "@actions/http-client/lib/interfaces"; } from "@actions/http-client/lib/interfaces";
import { DownloadOptions, UploadOptions } from "./contracts";
import { import {
_Object,
ListObjectsV2Command, ListObjectsV2Command,
ListObjectsV2CommandInput, ListObjectsV2CommandInput,
ListObjectsV2CommandOutput, ListObjectsV2CommandOutput,
S3Client, S3Client,
S3ClientConfig, S3ClientConfig
_Object
} from "@aws-sdk/client-s3"; } from "@aws-sdk/client-s3";
import { Progress, Upload } from "@aws-sdk/lib-storage"; import { Progress, Upload } from "@aws-sdk/lib-storage";
import * as crypto from "crypto"; import * as crypto from "crypto";
@ -23,20 +22,19 @@ import * as utils from "./cacheUtils";
import { CompressionMethod } from "./cacheUtils"; import { CompressionMethod } from "./cacheUtils";
import { import {
ArtifactCacheEntry, ArtifactCacheEntry,
InternalCacheOptions,
CommitCacheRequest, CommitCacheRequest,
DownloadOptions,
InternalCacheOptions,
ITypedResponseWithError,
ReserveCacheRequest, ReserveCacheRequest,
ReserveCacheResponse, ReserveCacheResponse,
ITypedResponseWithError UploadOptions
} from "./contracts"; } from "./contracts";
import { import {
downloadCacheHttpClient, downloadCacheHttpClient,
downloadCacheStorageS3 downloadCacheStorageS3
} from "./downloadUtils"; } from "./downloadUtils";
import { import { getDownloadOptions, getUploadOptions } from "./options";
getDownloadOptions,
getUploadOptions
} from "./options";
import { import {
isSuccessStatusCode, isSuccessStatusCode,
retryHttpClientResponse, retryHttpClientResponse,
@ -117,7 +115,7 @@ async function getCacheEntryS3(
const s3client = new S3Client(s3Options); const s3client = new S3Client(s3Options);
let contents: _content[] = new Array(); const contents: _content[] = [];
let s3ContinuationToken: string | undefined | null = null; let s3ContinuationToken: string | undefined | null = null;
let count = 0; let count = 0;
@ -138,7 +136,8 @@ async function getCacheEntryS3(
throw new Error(`Error from S3: ${e}`); throw new Error(`Error from S3: ${e}`);
} }
if (!response.Contents) { if (!response.Contents) {
throw new Error(`Cannot found object in bucket ${s3BucketName}`); return null;
// throw new Error(`Cannot found object in bucket ${s3BucketName}`);
} }
core.debug(`Found objects ${response.Contents.length}`); core.debug(`Found objects ${response.Contents.length}`);
@ -200,7 +199,7 @@ function _searchRestoreKeyEntry(
notPrimaryKey: string, notPrimaryKey: string,
entries: _content[] entries: _content[]
): _content | null { ): _content | null {
let matchPrefix: _content[] = new Array(); const matchPrefix: _content[] = [];
for (const entry of entries) { for (const entry of entries) {
if (entry.Key === notPrimaryKey) { if (entry.Key === notPrimaryKey) {

@ -1,6 +1,7 @@
import { CompressionMethod } from "./cacheUtils";
import { TypedResponse } from "@actions/http-client/lib/interfaces";
import { HttpClientError } from "@actions/http-client"; import { HttpClientError } from "@actions/http-client";
import { TypedResponse } from "@actions/http-client/lib/interfaces";
import { CompressionMethod } from "./cacheUtils";
export interface ITypedResponseWithError<T> extends TypedResponse<T> { export interface ITypedResponseWithError<T> extends TypedResponse<T> {
error?: HttpClientError; error?: HttpClientError;
@ -32,7 +33,6 @@ export interface InternalCacheOptions {
cacheSize?: number; cacheSize?: number;
} }
/** /**
* Options to control cache upload * Options to control cache upload
*/ */
@ -42,19 +42,19 @@ export interface UploadOptions {
* *
* @default 4 * @default 4
*/ */
uploadConcurrency?: number uploadConcurrency?: number;
/** /**
* Maximum chunk size in bytes for cache upload * Maximum chunk size in bytes for cache upload
* *
* @default 32MB * @default 32MB
*/ */
uploadChunkSize?: number uploadChunkSize?: number;
} }
/** /**
* Options to control cache download * Options to control cache download
*/ */
export interface DownloadOptions { export interface DownloadOptions {
/** /**
* Indicates whether to use the Azure Blob SDK to download caches * Indicates whether to use the Azure Blob SDK to download caches
* that are stored on Azure Blob Storage to improve reliability and * that are stored on Azure Blob Storage to improve reliability and
@ -62,7 +62,7 @@ export interface UploadOptions {
* *
* @default true * @default true
*/ */
useAzureSdk?: boolean useAzureSdk?: boolean;
/** /**
* Number of parallel downloads (this option only applies when using * Number of parallel downloads (this option only applies when using
@ -70,7 +70,7 @@ export interface UploadOptions {
* *
* @default 8 * @default 8
*/ */
downloadConcurrency?: number downloadConcurrency?: number;
/** /**
* Maximum time for each download request, in milliseconds (this * Maximum time for each download request, in milliseconds (this
@ -78,7 +78,7 @@ export interface UploadOptions {
* *
* @default 30000 * @default 30000
*/ */
timeoutInMs?: number, timeoutInMs?: number;
lookupOnly?: boolean lookupOnly?: boolean;
} }

@ -1,14 +1,12 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import { HttpClient, HttpClientResponse } from "@actions/http-client"; import { HttpClient, HttpClientResponse } from "@actions/http-client";
import { GetObjectCommand, S3Client, S3ClientConfig } from "@aws-sdk/client-s3"; import { GetObjectCommand, S3Client, S3ClientConfig } from "@aws-sdk/client-s3";
import * as buffer from "buffer";
import * as fs from "fs"; import * as fs from "fs";
import * as stream from "stream"; import * as stream from "stream";
import * as util from "util"; import * as util from "util";
import * as utils from "./cacheUtils"; import * as utils from "./cacheUtils";
import { SocketTimeout } from "./cacheUtils"; import { SocketTimeout } from "./cacheUtils";
import { DownloadOptions, UploadOptions } from "./contracts";
import { retryHttpClientResponse } from "./requestUtils"; import { retryHttpClientResponse } from "./requestUtils";
/** /**

@ -1,4 +1,5 @@
import * as core from '@actions/core' import * as core from "@actions/core";
import { DownloadOptions, UploadOptions } from "./contracts"; import { DownloadOptions, UploadOptions } from "./contracts";
/** /**
@ -7,25 +8,25 @@ import { DownloadOptions, UploadOptions } from "./contracts";
* @param copy the original upload options * @param copy the original upload options
*/ */
export function getUploadOptions(copy?: UploadOptions): UploadOptions { export function getUploadOptions(copy?: UploadOptions): UploadOptions {
const result: UploadOptions = { const result: UploadOptions = {
uploadConcurrency: 4, uploadConcurrency: 4,
uploadChunkSize: 32 * 1024 * 1024 uploadChunkSize: 32 * 1024 * 1024
} };
if (copy) { if (copy) {
if (typeof copy.uploadConcurrency === 'number') { if (typeof copy.uploadConcurrency === "number") {
result.uploadConcurrency = copy.uploadConcurrency result.uploadConcurrency = copy.uploadConcurrency;
} }
if (typeof copy.uploadChunkSize === 'number') { if (typeof copy.uploadChunkSize === "number") {
result.uploadChunkSize = copy.uploadChunkSize result.uploadChunkSize = copy.uploadChunkSize;
}
} }
}
core.debug(`Upload concurrency: ${result.uploadConcurrency}`) core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
core.debug(`Upload chunk size: ${result.uploadChunkSize}`) core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
return result return result;
} }
/** /**
@ -34,29 +35,29 @@ export function getUploadOptions(copy?: UploadOptions): UploadOptions {
* @param copy the original download options * @param copy the original download options
*/ */
export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions { export function getDownloadOptions(copy?: DownloadOptions): DownloadOptions {
const result: DownloadOptions = { const result: DownloadOptions = {
useAzureSdk: true, useAzureSdk: true,
downloadConcurrency: 8, downloadConcurrency: 8,
timeoutInMs: 30000 timeoutInMs: 30000
} };
if (copy) { if (copy) {
if (typeof copy.useAzureSdk === 'boolean') { if (typeof copy.useAzureSdk === "boolean") {
result.useAzureSdk = copy.useAzureSdk result.useAzureSdk = copy.useAzureSdk;
} }
if (typeof copy.downloadConcurrency === 'number') { if (typeof copy.downloadConcurrency === "number") {
result.downloadConcurrency = copy.downloadConcurrency result.downloadConcurrency = copy.downloadConcurrency;
} }
if (typeof copy.timeoutInMs === 'number') { if (typeof copy.timeoutInMs === "number") {
result.timeoutInMs = copy.timeoutInMs result.timeoutInMs = copy.timeoutInMs;
}
} }
}
core.debug(`Use Azure SDK: ${result.useAzureSdk}`) core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
core.debug(`Download concurrency: ${result.downloadConcurrency}`) core.debug(`Download concurrency: ${result.downloadConcurrency}`);
core.debug(`Request timeout (ms): ${result.timeoutInMs}`) core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
return result return result;
} }

@ -1,10 +1,11 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import { import {
HttpCodes,
HttpClientError, HttpClientError,
HttpClientResponse HttpClientResponse,
HttpCodes
} from "@actions/http-client"; } from "@actions/http-client";
import { DefaultRetryDelay, DefaultRetryAttempts } from "./cacheUtils";
import { DefaultRetryAttempts, DefaultRetryDelay } from "./cacheUtils";
import { ITypedResponseWithError } from "./contracts"; import { ITypedResponseWithError } from "./contracts";
export function isSuccessStatusCode(statusCode?: number): boolean { export function isSuccessStatusCode(statusCode?: number): boolean {

@ -2,6 +2,7 @@ import { exec } from "@actions/exec";
import * as io from "@actions/io"; import * as io from "@actions/io";
import { existsSync, writeFileSync } from "fs"; import { existsSync, writeFileSync } from "fs";
import * as path from "path"; import * as path from "path";
import * as utils from "./cacheUtils"; import * as utils from "./cacheUtils";
import { CompressionMethod } from "./cacheUtils"; import { CompressionMethod } from "./cacheUtils";

Loading…
Cancel
Save