Jenkins discord notifier Multibranch Pipeline

l3aseron By M
Touch Technologies
Published in
Oct 18, 2021

system requirements

  • Jenkins
  • Discord
  • jenkin plugin Discord Notifier

Step 1 install plugin Discord Notifier

Install in jenkin https://plugins.jenkins.io/discord-notifier

Step 2 Config Jenkinsfile

node(slaveLabel) {
checkoutCode()
prepareVars()
discordSend description: "Jenkins Pipeline Build ${appName}", footer: "Start Build", link: "$BUILD_URL", result: currentBuild.currentResult, title: JOB_NAME, webhookURL: "webhook url discord"// Webhook url discord ที่บรรทัดนี้

switch(envName) {
case ["dev", "sit", "uat"]:
runUnitTest()
runOWASP()
runSonarQube()
buildAndPushDockerImage()
deployApp()
// runPerfTest()
break
case "tag":
buildAndPushDockerImage()
break
case "prod":
checkoutCode(checkout_tag: true)
deployApp()
break
}
}

Step 3 Deploy Test

--

--