From da9dfe39af38a7d43f740fbe56429181aac9a0cb Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 26 Mar 2025 09:21:48 +0100 Subject: [PATCH] Updated notify script --- changelog.md | 3 +++ vars/notifyBuildStatus.groovy | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index da939bd..cf0c6a0 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/vars/notifyBuildStatus.groovy b/vars/notifyBuildStatus.groovy index 11b77c7..2fec340 100644 --- a/vars/notifyBuildStatus.groovy +++ b/vars/notifyBuildStatus.groovy @@ -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 }