diff --git a/dockerizeit/master/globalconfig.groovy b/dockerizeit/master/globalconfig.groovy index 0f1420b..543a5cb 100644 --- a/dockerizeit/master/globalconfig.groovy +++ b/dockerizeit/master/globalconfig.groovy @@ -44,6 +44,22 @@ def desc = inst.getDescriptor("hudson.plugins.git.GitSCM") desc.setGlobalConfigName(properties.global.git.name) desc.setGlobalConfigEmail(properties.global.git.email) +if(properties.global.smtp.enabled) { + println "--> Set E-mail Notification" + if(properties.global.smtp.authentication.enabled) { + File pwdFile = new File(properties.global.smtp.authentication.passwordFile) + if(!pwdFile.exists()) { + println "Smpt password file missing!" + } else { + def emailDesc = inst.getDescriptor(hudson.tasks.Mailer) + emailDesc.setSmtpHost(properties.global.smtp.host) + emailDesc.setSmtpPort(properties.global.smtp.port) + emailDesc.setSmtpAuth(properties.global.smtp.authentication.login, pwdFile.text.trim()) + emailDesc.setReplyToAddress(properties.global.smtp.reply_to_address) + } + } +} + println "--> Set system message " def env = System.getenv() if ( env.containsKey('master_image_version') ) { diff --git a/dockerizeit/master/jenkins.properties b/dockerizeit/master/jenkins.properties index ba8c6c5..edb42e5 100644 --- a/dockerizeit/master/jenkins.properties +++ b/dockerizeit/master/jenkins.properties @@ -70,6 +70,17 @@ global { master_image_name = "${images.masterImageName}" slave_image_name = "${images.slaveImageName}" } + smtp { + enabled = false + port = "25" + host = "1.1.1.1" + reply_to_address = "no-reply@yourcompany.com" + authentication { + enabled = true + login = "jenkins" + passwordFile = "/var/jenkins_home/.ssh/.smtp_password" + } + } } libraries{