mirror of
				https://github.com/actions/setup-java.git
				synced 2025-11-04 08:53:32 +00:00 
			
		
		
		
	suggest users to run without daemon if fail to save Gradle cache on Windows
This commit is contained in:
		
							parent
							
								
									7fe6c4d631
								
							
						
					
					
						commit
						fae2927552
					
				
							
								
								
									
										16
									
								
								dist/cleanup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								dist/cleanup/index.js
									
									
									
									
										vendored
									
									
								
							@ -64623,12 +64623,28 @@ function save(id) {
 | 
				
			|||||||
                core.info(error.message);
 | 
					                core.info(error.message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
 | 
					                if (isProbablyGradleDaemonProblem(packageManager, error)) {
 | 
				
			||||||
 | 
					                    core.warning('Failed to save Gradle cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with `--no-daemon` option. Refer to https://github.com/actions/cache/issues/454 for detail.');
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                throw error;
 | 
					                throw error;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.save = save;
 | 
					exports.save = save;
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @param packageManager the specified package manager by user
 | 
				
			||||||
 | 
					 * @param error the error thrown by the saveCache
 | 
				
			||||||
 | 
					 * @returns true if the given error seems related to the {@link https://github.com/actions/cache/issues/454|running Gradle Daemon issue}.
 | 
				
			||||||
 | 
					 * @see {@link https://github.com/actions/cache/issues/454#issuecomment-840493935|why --no-daemon is necessary}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function isProbablyGradleDaemonProblem(packageManager, error) {
 | 
				
			||||||
 | 
					    if (packageManager.id !== 'gradle' || process.env['RUNNER_OS'] !== 'Windows') {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const message = error.message || '';
 | 
				
			||||||
 | 
					    return message.startsWith('Tar failed with error: ');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***/ }),
 | 
					/***/ }),
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										16
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							@ -19019,12 +19019,28 @@ function save(id) {
 | 
				
			|||||||
                core.info(error.message);
 | 
					                core.info(error.message);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
 | 
					                if (isProbablyGradleDaemonProblem(packageManager, error)) {
 | 
				
			||||||
 | 
					                    core.warning('Failed to save Gradle cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with `--no-daemon` option. Refer to https://github.com/actions/cache/issues/454 for detail.');
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                throw error;
 | 
					                throw error;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.save = save;
 | 
					exports.save = save;
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @param packageManager the specified package manager by user
 | 
				
			||||||
 | 
					 * @param error the error thrown by the saveCache
 | 
				
			||||||
 | 
					 * @returns true if the given error seems related to the {@link https://github.com/actions/cache/issues/454|running Gradle Daemon issue}.
 | 
				
			||||||
 | 
					 * @see {@link https://github.com/actions/cache/issues/454#issuecomment-840493935|why --no-daemon is necessary}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function isProbablyGradleDaemonProblem(packageManager, error) {
 | 
				
			||||||
 | 
					    if (packageManager.id !== 'gradle' || process.env['RUNNER_OS'] !== 'Windows') {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const message = error.message || '';
 | 
				
			||||||
 | 
					    return message.startsWith('Tar failed with error: ');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***/ }),
 | 
					/***/ }),
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										19
									
								
								src/cache.ts
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/cache.ts
									
									
									
									
									
								
							@ -110,7 +110,26 @@ export async function save(id: string) {
 | 
				
			|||||||
    if (error.name === cache.ReserveCacheError.name) {
 | 
					    if (error.name === cache.ReserveCacheError.name) {
 | 
				
			||||||
      core.info(error.message);
 | 
					      core.info(error.message);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
					      if (isProbablyGradleDaemonProblem(packageManager, error)) {
 | 
				
			||||||
 | 
					        core.warning(
 | 
				
			||||||
 | 
					          'Failed to save Gradle cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with `--no-daemon` option. Refer to https://github.com/actions/cache/issues/454 for detail.'
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      throw error;
 | 
					      throw error;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @param packageManager the specified package manager by user
 | 
				
			||||||
 | 
					 * @param error the error thrown by the saveCache
 | 
				
			||||||
 | 
					 * @returns true if the given error seems related to the {@link https://github.com/actions/cache/issues/454|running Gradle Daemon issue}.
 | 
				
			||||||
 | 
					 * @see {@link https://github.com/actions/cache/issues/454#issuecomment-840493935|why --no-daemon is necessary}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function isProbablyGradleDaemonProblem(packageManager: PackageManager, error: Error) {
 | 
				
			||||||
 | 
					  if (packageManager.id !== 'gradle' || process.env['RUNNER_OS'] !== 'Windows') {
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  const message = error.message || '';
 | 
				
			||||||
 | 
					  return message.startsWith('Tar failed with error: ');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user