How to send email notification on the basis of different job - hudson

I have job A which trigger build on the basis of commit, after completion of job A, job B will get triggered as downstream job.
IN my case both job A and B send email notification.
How can i configure like job A trigger job B so that after successful completion of job B , i wanted to send email notification to the committer of job A aswellas global recipient.
Can any one help me regarding this?
Thanks in Advance

1. Try the Blame Upstream Committers plugin.
2. If you trigger Job-B via "trigger parameterized build" from Job-A, then you can pass any information from Job-A to Job-B.
(for that one, I am not sure how the committer is saved -
please advise the plugin you use and if the committer is listed as an environment variable of some sort).

Related

Capture Run Time status of SPECIFIC Task in SSIS 2012

I have a SSIS package which contain 5 sequence task container and inside that other control flow task. all are running parallel.
i am trying to have all audit and metadata information like package name,task name and current status of task (running,completed or failed.)
The Bigger Problem i feel here is how to handle once the status of the task got changed.
this information i am trying to save in sql table
package name i can get from system variable, how to get current status of Task.
i am trying to store status value like "start","in-progress","end".
May someone please share your thoughts.
Thanks
You can capture the change of a task's state by using SSIS's Event Handlers. To do this, click on the task itself and then click on the Event Handlers tab at the top of the design-time window. This will bring up a blank window with a blue link in the middle of the page as follows:
Before you click on the blue link, select a specific Event Handler that you want to handle:
From here, you can execute specific tasks. For example, you can run an SMTP mail task in the OnError Event Handler to send an e-mail alert regarding a task error. Or, you can run an Execute SQL Task in the OnPostExecute Event Handler to send data to the database once a task has completed.
I think for your specific problem (how to get Run Time for a task), you will need two Event Handlers:
OnPreExecute: Capture the system's datetime value via GETDATE() and write it to a SQL table as SequenceContainerTaskNameStartTs
OnPostExecute: Capture the system's datetime value via GETDATE() and write it to a SQL table as SequenceContainerTaskNameEndTs
Where 'Ts' stands for TimeStamp.
You can then calculate the runtime with the DATEDIFF() function and specify the time interval (e.g., seconds, minutes, hours, etc.). This value can either be stored in a separate field on the table (i.e., SequenceContainerRunTime) or simply generated on-the-fly in a SQL SELECT.
For more information on SSIS's Event Handlers, read here:
Integration Services (SSIS) Event Handlers

NATS - just one subscriber to take action for published event in a microservicearchitecture

I'm new to NATS and have read all the examples for:
https://nats.io/documentation/concepts/nats-messaging/
I'm in Microservciearchitecture where in microservice-Y (MSY) need to store some information published from other microservice-X (MSX) I have 2-10 instances of MSY so when changes are made in MSX and MSX-instance publishes event I want that only 1 instance of MSY should save information so not all of them save the same data.
I have read Request-Repy:
https://nats.io/documentation/concepts/nats-req-rep/
but there seems that all of instances receives message (and will handle it) even if it is point-to-point and reply is handled just for the one instance that is quickest to reply
Is this correct or have I missunderstood example?
If I only need that 1 instance of MSY should handle given message (store data in db) what can I do to acheve this?
Use queue groups. If you have multiple subscriptions on the same subject with the same queue group, only one of the members of the group will receive the message.
Check this out: https://nats.io/documentation/concepts/nats-queueing/

Receive email only when all the tasks are completed

I am launching a lot of jobs on a cluster as an array (similarly to what explained in http://www3.imperial.ac.uk/bioinfsupport/help/cluster_usage/submitting_array_jobs)
If I use $ -m ea I receive hundreds of emails, one for job.
How can I receive an email only when all the tasks are completed? Is it possible to receive when all the tasks are completed but also an email when any of the task is aborted?
According to my knowledge, this does not seem possible. Others may have more experience, so I defer final solution to those with more experience.
However, what you can do is:
Submit your job array without the -m option (or with -m a to track aborted tasks)
submit a second single dummy job using -hold_jid_ad <job_id_of_job_array> and -m e option.
This will send email when hold on on single job (step 2) is satisfied i.e. when all tasks in your job array complete (step 1).

SQL Server 2008 table change (insert/update/delete) notification push on broker

I have a rather complex and large database with about 3000+ objects (tables/triggers/sps combined). I inherited this DB and restructuring it is probably 3-4 years away.
meanwhile, I need to implement a pub sub feature for any insert/update/delete on these tables. Given number of tables and existing queries probably query notification (and SQL Dependency) will not work. What I am looking for is a way to push the changes (what changed in table - like records PK and table name) on the service broker so I can use external activator to then retrieve change,and then use my custom pub sub from that point onwards.
I have pretty much all the ducks lined up except for the way to push change notification on service broker.
Any help/pointers are appreciated.
Thanks.
N M
PS. I did look around for similar postings and did come across a few however, MSDN articles they referred to seem to have all removed - not sure what's going on on MSDN site.
For external activator look at Microsoft SQL Server 2008 Feature Pack- "Microsoft SQL Server 2008 R2 Service Broker External Activator".
For console application (that processes messages) great idea is to drop an eye in codeplex. There is good examples.
To put event notification (notifications, that will be used by external activator service) code looks something like this:
Create Queue ExternalActivatorQueue;
Create Service ExternalActivatorService On Queue ExternalActivatorQueue
([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification])
Create Event Notification NotifyExternalActivator
On Queue dbo.ProcessQueue
For QUEUE_ACTIVATION
To Service 'ExternalActivatorService', 'current database'
To send message in the queue:
Declare #h UniqueIdentifier;
Declare #x xml = '<tag/>';
Begin Dialog Conversation #h
From Service MyTableService
To Service 'ProcessService'
With Encryption = OFF;
Send On Conversation #h(#x)
All steps i done to make it work is here, but just in Latvian :). There actually is almost what you need (trigger that sends messages when data are inserted in table..).

Jenkins and JUnit

I've read over the Jenkins site and its JUnit plugin, and for some reason something that is very basic is just not apparent to me.
Jenkins has an Email-ext plugin for sending custom/advanced notification emails whenever a build is ran. In these emails you can place "content tokens" that are runtime variables that get replaced with dynamic values when the email is being generated.
One of these tokens is TEST_COUNTS which allows you to display the number of JUnit tests that ran, or which failed, etc.
How does one go about getting Jenkins to display this information correctly? Is there a plugin I need, and if so, which one? I have my build running JUnit and generating an XML report. I assume Jenkins somehow parses JUnit results out of that XML and uses it to give values to that token.
But on the other hand, I've read "literature" (mailing list posts) that seems to suggest that in order to use that token you need to use Jenkins to run the unit tests, not a junit Ant task from inside your build script.
Can someone clarify this for me and perhaps even set out the "order of operations" for what steps I need to take in order to be able to make use of this token?
It would be supremely useful to get test counts in our build notifications.
Your first explanation is right. You tell Jenkins where to search for JUnit output files, and it parses them to find out the test results:
The test results appear on each project and build page, so as long as you're seeing the correct results there, you should get the correct token replacements in your e-mails
Add something like this to the content in the "Editable Email Notification" configuration:
Total = $TEST_COUNTS
Failed = ${TEST_COUNTS,var="fail"}
I also recommend the Jenkins users mailing list for Jenkins questions, usually helpful.