1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-04-11 11:41:53 +02:00

(chore): Improve log statements about secret ID expiration (#5266)

* Improve log statements about secret ID expiration

* Improve log statements about secret ID expiration

---------

Co-authored-by: Ivan Nikiforov <ivan.nikiforov@sap.com>
This commit is contained in:
Ivan Nikiforov 2025-02-13 15:48:44 +01:00 committed by GitHub
parent 03c9c52887
commit 15bf4da96e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -83,12 +83,17 @@ func runVaultRotateSecretID(utils vaultRotateSecretIDUtils) error {
return nil
}
log.Entry().Infof("Your secret ID is about to expire in %.0f", ttl.Round(time.Hour*24).Hours()/24)
if ttl == 0 {
log.Entry().Warn("Secret ID expired")
} else {
log.Entry().Infof("Your secret ID is about to expire in %.0f days", ttl.Round(time.Hour*24).Hours()/24)
}
if ttl > time.Duration(config.DaysBeforeExpiry)*24*time.Hour {
log.Entry().Info("Secret ID TTL valid.")
return nil
}
log.Entry().Info("Rotating...")
log.Entry().Info("Rotating secret ID...")
newSecretID, err := utils.GenerateNewAppRoleSecret(GeneralConfig.VaultRoleSecretID, roleName)