Skip to content

Commit 2dec7e6

Browse files
author
Ewelina Wilkosz
committed
close #1 Solve #153 from Praqma/JenkinsAsCodeReference
1 parent fba28ca commit 2dec7e6

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

dockerizeit/master/globalconfig.groovy

+11-9
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ desc.setGlobalConfigEmail(properties.global.git.email)
4646

4747
if(properties.global.smtp.enabled) {
4848
println "--> Set E-mail Notification"
49-
File pwdFile = new File(properties.credentials.smtp.path)
50-
if(!pwdFile.exists()) {
51-
println "Smpt password file missing!"
52-
} else {
53-
def emailDesc = inst.getDescriptor(hudson.tasks.Mailer)
54-
emailDesc.setSmtpHost(properties.global.smtp.host)
55-
emailDesc.setSmtpPort(properties.global.smtp.port)
56-
emailDesc.setSmtpAuth(properties.credentials.smtp.userId, new File(properties.credentials.smtp.path).text.trim())
57-
emailDesc.setReplyToAddress(properties.global.smtp.reply_to_address)
49+
if(properties.global.smtp.authentication.enabled) {
50+
File pwdFile = new File(properties.global.smtp.authentication.passwordFile)
51+
if(!pwdFile.exists()) {
52+
println "Smpt password file missing!"
53+
} else {
54+
def emailDesc = inst.getDescriptor(hudson.tasks.Mailer)
55+
emailDesc.setSmtpHost(properties.global.smtp.host)
56+
emailDesc.setSmtpPort(properties.global.smtp.port)
57+
emailDesc.setSmtpAuth(properties.global.smtp.authentication.login, pwdFile.text.trim())
58+
emailDesc.setReplyToAddress(properties.global.smtp.reply_to_address)
59+
}
5860
}
5961
}
6062

dockerizeit/master/jenkins.properties

+5-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ credentials {
1414
description = ""
1515
path = "/var/jenkins_home/.ssh/.password"
1616
}
17-
smtp {
18-
type = "password"
19-
userId = "jenkins"
20-
credentialsId = "smtp"
21-
description = "Used by jenkins to send mail notifications"
22-
path = "/var/jenkins_home/.ssh/.smtp_password"
23-
}
2417
}
2518

2619
registry {
@@ -82,6 +75,11 @@ global {
8275
port = "25"
8376
host = "1.1.1.1"
8477
reply_to_address = "[email protected]"
78+
authentication {
79+
enabled = true
80+
login = "jenkins"
81+
passwordFile = "/var/jenkins_home/.ssh/.smtp_password"
82+
}
8583
}
8684
}
8785

0 commit comments

Comments
 (0)