1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

fix(vaultRotateSecretId): Add more logs for debugging vault step (#5288)

Co-authored-by: Ivan Nikiforov <ivan.nikiforov@sap.com>
Co-authored-by: Ashly Mathew <ashly.mathew@sap.com>
This commit is contained in:
Ivan Nikiforov
2025-03-12 08:35:33 +01:00
committed by GitHub
parent 08edb989a5
commit 4edd50800c
2 changed files with 8 additions and 3 deletions

View File

@@ -112,6 +112,7 @@ func runVaultRotateSecretID(utils vaultRotateSecretIDUtils) error {
}
func writeVaultSecretIDToStore(config *vaultRotateSecretIdOptions, secretID string) error {
switch config.SecretStore {
case "jenkins":
ctx := context.Background()

View File

@@ -3,12 +3,13 @@ package vault
import (
"encoding/json"
"fmt"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/hashicorp/vault/api"
"path"
"strconv"
"strings"
"time"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/hashicorp/vault/api"
)
// GetSecret uses the given path to fetch a secret from vault
@@ -138,6 +139,8 @@ func (c *Client) GenerateNewAppRoleSecret(secretID, appRoleName string) (string,
return "", fmt.Errorf("new secret-id from approle path %s has an unexpected type %T expected 'string'", reqPath, secretIDRaw)
}
// secret_id_accessor is used to identify the secret-id in the vault and is unique to each secret-id
log.Entry().Debugf("GenerateNewAppRoleSecret - secret_id_accessor: %s ", secret.Data["secret_id_accessor"])
return newSecretID, nil
}
@@ -168,7 +171,8 @@ func (c *Client) GetAppRoleSecretIDTtl(secretID, roleName string) (time.Duration
if ttl < 0 {
return 0, nil
}
// secret_id_accessor is used to identify the secret-id in the vault and is unique to each secret-id
log.Entry().Debugf("GetAppRoleSecretIDTtl - secret_id_accessor: %s & creation_time: %s", data["secret_id_accessor"], data["creation_time"])
return ttl, nil
}