echo "The message body here." | mail -s "${configuration.getPathName()} new file differs." user@gmail.com
What would be the best way to handle this, because as is, it is not working as intended.
groovy:
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def receivers = ["user1@gmail.com", "user2@gmail.com"]
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
MiscUtils.sendMail(receivers, "Mail Subject", "Mail Body", attachments, emailSetting, "text/html")
groovy:
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def receivers = "user1@gmail.com,user2@gmail.com"
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
MiscUtils.sendMail(receivers, "Mail Subject", "Mail Body", attachments, emailSetting)
${groovy:
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def receivers = "user1@gmail.com,user2@gmail.com"
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
MiscUtils.sendMail(receivers, "${configuration.getPathName()\} text...", "The text...", attachments, emailSetting)
}
groovy:
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def emails = []
for (membership in MembershipManager.instance.getAll()) {
if (membership.group.name == "dev")
if (membership.user.email != null)
emails.add(membership.user.email)
}
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
MiscUtils.sendMail(emails.join(","), "Mail Subject", "Mail Body", attachments, emailSetting)
quickbuild@${groovy:"hostname -f".execute().text}
import com.pmease.quickbuild.*
import com.pmease.quickbuild.util.*
def evaluatedEmailBody = VelocityUtils.evalTemplate("#parse (\"default_html_notification.vm\")", Context.buildEvalContext(null, null))
#foreach ($step in $build.steps)
#if ($step.class.name.contains("TriggerBuildStep"))
#set ($triggeredBuildId = $step.runtime.customData)
#if ($triggeredBuildId)
#set ($triggeredBuild = $system.buildManager.load($triggeredBuildId))
#foreach ($change in $triggeredBuild.changes)
// format changes information from the triggered build as the changes printting section of current build in this file
#end
#end
#end
#end
groovy:
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def path = configuration.getPathName()
logger.info("path: " + path)
def m = path =~ /root\/(.*)\/install.*/
def group = m[0][1]
group = group.replaceAll("/","_")
logger.info("group: " + group)
def emails = []
for (membership in MembershipManager.instance.getAll()) {
if (membership.group.name == group) {
if (membership.user.email != null) {
logger.info("email: " + membership.user.email)
emails.add(membership.user.email)
}
}
}
if (configuration.getName() =~ /production1/ || configuration.getName() =~ /production2/) {
emails.add('group1@oclc.org')
emails.add('group2@oclc.org')
}
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
def current = new File (vars.getValue("deployRoot") + "/prod/ini/build.ini")
def next = new File (vars.getValue("deployRoot") + "/new/ini/build.ini")
def current_envName
def next_envName
logger.info("Running envName compare...")
if (current.exists()) {
logger.info("Current exists...")
def lines = current.readLines()
def words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
current_envName = word
}
}
if (next.exists()) {
lines = next.readLines()
words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
next_envName = word
}
}
}
if (current_envName.toString().equals(next_envName.toString())) {
logger.info("The ENVNAME parameters match.")
return true
} else {
logger.info("The ENVNAME parameters do not match.")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - ENVNAME does not match - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "The envname parameter of the current install and new install do not match so a rolling install is not possible. Verify that the install/rollout plan is specified correctly.<br><br> prod: $current_envName <br> new: $next_envName <br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}
} else {
logger.info("Current does not exist...")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - No current installation - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "There is no current install of this service under the specified install directory. Verify that the install/rollout plan is specified correctly.<br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}
groovy:[/quote]
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def path = configuration.getPathName()
logger.info("path: " + path)
def m = path =~ /root\/(.*)\/install.*/
def group = m[0][1]
group = group.replaceAll("/","_")
logger.info("group: " + group)
def emails = []
for (membership in MembershipManager.instance.getAll()) {
if (membership.group.name == group) {
if (membership.user.email != null) {
logger.info("email: " + membership.user.email)
emails.add(membership.user.email)
}
}
}
if (configuration.getName() =~ /production1/ || configuration.getName() =~ /production2/) {
emails.add('group1@oclc.org')
emails.add('group2@oclc.org')
}
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
def current = new File (vars.getValue("deployRoot") + "/prod/ini/build.ini")
def next = new File (vars.getValue("deployRoot") + "/new/ini/build.ini")
def current_envName
def next_envName
logger.info("Running envName compare...")
if (current.exists()) {
logger.info("Current exists...")
def lines = current.readLines()
def words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
current_envName = word
}
}
if (next.exists()) {
lines = next.readLines()
words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
next_envName = word
}
}
}
if (current_envName.toString().equals(next_envName.toString())) {
logger.info("The ENVNAME parameters match.")
return true
} else {
logger.info("The ENVNAME parameters do not match.")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - ENVNAME does not match - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "The envname parameter of the current install and new install do not match so a rolling install is not possible. Verify that the install/rollout plan is specified correctly.<br><br> prod: $current_envName <br> new: $next_envName <br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}
} else {
logger.info("Current does not exist...")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - No current installation - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "There is no current install of this service under the specified install directory. Verify that the install/rollout plan is specified correctly.<br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}
groovy:[/quote]
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def path = configuration.getPathName()
logger.info("path: " + path)
def m = path =~ /root\/(.*)\/install.*/
def group = m[0][1]
group = group.replaceAll("/","_")
logger.info("group: " + group)
def emails = []
for (membership in MembershipManager.instance.getAll()) {
if (membership.group.name == group) {
if (membership.user.email != null) {
logger.info("email: " + membership.user.email)
emails.add(membership.user.email)
}
}
}
if (configuration.getName() =~ /production1/ || configuration.getName() =~ /production2/) {
emails.add('group1@oclc.org')
emails.add('group2@oclc.org')
}
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
def current = new File (vars.getValue("deployRoot") + "/prod/ini/build.ini")
def next = new File (vars.getValue("deployRoot") + "/new/ini/build.ini")
def current_envName
def next_envName
logger.info("Running envName compare...")
if (current.exists()) {
logger.info("Current exists...")
def lines = current.readLines()
def words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
current_envName = word
}
}
if (next.exists()) {
lines = next.readLines()
words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
next_envName = word
}
}
}
if (current_envName.toString().equals(next_envName.toString())) {
logger.info("The ENVNAME parameters match.")
return true
} else {
logger.info("The ENVNAME parameters do not match.")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - ENVNAME does not match - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "The envname parameter of the current install and new install do not match so a rolling install is not possible. Verify that the install/rollout plan is specified correctly.<br><br> prod: $current_envName <br> new: $next_envName <br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}
} else {
logger.info("Current does not exist...")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - No current installation - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "There is no current install of this service under the specified install directory. Verify that the install/rollout plan is specified correctly.<br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}
groovy:[/quote]
import com.pmease.quickbuild.util.*
import com.pmease.quickbuild.entitymanager.*
def path = configuration.getPathName()
logger.info("path: " + path)
def m = path =~ /root\/(.*)\/install.*/
def group = m[0][1]
group = group.replaceAll("/","_")
logger.info("group: " + group)
def emails = []
for (membership in MembershipManager.instance.getAll()) {
if (membership.group.name == group) {
if (membership.user.email != null) {
logger.info("email: " + membership.user.email)
emails.add(membership.user.email)
}
}
}
if (configuration.getName() =~ /production1/ || configuration.getName() =~ /production2/) {
emails.add('group1@oclc.org')
emails.add('group2@oclc.org')
}
def attachments = []
def emailSetting = SettingManager.instance.getEmailSetting()
def current = new File (vars.getValue("deployRoot") + "/prod/ini/build.ini")
def next = new File (vars.getValue("deployRoot") + "/new/ini/build.ini")
def current_envName
def next_envName
logger.info("Running envName compare...")
if (current.exists()) {
logger.info("Current exists...")
def lines = current.readLines()
def words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
current_envName = word
}
}
if (next.exists()) {
lines = next.readLines()
words = lines.toList()
for (word in words) {
if (word.contains("envName=")) {
next_envName = word
}
}
}
if (current_envName.toString().equals(next_envName.toString())) {
logger.info("The ENVNAME parameters match.")
return true
} else {
logger.info("The ENVNAME parameters do not match.")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - ENVNAME does not match - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "The envname parameter of the current install and new install do not match so a rolling install is not possible. Verify that the install/rollout plan is specified correctly.<br><br> prod: $current_envName <br> new: $next_envName <br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}
} else {
logger.info("Current does not exist...")
MiscUtils.sendMail(emails.join(","), "", "** QuickBuild 5 - No current installation - ${configuration.getParent().getName()}/" + group + " ${configuration.getName()} **", "There is no current install of this service under the specified install directory. Verify that the install/rollout plan is specified correctly.<br><br> Build overview: http://hostname:8810/build/${build.getId()}/overview", attachments, emailSetting, "text/html")
}