mirror of
https://github.com/actions/setup-java.git
synced 2025-03-13 09:37:03 +00:00
fix: check if cert is in keystore
when using the shared cache the cert is already in the keystore
This commit is contained in:
parent
9b706f9681
commit
4bd0bfb1af
2 changed files with 36 additions and 9 deletions
12
dist/setup/index.js
generated
vendored
12
dist/setup/index.js
generated
vendored
|
@ -11102,6 +11102,17 @@ function setupMaven(opts) {
|
|||
params.push('-cacerts');
|
||||
}
|
||||
try {
|
||||
const certexists = yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [
|
||||
'-list',
|
||||
'-storepass',
|
||||
'changeit',
|
||||
'-noprompt',
|
||||
'-alias',
|
||||
'mycert',
|
||||
'-keystore',
|
||||
`${opts.javaPath}/jre/lib/security/cacerts`
|
||||
]);
|
||||
if (certexists !== 0) {
|
||||
yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), params.concat([
|
||||
'-storepass',
|
||||
'changeit',
|
||||
|
@ -11112,6 +11123,7 @@ function setupMaven(opts) {
|
|||
rootCaPath
|
||||
]));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
core.warning(`keytool return an error: ${e.message}`);
|
||||
}
|
||||
|
|
15
src/maven.ts
15
src/maven.ts
|
@ -76,6 +76,20 @@ export async function setupMaven(opts: MavenOpts): Promise<void> {
|
|||
}
|
||||
|
||||
try {
|
||||
const certexists = await exec.exec(
|
||||
path.join(opts.javaPath, 'bin/keytool'),
|
||||
[
|
||||
'-list',
|
||||
'-storepass',
|
||||
'changeit',
|
||||
'-noprompt',
|
||||
'-alias',
|
||||
'mycert',
|
||||
'-keystore',
|
||||
`${opts.javaPath}/jre/lib/security/cacerts`
|
||||
]
|
||||
);
|
||||
if (certexists !== 0) {
|
||||
await exec.exec(
|
||||
path.join(opts.javaPath, 'bin/keytool'),
|
||||
params.concat([
|
||||
|
@ -88,6 +102,7 @@ export async function setupMaven(opts: MavenOpts): Promise<void> {
|
|||
rootCaPath
|
||||
])
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
core.warning(`keytool return an error: ${(e as Error).message}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue