mirror of
https://github.com/actions/setup-java.git
synced 2025-05-25 04:31:46 +00:00
Fix already existing cert
Fix situation of already exsiting cacert in java trustore. It can happen with cached tooling
This commit is contained in:
parent
c310a8b469
commit
e092c3bf26
7
dist/setup/index.js
generated
vendored
7
dist/setup/index.js
generated
vendored
@ -11093,6 +11093,7 @@ function setupMaven(opts) {
|
|||||||
const p12Path = path.join(certDir, 'certificate.p12');
|
const p12Path = path.join(certDir, 'certificate.p12');
|
||||||
fs.writeFileSync(p12Path, Buffer.from(opts.keystore, 'base64'));
|
fs.writeFileSync(p12Path, Buffer.from(opts.keystore, 'base64'));
|
||||||
core.exportVariable('MAVEN_OPTS', `-Djavax.net.ssl.keyStore=${p12Path} -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=${opts.password}`);
|
core.exportVariable('MAVEN_OPTS', `-Djavax.net.ssl.keyStore=${p12Path} -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=${opts.password}`);
|
||||||
|
try {
|
||||||
yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [
|
yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [
|
||||||
'-importcert',
|
'-importcert',
|
||||||
'-cacerts',
|
'-cacerts',
|
||||||
@ -11104,6 +11105,12 @@ function setupMaven(opts) {
|
|||||||
'-file',
|
'-file',
|
||||||
rooCaPath
|
rooCaPath
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (!e.message.includes('already exists')) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
core.debug(`added maven opts for MTLS access`);
|
core.debug(`added maven opts for MTLS access`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ export async function setupMaven(opts: MavenOpts): Promise<void> {
|
|||||||
`-Djavax.net.ssl.keyStore=${p12Path} -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=${opts.password}`
|
`-Djavax.net.ssl.keyStore=${p12Path} -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=${opts.password}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
await exec.exec(path.join(opts.javaPath, 'bin/keytool'), [
|
await exec.exec(path.join(opts.javaPath, 'bin/keytool'), [
|
||||||
'-importcert',
|
'-importcert',
|
||||||
'-cacerts',
|
'-cacerts',
|
||||||
@ -76,6 +77,11 @@ export async function setupMaven(opts: MavenOpts): Promise<void> {
|
|||||||
'-file',
|
'-file',
|
||||||
rooCaPath
|
rooCaPath
|
||||||
]);
|
]);
|
||||||
|
} catch (e) {
|
||||||
|
if (!(e as Error).message.includes('already exists')) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
core.debug(`added maven opts for MTLS access`);
|
core.debug(`added maven opts for MTLS access`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user