1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-11-23 20:19:16 +01:00

Add more debug info

This commit is contained in:
Bassem Dghaidi 2024-06-17 02:58:38 -07:00 committed by GitHub
parent 15ed468872
commit 92c0d581d5
4 changed files with 16 additions and 8 deletions

View file

@ -3334,6 +3334,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
core.warning(`Cache not found for keys: ${keys.join(', ')}`); core.warning(`Cache not found for keys: ${keys.join(', ')}`);
return undefined; return undefined;
} }
core.info(`Cache hit for: ${signedDownloadURL.blobs[0].key}`);
core.info(`Starting download of artifact to: ${paths[0]}`); core.info(`Starting download of artifact to: ${paths[0]}`);
yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]); yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]);
core.info(`Artifact download completed successfully.`); core.info(`Artifact download completed successfully.`);
@ -5781,7 +5782,7 @@ function StreamExtract(url, directory) {
} }
catch (error) { catch (error) {
retryCount++; retryCount++;
core.debug(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`); core.info(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`);
// wait 5 seconds before retrying // wait 5 seconds before retrying
yield new Promise(resolve => setTimeout(resolve, 5000)); yield new Promise(resolve => setTimeout(resolve, 5000));
} }
@ -5795,6 +5796,7 @@ function streamExtractExternal(url, directory) {
const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`); const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`);
const response = yield client.get(url); const response = yield client.get(url);
if (response.message.statusCode !== 200) { if (response.message.statusCode !== 200) {
core.info(`Failed to download cache. HTTP status code: ${response.message.statusCode}`);
throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`); throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`);
} }
const timeout = 30 * 1000; // 30 seconds const timeout = 30 * 1000; // 30 seconds
@ -5808,7 +5810,7 @@ function streamExtractExternal(url, directory) {
timer.refresh(); timer.refresh();
}) })
.on('error', (error) => { .on('error', (error) => {
core.debug(`response.message: Cache download failed: ${error.message}`); core.info(`response.message: Cache download failed: ${error.message}`);
clearTimeout(timer); clearTimeout(timer);
reject(error); reject(error);
}) })

View file

@ -3334,6 +3334,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
core.warning(`Cache not found for keys: ${keys.join(', ')}`); core.warning(`Cache not found for keys: ${keys.join(', ')}`);
return undefined; return undefined;
} }
core.info(`Cache hit for: ${signedDownloadURL.blobs[0].key}`);
core.info(`Starting download of artifact to: ${paths[0]}`); core.info(`Starting download of artifact to: ${paths[0]}`);
yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]); yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]);
core.info(`Artifact download completed successfully.`); core.info(`Artifact download completed successfully.`);
@ -5781,7 +5782,7 @@ function StreamExtract(url, directory) {
} }
catch (error) { catch (error) {
retryCount++; retryCount++;
core.debug(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`); core.info(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`);
// wait 5 seconds before retrying // wait 5 seconds before retrying
yield new Promise(resolve => setTimeout(resolve, 5000)); yield new Promise(resolve => setTimeout(resolve, 5000));
} }
@ -5795,6 +5796,7 @@ function streamExtractExternal(url, directory) {
const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`); const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`);
const response = yield client.get(url); const response = yield client.get(url);
if (response.message.statusCode !== 200) { if (response.message.statusCode !== 200) {
core.info(`Failed to download cache. HTTP status code: ${response.message.statusCode}`);
throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`); throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`);
} }
const timeout = 30 * 1000; // 30 seconds const timeout = 30 * 1000; // 30 seconds
@ -5808,7 +5810,7 @@ function streamExtractExternal(url, directory) {
timer.refresh(); timer.refresh();
}) })
.on('error', (error) => { .on('error', (error) => {
core.debug(`response.message: Cache download failed: ${error.message}`); core.info(`response.message: Cache download failed: ${error.message}`);
clearTimeout(timer); clearTimeout(timer);
reject(error); reject(error);
}) })

View file

@ -3334,6 +3334,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
core.warning(`Cache not found for keys: ${keys.join(', ')}`); core.warning(`Cache not found for keys: ${keys.join(', ')}`);
return undefined; return undefined;
} }
core.info(`Cache hit for: ${signedDownloadURL.blobs[0].key}`);
core.info(`Starting download of artifact to: ${paths[0]}`); core.info(`Starting download of artifact to: ${paths[0]}`);
yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]); yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]);
core.info(`Artifact download completed successfully.`); core.info(`Artifact download completed successfully.`);
@ -5781,7 +5782,7 @@ function StreamExtract(url, directory) {
} }
catch (error) { catch (error) {
retryCount++; retryCount++;
core.debug(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`); core.info(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`);
// wait 5 seconds before retrying // wait 5 seconds before retrying
yield new Promise(resolve => setTimeout(resolve, 5000)); yield new Promise(resolve => setTimeout(resolve, 5000));
} }
@ -5795,6 +5796,7 @@ function streamExtractExternal(url, directory) {
const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`); const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`);
const response = yield client.get(url); const response = yield client.get(url);
if (response.message.statusCode !== 200) { if (response.message.statusCode !== 200) {
core.info(`Failed to download cache. HTTP status code: ${response.message.statusCode}`);
throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`); throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`);
} }
const timeout = 30 * 1000; // 30 seconds const timeout = 30 * 1000; // 30 seconds
@ -5808,7 +5810,7 @@ function streamExtractExternal(url, directory) {
timer.refresh(); timer.refresh();
}) })
.on('error', (error) => { .on('error', (error) => {
core.debug(`response.message: Cache download failed: ${error.message}`); core.info(`response.message: Cache download failed: ${error.message}`);
clearTimeout(timer); clearTimeout(timer);
reject(error); reject(error);
}) })

6
dist/save/index.js vendored
View file

@ -3334,6 +3334,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
core.warning(`Cache not found for keys: ${keys.join(', ')}`); core.warning(`Cache not found for keys: ${keys.join(', ')}`);
return undefined; return undefined;
} }
core.info(`Cache hit for: ${signedDownloadURL.blobs[0].key}`);
core.info(`Starting download of artifact to: ${paths[0]}`); core.info(`Starting download of artifact to: ${paths[0]}`);
yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]); yield (0, download_cache_1.StreamExtract)(signedDownloadURL.blobs[0].signedUrl, paths[0]);
core.info(`Artifact download completed successfully.`); core.info(`Artifact download completed successfully.`);
@ -5781,7 +5782,7 @@ function StreamExtract(url, directory) {
} }
catch (error) { catch (error) {
retryCount++; retryCount++;
core.debug(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`); core.info(`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`);
// wait 5 seconds before retrying // wait 5 seconds before retrying
yield new Promise(resolve => setTimeout(resolve, 5000)); yield new Promise(resolve => setTimeout(resolve, 5000));
} }
@ -5795,6 +5796,7 @@ function streamExtractExternal(url, directory) {
const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`); const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`);
const response = yield client.get(url); const response = yield client.get(url);
if (response.message.statusCode !== 200) { if (response.message.statusCode !== 200) {
core.info(`Failed to download cache. HTTP status code: ${response.message.statusCode}`);
throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`); throw new Error(`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`);
} }
const timeout = 30 * 1000; // 30 seconds const timeout = 30 * 1000; // 30 seconds
@ -5808,7 +5810,7 @@ function streamExtractExternal(url, directory) {
timer.refresh(); timer.refresh();
}) })
.on('error', (error) => { .on('error', (error) => {
core.debug(`response.message: Cache download failed: ${error.message}`); core.info(`response.message: Cache download failed: ${error.message}`);
clearTimeout(timer); clearTimeout(timer);
reject(error); reject(error);
}) })