mirror of
https://github.com/actions/setup-java.git
synced 2026-07-08 05:55:44 +00:00
Removed extra alpine logic
This commit is contained in:
parent
1dc95d11b7
commit
1f4d6b3489
@ -122,55 +122,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"version": "17.0.9",
|
|
||||||
"stable": true,
|
|
||||||
"release_url": "https://aka.ms/download-jdk",
|
|
||||||
"files": [
|
|
||||||
{
|
|
||||||
"filename": "microsoft-jdk-17.0.9-macos-x64.tar.gz",
|
|
||||||
"arch": "x64",
|
|
||||||
"platform": "darwin",
|
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-x64.tar.gz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename": "microsoft-jdk-17.0.9-linux-x64.tar.gz",
|
|
||||||
"arch": "x64",
|
|
||||||
"platform": "linux",
|
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-x64.tar.gz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename": "microsoft-jdk-17.0.9-windows-x64.zip",
|
|
||||||
"arch": "x64",
|
|
||||||
"platform": "win32",
|
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-x64.zip"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename": "microsoft-jdk-17.0.9-alpine-x64.tar.gz",
|
|
||||||
"arch": "x64",
|
|
||||||
"platform": "alpine",
|
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-alpine-x64.tar.gz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename": "microsoft-jdk-17.0.9-macos-aarch64.tar.gz",
|
|
||||||
"arch": "aarch64",
|
|
||||||
"platform": "darwin",
|
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-aarch64.tar.gz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename": "microsoft-jdk-17.0.9-linux-aarch64.tar.gz",
|
|
||||||
"arch": "aarch64",
|
|
||||||
"platform": "linux",
|
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-aarch64.tar.gz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename": "microsoft-jdk-17.0.9-windows-aarch64.zip",
|
|
||||||
"arch": "aarch64",
|
|
||||||
"platform": "win32",
|
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-aarch64.zip"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"version": "17.0.7",
|
"version": "17.0.7",
|
||||||
"stable": true,
|
"stable": true,
|
||||||
|
|||||||
@ -196,35 +196,6 @@ describe('findPackageForDownload', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prefers Alpine package when running on Alpine and requesting JDK 17', async () => {
|
|
||||||
jest.spyOn(distribution as any, 'isRunningOnAlpine').mockReturnValue(true);
|
|
||||||
|
|
||||||
const result = await distribution['findPackageForDownload']('17.0.9');
|
|
||||||
|
|
||||||
expect(result.version).toBe('17.0.9');
|
|
||||||
expect(result.url).toBe(
|
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-17.0.9-alpine-x64.tar.gz'
|
|
||||||
);
|
|
||||||
expect(result.signatureUrl).toBe(
|
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-17.0.9-alpine-x64.tar.gz.sig'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('falls back to generic linux manifest matching for unsupported major streams on Alpine', async () => {
|
|
||||||
jest.spyOn(distribution as any, 'isRunningOnAlpine').mockReturnValue(true);
|
|
||||||
jest.spyOn(os, 'platform').mockReturnValue('linux');
|
|
||||||
|
|
||||||
const result = await distribution['findPackageForDownload']('21.x');
|
|
||||||
|
|
||||||
expect(result.version).toBe('21.0.0');
|
|
||||||
expect(result.url).toBe(
|
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-21.0.0-linux-x64.tar.gz'
|
|
||||||
);
|
|
||||||
expect(result.signatureUrl).toBe(
|
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-21.0.0-linux-x64.tar.gz.sig'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('uses manifest-provided signature URL when available', async () => {
|
it('uses manifest-provided signature URL when available', async () => {
|
||||||
spyGetManifestFromRepo.mockReturnValue({
|
spyGetManifestFromRepo.mockReturnValue({
|
||||||
result: [
|
result: [
|
||||||
|
|||||||
39
dist/setup/index.js
vendored
39
dist/setup/index.js
vendored
@ -79932,7 +79932,6 @@ const core = __importStar(__nccwpck_require__(37484));
|
|||||||
const tc = __importStar(__nccwpck_require__(33472));
|
const tc = __importStar(__nccwpck_require__(33472));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(79896));
|
const fs_1 = __importDefault(__nccwpck_require__(79896));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(16928));
|
const path_1 = __importDefault(__nccwpck_require__(16928));
|
||||||
const semver_1 = __importDefault(__nccwpck_require__(62088));
|
|
||||||
var microsoft_key_2 = __nccwpck_require__(56286);
|
var microsoft_key_2 = __nccwpck_require__(56286);
|
||||||
Object.defineProperty(exports, "MICROSOFT_PUBLIC_KEY", ({ enumerable: true, get: function () { return microsoft_key_2.MICROSOFT_PUBLIC_KEY; } }));
|
Object.defineProperty(exports, "MICROSOFT_PUBLIC_KEY", ({ enumerable: true, get: function () { return microsoft_key_2.MICROSOFT_PUBLIC_KEY; } }));
|
||||||
class MicrosoftDistributions extends base_installer_1.JavaBase {
|
class MicrosoftDistributions extends base_installer_1.JavaBase {
|
||||||
@ -79985,21 +79984,7 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
|
|||||||
if (!manifest) {
|
if (!manifest) {
|
||||||
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
||||||
}
|
}
|
||||||
let foundRelease;
|
const foundRelease = yield tc.findFromManifest(range, true, manifest, arch);
|
||||||
if (this.isRunningOnAlpine() && this.isAlpineSupportedVersion(range)) {
|
|
||||||
foundRelease = this.findFromManifestForPlatform(range, manifest, arch, 'alpine');
|
|
||||||
if (foundRelease) {
|
|
||||||
core.debug(`Resolved Alpine package for Microsoft OpenJDK ${range}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (this.isRunningOnAlpine()) {
|
|
||||||
core.debug(`No Alpine package found for Microsoft OpenJDK ${range}, defaulting to standard linux package`);
|
|
||||||
}
|
|
||||||
// Runs if user is not running on alpine, or if no Alpine package was found
|
|
||||||
if (!foundRelease) {
|
|
||||||
foundRelease = yield tc.findFromManifest(range, true, manifest, arch);
|
|
||||||
}
|
|
||||||
// Runs if failed to find any matching package
|
|
||||||
if (!foundRelease) {
|
if (!foundRelease) {
|
||||||
const availableVersionStrings = manifest.map(item => item.version);
|
const availableVersionStrings = manifest.map(item => item.version);
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
@ -80013,28 +79998,6 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
findFromManifestForPlatform(range, manifest, arch, platform) {
|
|
||||||
const matched = manifest
|
|
||||||
.filter(release => release.stable)
|
|
||||||
.filter(release => (0, util_1.isVersionSatisfies)(range, release.version))
|
|
||||||
.map(release => {
|
|
||||||
const matchedFile = release.files.find((file) => file.arch === arch && file.platform === platform);
|
|
||||||
if (!matchedFile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return Object.assign(Object.assign({}, release), { files: [matchedFile] });
|
|
||||||
})
|
|
||||||
.filter((release) => release !== null)
|
|
||||||
.sort((a, b) => -semver_1.default.compareBuild(a.version, b.version));
|
|
||||||
return matched[0];
|
|
||||||
}
|
|
||||||
isAlpineSupportedVersion(range) {
|
|
||||||
const minVersion = semver_1.default.minVersion(range);
|
|
||||||
return !!minVersion && (minVersion.major === 11 || minVersion.major === 17);
|
|
||||||
}
|
|
||||||
isRunningOnAlpine() {
|
|
||||||
return process.platform === 'linux' && fs_1.default.existsSync('/etc/alpine-release');
|
|
||||||
}
|
|
||||||
supportsSignatureVerification() {
|
supportsSignatureVerification() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import {
|
|||||||
extractJdkFile,
|
extractJdkFile,
|
||||||
getDownloadArchiveExtension,
|
getDownloadArchiveExtension,
|
||||||
getGitHubHttpHeaders,
|
getGitHubHttpHeaders,
|
||||||
isVersionSatisfies,
|
|
||||||
renameWinArchive
|
renameWinArchive
|
||||||
} from '../../util';
|
} from '../../util';
|
||||||
import * as gpg from '../../gpg';
|
import * as gpg from '../../gpg';
|
||||||
@ -17,7 +16,6 @@ import * as core from '@actions/core';
|
|||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import semver from 'semver';
|
|
||||||
import {TypedResponse} from '@actions/http-client/lib/interfaces';
|
import {TypedResponse} from '@actions/http-client/lib/interfaces';
|
||||||
|
|
||||||
export {MICROSOFT_PUBLIC_KEY} from './microsoft-key';
|
export {MICROSOFT_PUBLIC_KEY} from './microsoft-key';
|
||||||
@ -99,30 +97,8 @@ export class MicrosoftDistributions extends JavaBase {
|
|||||||
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
|
||||||
}
|
}
|
||||||
|
|
||||||
let foundRelease: tc.IToolRelease | undefined;
|
const foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
||||||
|
|
||||||
if (this.isRunningOnAlpine() && this.isAlpineSupportedVersion(range)) {
|
|
||||||
foundRelease = this.findFromManifestForPlatform(
|
|
||||||
range,
|
|
||||||
manifest,
|
|
||||||
arch,
|
|
||||||
'alpine'
|
|
||||||
);
|
|
||||||
if (foundRelease) {
|
|
||||||
core.debug(`Resolved Alpine package for Microsoft OpenJDK ${range}`);
|
|
||||||
}
|
|
||||||
} else if (this.isRunningOnAlpine()) {
|
|
||||||
core.debug(
|
|
||||||
`No Alpine package found for Microsoft OpenJDK ${range}, defaulting to standard linux package`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Runs if user is not running on alpine, or if no Alpine package was found
|
|
||||||
if (!foundRelease) {
|
|
||||||
foundRelease = await tc.findFromManifest(range, true, manifest, arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Runs if failed to find any matching package
|
|
||||||
if (!foundRelease) {
|
if (!foundRelease) {
|
||||||
const availableVersionStrings = manifest.map(item => item.version);
|
const availableVersionStrings = manifest.map(item => item.version);
|
||||||
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
throw this.createVersionNotFoundError(range, availableVersionStrings);
|
||||||
@ -141,44 +117,6 @@ export class MicrosoftDistributions extends JavaBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private findFromManifestForPlatform(
|
|
||||||
range: string,
|
|
||||||
manifest: tc.IToolRelease[],
|
|
||||||
arch: string,
|
|
||||||
platform: string
|
|
||||||
): tc.IToolRelease | undefined {
|
|
||||||
const matched = manifest
|
|
||||||
.filter(release => release.stable)
|
|
||||||
.filter(release => isVersionSatisfies(range, release.version))
|
|
||||||
.map(release => {
|
|
||||||
const matchedFile = release.files.find(
|
|
||||||
(file: tc.IToolReleaseFile) =>
|
|
||||||
file.arch === arch && file.platform === platform
|
|
||||||
);
|
|
||||||
if (!matchedFile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
...release,
|
|
||||||
files: [matchedFile]
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter((release): release is tc.IToolRelease => release !== null)
|
|
||||||
.sort((a, b) => -semver.compareBuild(a.version, b.version));
|
|
||||||
|
|
||||||
return matched[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
private isAlpineSupportedVersion(range: string): boolean {
|
|
||||||
const minVersion = semver.minVersion(range);
|
|
||||||
return !!minVersion && (minVersion.major === 11 || minVersion.major === 17);
|
|
||||||
}
|
|
||||||
|
|
||||||
private isRunningOnAlpine(): boolean {
|
|
||||||
return process.platform === 'linux' && fs.existsSync('/etc/alpine-release');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected supportsSignatureVerification(): boolean {
|
protected supportsSignatureVerification(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user