def makeNotification()

in app/notification/BakeFailedNotifier.scala [25:66]


  def makeNotification(
      bake: Bake,
      bakeStatus: BakeStatus,
      config: NotificationConfig
  ): Option[Notification] = {
    val targets = bake.recipe.encryptFor.map(m => AwsAccount(m.accountNumber))
    val statusString = bakeStatus.toString.toLowerCase()
    val actions = List(
      Action(
        s"View recipe ${bake.recipe.id} in AMIgo",
        s"${config.baseUrl}/recipes/${bake.recipe.id}"
      ),
      Action(
        s"Check bake log for ${bake.bakeId}",
        s"${config.baseUrl}/recipes/${bake.recipe.id}/bakes/${bake.buildNumber}"
      )
    )
    val stageString =
      if (config.amigoStage != "PROD") s"(AMIgo ${config.amigoStage})" else ""
    if (targets.nonEmpty) {
      Some(
        Notification(
          s"AMIgo bake ${bake.bakeId} $statusString $stageString",
          s"""
             |Unfortunately a bake on ${bake.recipe.id} has $statusString. Sometimes failures happen due to AMIgo out of
             | memory errors and can be fixed simply by re-running the bake and changing the schedule to a less busy time.
             | See below for links to the AMIgo dashboard where you can debug this issue or kick off another bake.
             | For help, don't hesitate to contact the developer experience team: devx@theguardian.com.
             |""".stripMargin,
          actions,
          targets,
          channel,
          "AMIgo"
        )
      )
    } else {
      log.info(
        s"No anghammarad targets available for bake ${bake.recipe.id},${bake.buildNumber} - likely no encrypted copies have been requested for the recipe."
      )
      None
    }
  }