mirror of https://github.com/actions/toolkit
Add the download cache file status code to debug log
parent
0e321b26f4
commit
4d31e1048a
|
@ -3,18 +3,18 @@ import * as path from 'path'
|
||||||
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 { getCacheServiceVersion, isGhes } from './internal/config'
|
import {getCacheServiceVersion, isGhes} from './internal/config'
|
||||||
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,
|
||||||
FinalizeCacheEntryUploadRequest,
|
FinalizeCacheEntryUploadRequest,
|
||||||
FinalizeCacheEntryUploadResponse,
|
FinalizeCacheEntryUploadResponse,
|
||||||
GetCacheEntryDownloadURLRequest
|
GetCacheEntryDownloadURLRequest
|
||||||
} 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)
|
||||||
|
@ -271,7 +271,10 @@ async function restoreCacheV2(
|
||||||
core.debug(`Archive path: ${archivePath}`)
|
core.debug(`Archive path: ${archivePath}`)
|
||||||
core.debug(`Starting download of archive to: ${archivePath}`)
|
core.debug(`Starting download of archive to: ${archivePath}`)
|
||||||
|
|
||||||
const downloadResponse = await downloadCacheFile(response.signedDownloadUrl, archivePath)
|
const downloadResponse = await downloadCacheFile(
|
||||||
|
response.signedDownloadUrl,
|
||||||
|
archivePath
|
||||||
|
)
|
||||||
core.debug(`Download response status: ${downloadResponse._response.status}`)
|
core.debug(`Download response status: ${downloadResponse._response.status}`)
|
||||||
|
|
||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
|
||||||
|
@ -408,9 +411,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(
|
||||||
|
|
Loading…
Reference in New Issue