Suresh Sharma
Suresh Sharma

Reputation: 186

Jenkins Editable Email Notification post build action want to run per day once

I have configured my jenkins job with cron (every 1 hr) and in the post build action i have added 'Editable Email Notification' and trigger the same on Failure basis but i want the email to be sent at every night(say 1am/2am) for the last job status(want to run post build action-Editable Email Notification) . How we can achieve the same but with in the same job.

Upvotes: 0

Views: 544

Answers (1)

Wimateeka
Wimateeka

Reputation: 2696

You can create a separate email job that runs nightly, and grabs all the statuses of the jobs you care about, and then only append notifications to the email text if that status is FAILURE or BACK TO NORMAL etc. Then send the email.

You can grab build statuses via curl commands and the Jenkins API.

The one small caveat is you need an actual jenkins user and API token to use this. You can easily make a bot user/NUID for this purpose.

Let me know if you need more details / code snippets.

Upvotes: 0

Related Questions