1
0
Fork 0

Linter cleanups

pull/1857/head
Bassem Dghaidi 2024-11-14 03:34:13 -08:00 committed by GitHub
parent b2557ac90c
commit 19cdd5f210
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 17 deletions

View File

@ -4,8 +4,8 @@ import * as config from './internal/config'
import * as utils from './internal/cacheUtils' import * as utils from './internal/cacheUtils'
import * as cacheHttpClient from './internal/cacheHttpClient' import * as cacheHttpClient from './internal/cacheHttpClient'
import * as cacheTwirpClient from './internal/shared/cacheTwirpClient' import * as cacheTwirpClient from './internal/shared/cacheTwirpClient'
import {DownloadOptions, UploadOptions} from './options' import { DownloadOptions, UploadOptions } from './options'
import {createTar, extractTar, listTar} from './internal/tar' import { createTar, extractTar, listTar } from './internal/tar'
import { import {
CreateCacheEntryRequest, CreateCacheEntryRequest,
CreateCacheEntryResponse, CreateCacheEntryResponse,
@ -14,9 +14,9 @@ import {
GetCacheEntryDownloadURLRequest, GetCacheEntryDownloadURLRequest,
GetCacheEntryDownloadURLResponse GetCacheEntryDownloadURLResponse
} from './generated/results/api/v1/cache' } from './generated/results/api/v1/cache'
import {CacheFileSizeLimit} from './internal/constants' import { CacheFileSizeLimit } from './internal/constants'
import {UploadCacheFile} from './internal/blob/upload-cache' import { UploadCacheFile } from './internal/blob/upload-cache'
import {DownloadCacheFile} from './internal/blob/download-cache' import { DownloadCacheFile } from './internal/blob/download-cache'
export class ValidationError extends Error { export class ValidationError extends Error {
constructor(message: string) { constructor(message: string) {
super(message) super(message)
@ -84,7 +84,6 @@ export async function restoreCache(
checkPaths(paths) checkPaths(paths)
const cacheServiceVersion: string = config.getCacheServiceVersion() const cacheServiceVersion: string = config.getCacheServiceVersion()
console.debug(`Cache service version: ${cacheServiceVersion}`)
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case 'v2': case 'v2':
return await restoreCachev2( return await restoreCachev2(
@ -246,7 +245,7 @@ async function restoreCachev2(
workflowRunBackendId: backendIds.workflowRunBackendId, workflowRunBackendId: backendIds.workflowRunBackendId,
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: primaryKey, key: primaryKey,
restoreKeys: restoreKeys, restoreKeys,
version: utils.getCacheVersion( version: utils.getCacheVersion(
paths, paths,
compressionMethod, compressionMethod,
@ -307,8 +306,6 @@ async function restoreCachev2(
core.debug(`Failed to delete archive: ${error}`) core.debug(`Failed to delete archive: ${error}`)
} }
} }
return undefined
} }
/** /**
@ -330,7 +327,6 @@ export async function saveCache(
checkKey(key) checkKey(key)
const cacheServiceVersion: string = config.getCacheServiceVersion() const cacheServiceVersion: string = config.getCacheServiceVersion()
console.debug(`Cache Service Version: ${cacheServiceVersion}`)
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case 'v2': case 'v2':
return await saveCachev2(paths, key, options, enableCrossOsArchive) return await saveCachev2(paths, key, options, enableCrossOsArchive)
@ -410,9 +406,9 @@ async function saveCachev1(
} else if (reserveCacheResponse?.statusCode === 400) { } else if (reserveCacheResponse?.statusCode === 400) {
throw new Error( throw new Error(
reserveCacheResponse?.error?.message ?? reserveCacheResponse?.error?.message ??
`Cache size of ~${Math.round( `Cache size of ~${Math.round(
archiveFileSize / (1024 * 1024) archiveFileSize / (1024 * 1024)
)} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.` )} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`
) )
} else { } else {
throw new ReserveCacheError( throw new ReserveCacheError(
@ -509,8 +505,8 @@ async function saveCachev2(
const request: CreateCacheEntryRequest = { const request: CreateCacheEntryRequest = {
workflowRunBackendId: backendIds.workflowRunBackendId, workflowRunBackendId: backendIds.workflowRunBackendId,
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: key, key,
version: version version
} }
const response: CreateCacheEntryResponse = const response: CreateCacheEntryResponse =
await twirpClient.CreateCacheEntry(request) await twirpClient.CreateCacheEntry(request)
@ -526,8 +522,8 @@ async function saveCachev2(
const finalizeRequest: FinalizeCacheEntryUploadRequest = { const finalizeRequest: FinalizeCacheEntryUploadRequest = {
workflowRunBackendId: backendIds.workflowRunBackendId, workflowRunBackendId: backendIds.workflowRunBackendId,
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: key, key,
version: version, version,
sizeBytes: `${archiveFileSize}` sizeBytes: `${archiveFileSize}`
} }