mirror of
				https://github.com/actions/setup-java.git
				synced 2025-10-30 22:10:54 +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
					
				
			
		
					 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'); | ||||
|         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}`); | ||||
|         yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [ | ||||
|             '-importcert', | ||||
|             '-cacerts', | ||||
|             '-storepass', | ||||
|             'changeit', | ||||
|             '-noprompt', | ||||
|             '-alias', | ||||
|             'mycert', | ||||
|             '-file', | ||||
|             rooCaPath | ||||
|         ]); | ||||
|         try { | ||||
|             yield exec.exec(path.join(opts.javaPath, 'bin/keytool'), [ | ||||
|                 '-importcert', | ||||
|                 '-cacerts', | ||||
|                 '-storepass', | ||||
|                 'changeit', | ||||
|                 '-noprompt', | ||||
|                 '-alias', | ||||
|                 'mycert', | ||||
|                 '-file', | ||||
|                 rooCaPath | ||||
|             ]); | ||||
|         } | ||||
|         catch (e) { | ||||
|             if (!e.message.includes('already exists')) { | ||||
|                 throw e; | ||||
|             } | ||||
|         } | ||||
|         core.debug(`added maven opts for MTLS access`); | ||||
|     }); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue