1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

fix: remove side-effects of #3875 (#3928)

with #3875 temp directory was created in current workspace.
This had negative side-effects: For example npm build packaged and published temporary files

Co-authored-by: Anil Keshav <anil.keshav@sap.com>
This commit is contained in:
Oliver Nocon 2022-08-04 09:20:59 +02:00 committed by GitHub
parent a610e1df6a
commit 73f7d61743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ import (
"github.com/SAP/jenkins-library/pkg/config/interpolation"
"github.com/SAP/jenkins-library/pkg/log"
CredentialUtils "github.com/SAP/jenkins-library/pkg/piperutils"
"github.com/SAP/jenkins-library/pkg/piperutils"
"github.com/SAP/jenkins-library/pkg/vault"
"github.com/hashicorp/vault/api"
)
@ -285,7 +285,7 @@ func populateCredentialsAsEnvs(config *StepConfig, secret map[string]string, key
os.Setenv(envVariable, secretValue)
envVariable = vaultCredentialEnvPrefix + convertEnvVar(secretKey) + "_BASE64"
log.Entry().Debugf("Exposing general purpose base64 encoded credential '%v' as '%v'", key, envVariable)
os.Setenv(envVariable, CredentialUtils.EncodeString(secretValue))
os.Setenv(envVariable, piperutils.EncodeString(secretValue))
matched = true
}
}
@ -303,7 +303,7 @@ func populateCredentialsAsEnvs(config *StepConfig, secret map[string]string, key
os.Setenv(envVariable, secretValue)
envVariable = vaultCredentialEnvPrefixDefault + convertEnvVar(secretKey) + "_BASE64"
log.Entry().Debugf("Exposing general purpose base64 encoded credential '%v' as '%v'", key, envVariable)
os.Setenv(envVariable, CredentialUtils.EncodeString(secretValue))
os.Setenv(envVariable, piperutils.EncodeString(secretValue))
matched = true
}
}
@ -369,7 +369,8 @@ func RemoveVaultSecretFiles() {
func createTemporarySecretFile(namePattern string, content string) (string, error) {
if VaultSecretFileDirectory == "" {
var err error
VaultSecretFileDirectory, err = ioutil.TempDir(".", "vault")
fileUtils := &piperutils.Files{}
VaultSecretFileDirectory, err = fileUtils.TempDir("", "vault")
if err != nil {
return "", err
}