mirror of
https://github.com/actions/setup-java.git
synced 2026-11-05 18:15:50 +00:00
* chore(deps): bump the monthly-npm-updates group with 12 updates Bumps the monthly-npm-updates group with 12 updates: | Package | From | To | | --- | --- | --- | | [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache) | `6.2.0` | `6.3.0` | | [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) | `5.11.1` | `5.11.2` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `26.6.2` | `26.6.5` | | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `8.70.1` | `8.72.0` | | [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `8.70.1` | `8.72.0` | | [eslint](https://github.com/eslint/eslint) | `10.11.0` | `10.13.0` | | [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) | `29.16.6` | `29.17.0` | | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) | `18.3.0` | `18.5.0` | | [globals](https://github.com/sindresorhus/globals) | `17.12.0` | `17.13.0` | | [lint-staged](https://github.com/lint-staged/lint-staged) | `17.5.1` | `17.6.0` | | [prettier](https://github.com/prettier/prettier) | `3.9.9` | `3.9.10` | | [ts-jest](https://github.com/kulshekhar/ts-jest) | `29.4.13` | `29.4.15` | Updates `@actions/cache` from 6.2.0 to 6.3.0 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/cache/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/cache) Updates `fast-xml-parser` from 5.11.1 to 5.11.2 - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.11.1...v5.11.2) Updates `@types/node` from 26.6.2 to 26.6.5 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@typescript-eslint/eslint-plugin` from 8.70.1 to 8.72.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.0/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 8.70.1 to 8.72.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.0/packages/parser) Updates `eslint` from 10.11.0 to 10.13.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Commits](https://github.com/eslint/eslint/compare/v10.11.0...v10.13.0) Updates `eslint-plugin-jest` from 29.16.6 to 29.17.0 - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v29.16.6...v29.17.0) Updates `eslint-plugin-n` from 18.3.0 to 18.5.0 - [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases) - [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v18.3.0...v18.5.0) Updates `globals` from 17.12.0 to 17.13.0 - [Release notes](https://github.com/sindresorhus/globals/releases) - [Commits](https://github.com/sindresorhus/globals/compare/v17.12.0...v17.13.0) Updates `lint-staged` from 17.5.1 to 17.6.0 - [Release notes](https://github.com/lint-staged/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/main/CHANGELOG.md) - [Commits](https://github.com/lint-staged/lint-staged/compare/v17.5.1...v17.6.0) Updates `prettier` from 3.9.9 to 3.9.10 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.9.9...3.9.10) Updates `ts-jest` from 29.4.13 to 29.4.15 - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v29.4.13...v29.4.15) --- updated-dependencies: - dependency-name: "@actions/cache" dependency-version: 6.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: fast-xml-parser dependency-version: 5.11.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: monthly-npm-updates - dependency-name: "@types/node" dependency-version: 26.6.5 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: monthly-npm-updates - dependency-name: "@typescript-eslint/eslint-plugin" dependency-version: 8.72.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: "@typescript-eslint/parser" dependency-version: 8.72.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: eslint dependency-version: 10.13.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: eslint-plugin-jest dependency-version: 29.17.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: eslint-plugin-n dependency-version: 18.5.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: globals dependency-version: 17.13.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: lint-staged dependency-version: 17.6.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: monthly-npm-updates - dependency-name: prettier dependency-version: 3.9.10 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: monthly-npm-updates - dependency-name: ts-jest dependency-version: 29.4.15 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: monthly-npm-updates ... Signed-off-by: dependabot[bot] <support@github.com> * chore: rebuild dist bundles Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * chore: refresh npm license cache Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bruno Borges <brborges@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
280 lines
11 KiB
JavaScript
280 lines
11 KiB
JavaScript
export const id = 348;
|
|
export const ids = [348];
|
|
export const modules = {
|
|
|
|
/***/ 967:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ saveJdkResolutionCaches: () => (/* binding */ saveJdkResolutionCaches)
|
|
/* harmony export */ });
|
|
/* unused harmony exports restoreJdkResolution, registerJdkResolution */
|
|
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6982);
|
|
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9896);
|
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6928);
|
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
|
|
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6080);
|
|
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3838);
|
|
|
|
|
|
|
|
|
|
|
|
const STATE_JDK_RESOLUTIONS = 'jdk-resolutions';
|
|
const JDK_RESOLUTION_KEY_VERSION = 2;
|
|
const RESOLUTION_DIRECTORY = 'setup-java-jdk-resolution';
|
|
const RESOLUTION_FILE_NAME = 'release.json';
|
|
const pendingResolutions = (/* unused pure expression or super */ null && ([]));
|
|
/**
|
|
* Restores a previously resolved release so a distribution can skip its vendor
|
|
* metadata API.
|
|
*
|
|
* The cache path deliberately excludes the freshness window: `@actions/cache`
|
|
* derives
|
|
* a cache version by hashing the requested paths, so a bucket-independent path
|
|
* is what allows the restore keys to fall back to an older bucket.
|
|
*/
|
|
async function restoreJdkResolution(request) {
|
|
// Deliberately not `isCacheFeatureAvailable()`: this is an optional
|
|
// optimization, and the JDK cache already warns once when the service is
|
|
// unreachable.
|
|
if (!cache.isFeatureAvailable()) {
|
|
return undefined;
|
|
}
|
|
const cachePath = getResolutionCachePath(request);
|
|
if (!cachePath) {
|
|
return undefined;
|
|
}
|
|
const keyPrefix = getResolutionKeyPrefix(request);
|
|
const primaryKey = `${keyPrefix}${getFreshnessBucket()}`;
|
|
let matchedKey;
|
|
try {
|
|
matchedKey = await cache.restoreCache([cachePath], primaryKey, [keyPrefix]);
|
|
}
|
|
catch (error) {
|
|
core.debug(`Failed to restore the JDK resolution cache: ${getErrorMessage(error)}`);
|
|
return undefined;
|
|
}
|
|
if (!matchedKey) {
|
|
return undefined;
|
|
}
|
|
let release;
|
|
try {
|
|
const contents = fs.readFileSync(path.join(cachePath, RESOLUTION_FILE_NAME), 'utf8');
|
|
release = parseResolvedRelease(contents);
|
|
}
|
|
catch (error) {
|
|
core.debug(`Ignoring the JDK resolution cache entry ${matchedKey}: ${getErrorMessage(error)}`);
|
|
return undefined;
|
|
}
|
|
return { release, fresh: matchedKey === primaryKey };
|
|
}
|
|
/**
|
|
* Persists a freshly resolved release for later jobs. The entry is written to
|
|
* disk immediately and uploaded by the post-job step.
|
|
*/
|
|
function registerJdkResolution(request, release) {
|
|
if (!cache.isFeatureAvailable()) {
|
|
return;
|
|
}
|
|
const cachePath = getResolutionCachePath(request);
|
|
if (!cachePath) {
|
|
return;
|
|
}
|
|
const payload = JSON.stringify(release);
|
|
try {
|
|
fs.mkdirSync(cachePath, { recursive: true });
|
|
fs.writeFileSync(path.join(cachePath, RESOLUTION_FILE_NAME), payload);
|
|
}
|
|
catch (error) {
|
|
core.debug(`Failed to record the JDK resolution cache entry: ${getErrorMessage(error)}`);
|
|
return;
|
|
}
|
|
const key = `${getResolutionKeyPrefix(request)}${getFreshnessBucket()}`;
|
|
if (!pendingResolutions.some(item => item.key === key)) {
|
|
pendingResolutions.push({ key, path: cachePath, release: payload });
|
|
}
|
|
core.saveState(STATE_JDK_RESOLUTIONS, JSON.stringify(pendingResolutions));
|
|
}
|
|
async function saveJdkResolutionCaches() {
|
|
const state = _actions_core__WEBPACK_IMPORTED_MODULE_4__/* .getState */ .Gu(STATE_JDK_RESOLUTIONS);
|
|
if (!state) {
|
|
return;
|
|
}
|
|
let resolutions;
|
|
try {
|
|
resolutions = parseJdkResolutionState(state);
|
|
}
|
|
catch (error) {
|
|
_actions_core__WEBPACK_IMPORTED_MODULE_4__/* .debug */ .Yz(`Invalid JDK resolution cache state, not saving: ${getErrorMessage(error)}`);
|
|
return;
|
|
}
|
|
for (const resolution of resolutions) {
|
|
// A restore performed by a later step overwrites this path, so the payload
|
|
// the key was computed for is written again rather than trusted to still be
|
|
// on disk.
|
|
try {
|
|
fs__WEBPACK_IMPORTED_MODULE_1___default().mkdirSync(resolution.path, { recursive: true });
|
|
fs__WEBPACK_IMPORTED_MODULE_1___default().writeFileSync(path__WEBPACK_IMPORTED_MODULE_2___default().join(resolution.path, RESOLUTION_FILE_NAME), resolution.release);
|
|
}
|
|
catch (error) {
|
|
_actions_core__WEBPACK_IMPORTED_MODULE_4__/* .debug */ .Yz(`Failed to write the JDK resolution cache entry for the key ${resolution.key}: ${getErrorMessage(error)}`);
|
|
continue;
|
|
}
|
|
try {
|
|
await _actions_cache__WEBPACK_IMPORTED_MODULE_3__/* .saveCache */ .Io([resolution.path], resolution.key);
|
|
}
|
|
catch (error) {
|
|
// A matrix of jobs resolving the same JDK races on the same daily key, so
|
|
// an already-reserved key is the expected outcome rather than a problem.
|
|
_actions_core__WEBPACK_IMPORTED_MODULE_4__/* .debug */ .Yz(`Failed to save the JDK resolution cache with the key ${resolution.key}: ${getErrorMessage(error)}`);
|
|
}
|
|
}
|
|
}
|
|
function getResolutionCachePath(request) {
|
|
const runnerTemp = process.env['RUNNER_TEMP'];
|
|
if (!runnerTemp) {
|
|
return undefined;
|
|
}
|
|
return path.join(runnerTemp, RESOLUTION_DIRECTORY, getResolutionIdentity(request));
|
|
}
|
|
function getResolutionIdentity(request) {
|
|
const identity = JSON.stringify({
|
|
keyVersion: JDK_RESOLUTION_KEY_VERSION,
|
|
runnerOs: getRunnerOs(),
|
|
distribution: request.distribution.toLowerCase(),
|
|
packageType: request.packageType.toLowerCase(),
|
|
platform: request.platform.toLowerCase(),
|
|
architecture: request.architecture.toLowerCase(),
|
|
versionSpec: request.versionSpec,
|
|
stable: request.stable,
|
|
source: request.source
|
|
});
|
|
return createHash('sha256').update(identity).digest('hex');
|
|
}
|
|
function getResolutionKeyPrefix(request) {
|
|
const architecture = request.architecture.toLowerCase();
|
|
const digest = getResolutionIdentity(request);
|
|
return `setup-java-jdkres-v${JDK_RESOLUTION_KEY_VERSION}-${getRunnerOs()}-${architecture}-${digest}-`;
|
|
}
|
|
function getRunnerOs() {
|
|
return process.env['RUNNER_OS'] ?? process.platform;
|
|
}
|
|
/**
|
|
* Start of the seven-day window the entry was resolved in, which bounds how long
|
|
* a floating version spec such as `21` can keep resolving to an already known
|
|
* release.
|
|
*
|
|
* Seven days is the longest usable window: GitHub evicts cache entries that have
|
|
* not been accessed for seven days, so a longer one would mean the previous
|
|
* entry is already gone when the window rolls over, taking the stale-fallback
|
|
* path with it. It also comfortably covers the real release cadence, which is
|
|
* monthly at its fastest and usually quarterly.
|
|
*/
|
|
function getFreshnessBucket() {
|
|
const week = 7 * 24 * 60 * 60 * 1000;
|
|
return new Date(Math.floor(Date.now() / week) * week)
|
|
.toISOString()
|
|
.slice(0, 10);
|
|
}
|
|
/**
|
|
* The restored payload drives a download, so it is validated as untrusted input
|
|
* rather than trusted because it came back from the cache service.
|
|
*/
|
|
function parseResolvedRelease(contents) {
|
|
const value = JSON.parse(contents);
|
|
if (typeof value !== 'object' || value === null) {
|
|
throw new Error('The cached resolution is not an object.');
|
|
}
|
|
const candidate = value;
|
|
const version = candidate['version'];
|
|
const url = candidate['url'];
|
|
const signatureUrl = candidate['signatureUrl'];
|
|
const floating = candidate['floating'];
|
|
if (typeof version !== 'string' || !version) {
|
|
throw new Error('The cached resolution has no version.');
|
|
}
|
|
assertHttpsUrl(url, 'url');
|
|
if (signatureUrl !== undefined) {
|
|
assertHttpsUrl(signatureUrl, 'signatureUrl');
|
|
}
|
|
if (floating !== undefined && typeof floating !== 'boolean') {
|
|
throw new Error('The cached resolution has an invalid floating flag.');
|
|
}
|
|
const release = {
|
|
version,
|
|
url: url
|
|
};
|
|
if (signatureUrl !== undefined) {
|
|
release.signatureUrl = signatureUrl;
|
|
}
|
|
if (floating !== undefined) {
|
|
release.floating = floating;
|
|
}
|
|
const checksum = candidate['checksum'];
|
|
if (checksum !== undefined) {
|
|
release.checksum = parseChecksum(checksum);
|
|
}
|
|
return release;
|
|
}
|
|
function parseChecksum(value) {
|
|
if (typeof value !== 'object' || value === null) {
|
|
throw new Error('The cached checksum is not an object.');
|
|
}
|
|
const candidate = value;
|
|
const algorithm = candidate['algorithm'];
|
|
const checksumValue = candidate['value'];
|
|
const source = candidate['source'];
|
|
if (algorithm !== 'sha256' && algorithm !== 'sha512') {
|
|
throw new Error(`Unsupported cached checksum algorithm: ${algorithm}`);
|
|
}
|
|
if (typeof checksumValue !== 'string' || !checksumValue) {
|
|
throw new Error('The cached checksum has no value.');
|
|
}
|
|
if (source !== undefined && typeof source !== 'string') {
|
|
throw new Error('The cached checksum source is not a string.');
|
|
}
|
|
const checksum = { algorithm, value: checksumValue };
|
|
if (source !== undefined) {
|
|
checksum.source = source;
|
|
}
|
|
return checksum;
|
|
}
|
|
function assertHttpsUrl(value, field) {
|
|
if (typeof value !== 'string' || !value) {
|
|
throw new Error(`The cached resolution has no ${field}.`);
|
|
}
|
|
let parsed;
|
|
try {
|
|
parsed = new URL(value);
|
|
}
|
|
catch {
|
|
throw new Error(`The cached resolution has a malformed ${field}.`);
|
|
}
|
|
if (parsed.protocol !== 'https:') {
|
|
throw new Error(`The cached resolution ${field} does not use HTTPS: ${parsed.protocol}`);
|
|
}
|
|
}
|
|
function parseJdkResolutionState(state) {
|
|
const value = JSON.parse(state);
|
|
if (!Array.isArray(value) ||
|
|
!value.every(item => typeof item === 'object' &&
|
|
item !== null &&
|
|
typeof item.key === 'string' &&
|
|
typeof item.path === 'string' &&
|
|
typeof item.release === 'string')) {
|
|
throw new Error('Invalid JDK resolution information retrieved from state.');
|
|
}
|
|
return value;
|
|
}
|
|
function getErrorMessage(error) {
|
|
return error instanceof Error ? error.message : String(error);
|
|
}
|
|
|
|
|
|
/***/ })
|
|
|
|
};
|