0

I am using jenkins for continous integration. For my build purpose, i triggering email using Ant task. I am not able to find an environment variable to pass ant for sending email build status(success/failure/stable). i want to know how can i get environment variable for build status?..if not available, what is the alternative option for build status?

Thanks in Advance

varghese

varghese
  • 131
  • 1
  • 4
  • 12

2 Answers2

1

Why use ANT to send emails from Jenkins when you have two great plugins that does just that?

The default mail notification is quite good, and if you would like to have more control
I suggest using the Email-ext plugin which is very comprehensive.

If still wish to use ANT to sent your mail-notifications including the status
you will have to break your process into two steps,
where the first part runs the build and the second one runs the ANT script to report the status.

In this case, you will need to trigger the second job from the first job via the Parameterized Build plugin -
see my answer here:
trigger other configuration and send current build status with Jenkins

Community
  • 1
  • 1
Gonen
  • 4,005
  • 1
  • 31
  • 39
  • i will tell you my scenario. job A and B are there. job A poll svn and copying changeset to my project directory(job B).Here i am using promoted build for getting email notification after successful completion of job B. In job B another build is there triggered by periodic schedule. For this i have put one email-ext on postbuild action. My worry is if build by commit,ie from job A to job B, after completion of job B build, it will do as promoted email-ext as well as email-ext in the post build action of job B. so i will get two notification..(Promoted i used because for sending mail-commiter). – varghese Jul 25 '12 at 05:52
  • I think you can use a single job for that: Job A can poll SVN, and the build-action of that job would copy the files, run the build or whatever. Another option is to trigger Job B with 'Parameterized Build' plugin, instead of emails, as mentioned above. – Gonen Jul 26 '12 at 10:03
0

The build status is not set until the job has finished running, so there is no easy way to push build status to a process triggered within the build itself. You could pull build status via the API, but this would have to be an externally triggered process due to the constraint mentioned above. Any reason you aren't using the built in email support or one of the excellent email extension plugins such as this one?

CIGuy
  • 5,076
  • 28
  • 37
  • i will tell you my scenario. job A and B are there. job A poll svn and copying changeset to my project directory(job B).Here i am using promoted build for getting email notification after successful completion of job B. In job B another build is there triggered by periodic schedule. For this i have put one email-ext on postbuild action. My worry is if build by commit,ie from job A to job B, after completion of job B build, it will do as promoted email-ext as well as email-ext in the post build action of job B. so i will get two notification..(Promoted i used because for sending mail-commiter). – varghese Jul 25 '12 at 05:59