Temporarily use 22.3.1 for latest builds.

This is a temporary fix while we are rolling out the new GraalVM for JDK17/20 release.
This commit is contained in:
Fabio Niephaus 2023-06-13 19:17:04 +02:00
parent babc303d7e
commit b11d36630f
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
6 changed files with 67 additions and 13 deletions

View File

@ -1,7 +1,7 @@
import * as path from 'path' import * as path from 'path'
import * as graalvm from '../src/graalvm' import * as graalvm from '../src/graalvm'
import {expect, test} from '@jest/globals' import {expect, test} from '@jest/globals'
import {getLatestRelease} from '../src/utils' import {getTaggedRelease} from '../src/utils'
import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm' import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm'
import {GRAALVM_RELEASES_REPO} from '../src/constants' import {GRAALVM_RELEASES_REPO} from '../src/constants'
@ -31,7 +31,10 @@ test('request invalid version/javaVersion', async () => {
}) })
test('find version/javaVersion', async () => { test('find version/javaVersion', async () => {
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO) const latestRelease = await getTaggedRelease(
GRAALVM_RELEASES_REPO,
'vm-22.3.1'
)
const latestVersion = findGraalVMVersion(latestRelease) const latestVersion = findGraalVMVersion(latestRelease)
expect(latestVersion).not.toBe('') expect(latestVersion).not.toBe('')
const latestJavaVersion = findHighestJavaVersion(latestRelease, latestVersion) const latestJavaVersion = findHighestJavaVersion(latestRelease, latestVersion)
@ -43,7 +46,7 @@ test('find version/javaVersion', async () => {
findGraalVMVersion(invalidRelease) findGraalVMVersion(invalidRelease)
} catch (err) { } catch (err) {
if (!(err instanceof Error)) { if (!(err instanceof Error)) {
fail(`Unexpected non-Erro: ${err}`) fail(`Unexpected non-Error: ${err}`)
} }
error = err error = err
} }

15
dist/cleanup/index.js generated vendored
View File

@ -70461,7 +70461,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getTaggedRelease = exports.getLatestRelease = exports.exec = void 0;
const c = __importStar(__nccwpck_require__(9042)); const c = __importStar(__nccwpck_require__(9042));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
@ -70503,6 +70503,19 @@ function getLatestRelease(repo) {
}); });
} }
exports.getLatestRelease = getLatestRelease; exports.getLatestRelease = getLatestRelease;
function getTaggedRelease(repo, tag) {
return __awaiter(this, void 0, void 0, function* () {
const githubToken = getGitHubToken();
const options = githubToken.length > 0 ? { auth: githubToken } : {};
const octokit = new GitHubDotCom(options);
return (yield octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
owner: c.GRAALVM_GH_USER,
repo,
tag
})).data;
});
}
exports.getTaggedRelease = getTaggedRelease;
function downloadAndExtractJDK(downloadUrl) { function downloadAndExtractJDK(downloadUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return findJavaHomeInSubfolder(yield extract(yield tc.downloadTool(downloadUrl))); return findJavaHomeInSubfolder(yield extract(yield tc.downloadTool(downloadUrl)));

22
dist/main/index.js generated vendored
View File

@ -70141,7 +70141,7 @@ function checkForUpdates(graalVMVersion, javaVersion) {
core.notice('Please consider upgrading your project to Java 17+. GraalVM 22.3.X releases are the last to support JDK11: https://github.com/oracle/graal/issues/5063'); core.notice('Please consider upgrading your project to Java 17+. GraalVM 22.3.X releases are the last to support JDK11: https://github.com/oracle/graal/issues/5063');
return; return;
} }
const latestRelease = yield (0, utils_1.getLatestRelease)(constants_1.GRAALVM_RELEASES_REPO); const latestRelease = yield (0, utils_1.getTaggedRelease)(constants_1.GRAALVM_RELEASES_REPO, 'vm-22.3.1');
const latestGraalVMVersion = (0, graalvm_1.findGraalVMVersion)(latestRelease); const latestGraalVMVersion = (0, graalvm_1.findGraalVMVersion)(latestRelease);
const selectedVersion = (0, utils_1.toSemVer)(graalVMVersion); const selectedVersion = (0, utils_1.toSemVer)(graalVMVersion);
const latestVersion = (0, utils_1.toSemVer)(latestGraalVMVersion); const latestVersion = (0, utils_1.toSemVer)(latestGraalVMVersion);
@ -70778,10 +70778,11 @@ const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds';
const GRAALVM_TAG_PREFIX = 'vm-'; const GRAALVM_TAG_PREFIX = 'vm-';
function setUpGraalVMLatest(gdsToken, javaVersion) { function setUpGraalVMLatest(gdsToken, javaVersion) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const lockedVersion = '22.3.1';
if (gdsToken.length > 0) { if (gdsToken.length > 0) {
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion); return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion);
} }
const latestRelease = yield (0, utils_1.getLatestRelease)(c.GRAALVM_RELEASES_REPO); const latestRelease = yield (0, utils_1.getTaggedRelease)(c.GRAALVM_RELEASES_REPO, GRAALVM_TAG_PREFIX + lockedVersion);
const version = findGraalVMVersion(latestRelease); const version = findGraalVMVersion(latestRelease);
return setUpGraalVMRelease(gdsToken, version, javaVersion); return setUpGraalVMRelease(gdsToken, version, javaVersion);
}); });
@ -71292,7 +71293,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getLatestRelease = exports.exec = void 0; exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getTaggedRelease = exports.getLatestRelease = exports.exec = void 0;
const c = __importStar(__nccwpck_require__(9042)); const c = __importStar(__nccwpck_require__(9042));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
@ -71334,6 +71335,19 @@ function getLatestRelease(repo) {
}); });
} }
exports.getLatestRelease = getLatestRelease; exports.getLatestRelease = getLatestRelease;
function getTaggedRelease(repo, tag) {
return __awaiter(this, void 0, void 0, function* () {
const githubToken = getGitHubToken();
const options = githubToken.length > 0 ? { auth: githubToken } : {};
const octokit = new GitHubDotCom(options);
return (yield octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
owner: c.GRAALVM_GH_USER,
repo,
tag
})).data;
});
}
exports.getTaggedRelease = getTaggedRelease;
function downloadAndExtractJDK(downloadUrl) { function downloadAndExtractJDK(downloadUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return findJavaHomeInSubfolder(yield extract(yield tc.downloadTool(downloadUrl))); return findJavaHomeInSubfolder(yield extract(yield tc.downloadTool(downloadUrl)));

View File

@ -1,5 +1,5 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {getLatestRelease, toSemVer} from '../utils' import {getTaggedRelease, toSemVer} from '../utils'
import {lt, major, minor, valid} from 'semver' import {lt, major, minor, valid} from 'semver'
import {findGraalVMVersion} from '../graalvm' import {findGraalVMVersion} from '../graalvm'
import {GRAALVM_RELEASES_REPO} from '../constants' import {GRAALVM_RELEASES_REPO} from '../constants'
@ -15,7 +15,10 @@ export async function checkForUpdates(
return return
} }
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO) const latestRelease = await getTaggedRelease(
GRAALVM_RELEASES_REPO,
'vm-22.3.1'
)
const latestGraalVMVersion = findGraalVMVersion(latestRelease) const latestGraalVMVersion = findGraalVMVersion(latestRelease)
const selectedVersion = toSemVer(graalVMVersion) const selectedVersion = toSemVer(graalVMVersion)
const latestVersion = toSemVer(latestGraalVMVersion) const latestVersion = toSemVer(latestGraalVMVersion)

View File

@ -2,7 +2,8 @@ import * as c from './constants'
import { import {
downloadAndExtractJDK, downloadAndExtractJDK,
downloadExtractAndCacheJDK, downloadExtractAndCacheJDK,
getLatestRelease getLatestRelease,
getTaggedRelease
} from './utils' } from './utils'
import {downloadGraalVMEE} from './gds' import {downloadGraalVMEE} from './gds'
import {downloadTool} from '@actions/tool-cache' import {downloadTool} from '@actions/tool-cache'
@ -15,10 +16,14 @@ export async function setUpGraalVMLatest(
gdsToken: string, gdsToken: string,
javaVersion: string javaVersion: string
): Promise<string> { ): Promise<string> {
const lockedVersion = '22.3.1'
if (gdsToken.length > 0) { if (gdsToken.length > 0) {
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion) return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion)
} }
const latestRelease = await getLatestRelease(c.GRAALVM_RELEASES_REPO) const latestRelease = await getTaggedRelease(
c.GRAALVM_RELEASES_REPO,
GRAALVM_TAG_PREFIX + lockedVersion
)
const version = findGraalVMVersion(latestRelease) const version = findGraalVMVersion(latestRelease)
return setUpGraalVMRelease(gdsToken, version, javaVersion) return setUpGraalVMRelease(gdsToken, version, javaVersion)
} }

View File

@ -47,6 +47,22 @@ export async function getLatestRelease(
).data ).data
} }
export async function getTaggedRelease(
repo: string,
tag: string
): Promise<c.LatestReleaseResponse['data']> {
const githubToken = getGitHubToken()
const options = githubToken.length > 0 ? {auth: githubToken} : {}
const octokit = new GitHubDotCom(options)
return (
await octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
owner: c.GRAALVM_GH_USER,
repo,
tag
})
).data
}
export async function downloadAndExtractJDK( export async function downloadAndExtractJDK(
downloadUrl: string downloadUrl: string
): Promise<string> { ): Promise<string> {