为来自 Jenkins 管道的松弛通知添加时间戳

Timestamping a slack notification from Jenkins pipeline

 def trial = 'jobName'
 slackSend color: "good", message: "${trial} build successful"

上面的代码给了我下面的 Slack 消息-

jobName build successful

如何为消息添加时间戳,以便收到以下消息-

jobName build successful on dd/mm/yyyy

感谢您的帮助。

您可以使用下面的代码-

def trial = 'jobName'
def date = new Date().format('dd/MM/yyyy')
slackSend color: "good", message: "${trial} build successful on " + date