Skip to content

Commit

Permalink
#858 - build the log link in the message
Browse files Browse the repository at this point in the history
  • Loading branch information
twardnw committed Jan 30, 2019
1 parent 4d846dc commit c150618
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions services/openshiftbuilddeploymonitor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,38 +174,38 @@ const messageConsumer = async msg => {
try {
const buildLog = await buildsLogGet()
const s3UploadResult = await saveBuildLog(buildName, projectName, branchName, buildLog, buildstatus)
logLink = `<${s3UploadResult.Location}|Logs>`
logLink = s3UploadResult.Location
meta.logLink = logLink
} catch (err) {
logger.warn(`${openshiftProject} ${buildName}: Error while getting and uploading Logs to S3, Error: ${err}. Continuing without log link in message`)
meta.logLink = ''
}
sendToLagoonLogs('warn', projectName, "", `task:builddeploy-openshift:${buildPhase}`, meta,
`*[${projectName}]* ${logMessage} Build \`${buildName}\` cancelled. ${logLink}`
`*[${projectName}]* ${logMessage} Build \`${buildName}\` cancelled. <${logLink}|Logs>`
)
break;

case "failed":
try {
const buildLog = await buildsLogGet()
const s3UploadResult = await saveBuildLog(buildName, projectName, branchName, buildLog, buildstatus)
logLink = `<${s3UploadResult.Location}|Logs>`
logLink = s3UploadResult.Location
meta.logLink = logLink
} catch (err) {
logger.warn(`${openshiftProject} ${buildName}: Error while getting and uploading Logs to S3, Error: ${err}. Continuing without log link in message`)
meta.logLink = ''
}

sendToLagoonLogs('error', projectName, "", `task:builddeploy-openshift:${buildPhase}`, meta,
`*[${projectName}]* ${logMessage} Build \`${buildName}\` failed. ${logLink}`
`*[${projectName}]* ${logMessage} Build \`${buildName}\` failed. $<${logLink}|Logs>`
)
break;

case "complete":
try {
const buildLog = await buildsLogGet()
const s3UploadResult = await saveBuildLog(buildName, projectName, branchName, buildLog, buildstatus)
logLink = `<${s3UploadResult.Location}|Logs>`
logLink = s3UploadResult.Location
meta.loglink = loglink
} catch (err) {
logger.warn(`${openshiftProject} ${buildName}: Error while getting and uploading Logs to S3, Error: ${err}. Continuing without log link in message`)
Expand All @@ -229,7 +229,7 @@ const messageConsumer = async msg => {
meta.route = route
meta.routes = routes
sendToLagoonLogs('info', projectName, "", `task:builddeploy-openshift:${buildPhase}`, meta,
`*[${projectName}]* ${logMessage} Build \`${buildName}\` complete. ${logLink} \n ${route}\n ${routes.join("\n")}`
`*[${projectName}]* ${logMessage} Build \`${buildName}\` complete. <${logLink}|Logs> \n ${route}\n ${routes.join("\n")}`
)
try {
const updateEnvironmentResult = await updateEnvironment(
Expand Down

0 comments on commit c150618

Please sign in to comment.