Updated notify script

main
Nicolas Arenas 2025-03-26 09:21:48 +01:00
parent e5204ffe40
commit da9dfe39af
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,8 @@
# Changelog
## [0.1.1] - 2025-03-26
### Changed
- email notifications to opengnsys@qindel.com and commiter doer
## [0.1.0] - 2025-03-17
### Initial Release
- Primera versión de la librería compartida

View File

@ -1,4 +1,4 @@
def call(String recipients) {
def call() {
// Determina el estado del build
def buildStatus = currentBuild.currentResult ?: 'SUCCESS'
@ -7,6 +7,13 @@ def call(String recipients) {
def body = """El build ${env.BUILD_NUMBER} del trabajo '${env.JOB_NAME}' ha finalizado con estado: ${buildStatus}.
Puedes ver los detalles aquí: ${env.BUILD_URL}"""
// Intenta obtener el usuario que ha lanzado el job
def userId = currentBuild.getBuildCauses()?.find { it._class == 'hudson.model.Cause$UserIdCause' }?.userId
def userEmail = userId ? "${userId}@qindel.com" : "opengnsysy@qindel.com"
mail to: recipients, subject: subject, body: body
// Dirección de correo a copiar siempre
def ccEmail = "opengnsysy@qindel.com"
// Envía el correo
mail to: "${userEmail}", cc: "${ccEmail}", subject: subject, body: body
}