mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 10:26:46 +00:00
Add cacerts parameter, which can copy existing cacerts into JDK
This commit is contained in:
parent
d53b046579
commit
0d42bcacb6
11 changed files with 2167 additions and 2075 deletions
|
@ -15,6 +15,7 @@ export abstract class JavaBase {
|
|||
protected packageType: string;
|
||||
protected stable: boolean;
|
||||
protected checkLatest: boolean;
|
||||
protected cacerts?: string;
|
||||
|
||||
constructor(protected distribution: string, installerOptions: JavaInstallerOptions) {
|
||||
this.http = new httpm.HttpClient('actions/setup-java', undefined, {
|
||||
|
@ -28,6 +29,7 @@ export abstract class JavaBase {
|
|||
this.architecture = installerOptions.architecture;
|
||||
this.packageType = installerOptions.packageType;
|
||||
this.checkLatest = installerOptions.checkLatest;
|
||||
this.cacerts = installerOptions.cacerts;
|
||||
}
|
||||
|
||||
protected abstract downloadTool(javaRelease: JavaDownloadRelease): Promise<JavaInstallerResults>;
|
||||
|
@ -58,6 +60,7 @@ export abstract class JavaBase {
|
|||
|
||||
core.info(`Setting Java ${foundJava.version} as the default`);
|
||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||
this.initCacerts(foundJava.path);
|
||||
|
||||
return foundJava;
|
||||
}
|
||||
|
@ -148,4 +151,15 @@ export abstract class JavaBase {
|
|||
core.setOutput('path', toolPath);
|
||||
core.setOutput('version', version);
|
||||
}
|
||||
|
||||
protected initCacerts(toolPath: string) {
|
||||
if (!this.cacerts) {
|
||||
return;
|
||||
}
|
||||
|
||||
const toolCacerts = path.join(toolPath, 'lib', 'security', 'cacerts');
|
||||
|
||||
core.info(`Copying cacerts from ${this.cacerts}`);
|
||||
fs.copyFileSync(this.cacerts, toolCacerts);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue