mirror of
				https://github.com/actions/setup-java.git
				synced 2025-10-31 06:20:53 +00:00 
			
		
		
		
	Merge pull request #5 from Tradeshift/fix-already-existing-cert
Fix already existing cert
This commit is contained in:
		
				commit
				
					
						0ddd7a4320
					
				
			
		
					 2 changed files with 35 additions and 22 deletions
				
			
		
							
								
								
									
										29
									
								
								dist/setup/index.js
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										29
									
								
								dist/setup/index.js
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -11093,17 +11093,24 @@ 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}`); | ||||||
|         yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [ |         try { | ||||||
|             '-importcert', |             yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [ | ||||||
|             '-cacerts', |                 '-importcert', | ||||||
|             '-storepass', |                 '-cacerts', | ||||||
|             'changeit', |                 '-storepass', | ||||||
|             '-noprompt', |                 'changeit', | ||||||
|             '-alias', |                 '-noprompt', | ||||||
|             'mycert', |                 '-alias', | ||||||
|             '-file', |                 'mycert', | ||||||
|             rooCaPath |                 '-file', | ||||||
|         ]); |                 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`); | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										28
									
								
								src/maven.ts
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								src/maven.ts
									
										
									
									
									
								
							|  | @ -65,17 +65,23 @@ 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}` | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|   await exec.exec(path.join(opts.javaPath, 'bin/keytool'), [ |   try { | ||||||
|     '-importcert', |     await exec.exec(path.join(opts.javaPath, 'bin/keytool'), [ | ||||||
|     '-cacerts', |       '-importcert', | ||||||
|     '-storepass', |       '-cacerts', | ||||||
|     'changeit', |       '-storepass', | ||||||
|     '-noprompt', |       'changeit', | ||||||
|     '-alias', |       '-noprompt', | ||||||
|     'mycert', |       '-alias', | ||||||
|     '-file', |       'mycert', | ||||||
|     rooCaPath |       '-file', | ||||||
|   ]); |       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…
	
	Add table
		Add a link
		
	
		Reference in a new issue