1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-30 05:59:39 +02:00

fix (mavenBuild) removing root path when creating keystore (#3714)

* remving root paths for trust store

* adding read / write permission to keystore

Co-authored-by: anilkeshav27 <you@example.com>
This commit is contained in:
Anil Keshav 2022-04-08 13:19:08 +02:00 committed by GitHub
parent 465bab8ddf
commit 6dcda42dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,7 +185,7 @@ func loadRemoteRepoCertificates(certificateList []string, client piperhttp.Downl
return errors.Wrap(err, "Could not find the existing java cacerts")
}
trustStore := filepath.Join(getWorkingDirForTrustStore(), ".pipeline", "mavenCaCerts")
trustStore := filepath.Join(".pipeline", "mavenCaCerts")
log.Entry().Infof("copying java cacerts : %s to new cacerts : %s", existingJavaCaCerts, trustStore)
_, fileUtilserr := fileUtils.Copy(existingJavaCaCerts, trustStore)
@ -194,7 +194,7 @@ func loadRemoteRepoCertificates(certificateList []string, client piperhttp.Downl
return errors.Wrap(err, "Could not copy existing cacerts into new cacerts location ")
}
if err := fileUtils.Chmod(trustStore, 0644); err != nil {
if err := fileUtils.Chmod(trustStore, 0666); err != nil {
return errors.Wrap(err, "unable to provide correct permission to trust store")
}
@ -242,14 +242,6 @@ func loadRemoteRepoCertificates(certificateList []string, client piperhttp.Downl
return nil
}
func getWorkingDirForTrustStore() string {
workingDir, err := os.Getwd()
if err != nil {
log.Entry().WithError(err).WithField("path", workingDir).Debug("Retrieving of work directory failed")
}
return workingDir
}
func getTempDirForCertFile() string {
tmpFolder, err := ioutil.TempDir(".", "temp-")
if err != nil {