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
20
dist/setup/index.js
generated
vendored
20
dist/setup/index.js
generated
vendored
|
@ -11102,15 +11102,27 @@ function setupMaven(opts) {
|
||||||
params.push('-cacerts');
|
params.push('-cacerts');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), params.concat([
|
const certexists = yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [
|
||||||
|
'-list',
|
||||||
'-storepass',
|
'-storepass',
|
||||||
'changeit',
|
'changeit',
|
||||||
'-noprompt',
|
'-noprompt',
|
||||||
'-alias',
|
'-alias',
|
||||||
'mycert',
|
'mycert',
|
||||||
'-file',
|
'-keystore',
|
||||||
rootCaPath
|
`${opts.javaPath}/jre/lib/security/cacerts`
|
||||||
]));
|
]);
|
||||||
|
if (certexists !== 0) {
|
||||||
|
yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), params.concat([
|
||||||
|
'-storepass',
|
||||||
|
'changeit',
|
||||||
|
'-noprompt',
|
||||||
|
'-alias',
|
||||||
|
'mycert',
|
||||||
|
'-file',
|
||||||
|
rootCaPath
|
||||||
|
]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.warning(`keytool return an error: ${e.message}`);
|
core.warning(`keytool return an error: ${e.message}`);
|
||||||
|
|
25
src/maven.ts
25
src/maven.ts
|
@ -76,18 +76,33 @@ export async function setupMaven(opts: MavenOpts): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await exec.exec(
|
const certexists = await exec.exec(
|
||||||
path.join(opts.javaPath, 'bin/keytool'),
|
path.join(opts.javaPath, 'bin/keytool'),
|
||||||
params.concat([
|
[
|
||||||
|
'-list',
|
||||||
'-storepass',
|
'-storepass',
|
||||||
'changeit',
|
'changeit',
|
||||||
'-noprompt',
|
'-noprompt',
|
||||||
'-alias',
|
'-alias',
|
||||||
'mycert',
|
'mycert',
|
||||||
'-file',
|
'-keystore',
|
||||||
rootCaPath
|
`${opts.javaPath}/jre/lib/security/cacerts`
|
||||||
])
|
]
|
||||||
);
|
);
|
||||||
|
if (certexists !== 0) {
|
||||||
|
await exec.exec(
|
||||||
|
path.join(opts.javaPath, 'bin/keytool'),
|
||||||
|
params.concat([
|
||||||
|
'-storepass',
|
||||||
|
'changeit',
|
||||||
|
'-noprompt',
|
||||||
|
'-alias',
|
||||||
|
'mycert',
|
||||||
|
'-file',
|
||||||
|
rootCaPath
|
||||||
|
])
|
||||||
|
);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.warning(`keytool return an error: ${(e as Error).message}`);
|
core.warning(`keytool return an error: ${(e as Error).message}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue