What is the trigger for Jenkins extended email notification - bash

What is the trigger for Jenkins extended email notification plugin? I have in executed shell of the job path to bash script. And somewhere in this script I have notification:
echo "Disc usage is over 90%"
but after this I have to continue script execution without exiting but right away I need just send an email notification about this event. How can I do this?

There are almost 20 different triggers for e-mail ext. See the advanced button under the e-mail configuration. You can use either a separate script result to trigger e-mail ext or an overall build status at the time when the plugin gets triggered.
The latter better suits your situation, as it can be used along with Text Finder plugin to set the overall build status to Unstable depending on the parsed Disk usage value or whatever you need. Then configure e-mail ext to send e-mail on Unstable.

Related

Dynamics 365 - A check to ensure that all tasks have been complete

I have a scenario where the user wants a check in place to ensure that all tasks have been completed before moving onto next stage on the Business Process Flow.
Is there anyway to do this?
2 ways to achieve it.
Option 1: Create a bool field - Tasks closed? & keep that in BPF step, if it’s true then platform will also users to move forward. Otherwise not.
You can mark this as read-only, write a plugin on Task completion to update this as yes, when there is no more open tasks.
Read more
Option 2: Can have a js validation onStageChange or onSave to retrieve open child tasks, check the count, show notification & preventDefault.
Read more
You can do the same in pre-update plugin, throw InvalidPluginExecutionException if there are open tasks.

How to use teamcity.build.triggeredBy.username property in case when build was triggered by schedule

My case is what I want to send custom email (not notification) to user who run a build. But in case when build was triggered by schedule I want to send the email to the default user (release manager). teamcity.build.triggeredBy.username property is good for me except when build was triggered automatically. teamcity.build.triggeredBy.username not defined and I got "%teamcity.build.triggeredBy.username%" value instead "" as I expected.
What the best way to solve the issue?
Instead of writing a custom module, what you can do instead is utilize the notifications tab in teamcity
In the notifications tab, there are genreic notification rules that can be sent. In your case, you can set a notification alert to send a mail to the person who ran/broke the build. There are various options . I would suggest you play with them a bit to figure out which one you need exactly
you can check teamcity.build.triggeredBy property: it's always available and will be set to Schedule Trigger. e.g. in linux-sh:
if [ '%teamcity.build.triggeredBy%' == 'Schedule Trigger' ]; then ...; fi

Adding a dialog child workflow to an on-demand workflow

I was wondering if anybody ran into the same issue as I am facing now.
What I'm trying to do is have a workflow that checks the condition of a field (optionset) of a form. If the field has option 1, 2 or 3 then create new record with certain shared attributes, otherwise start a child workflow. The child workflow is a "Dialog" process, not a "workflow" process which informs the user that the record was not created and why. For some reason I cannot select the dialog workflow from the dropdown list of available child workflows...
Both the parent workflow and the "dialog" workflow process are based on the same entity.
If anybody has any ideas on how I could debug this or any clues in general I would greatly appreciate your feedback.
Thanks for taking the time to read this post!
It is not possible to call a dialog from a workflow (see here).
Workflows are generally triggered by events.
Imagine the ramifications - which user would receive the dialog and what if no-one was logged in?
One option is to drive everything with JavaScript
Trigger on change of the option set
Create the records
Start the workflow
Start the dialog
See the section under the heading "Opening a Dialog Process by Using a URL" on MSDN here
Rather use the URL than showModalDialog or showModelessDialog.
What might work even better is to call an Action from JavaScript. The Action can run synchronously and create all records, start child workflows and dialogs.
A synchronous workflow can stop an event and return an error message to the user, but cannot return success messages - it look like this will not meet your requirements, but Gareth Tucker has an example here.

Automatically email the recent changes for a particular build in Hudson

Is there any way to send an email in Hudson which has the list of recent changes in that build?
For example
Trigger a build and if you go recent changes there we have some recent changes. Once it is success, the email should have the list of the changes that happened in that particular build. After this, say the next build fails (build fail email will be triggered), but it records the changes and these change lists also should be included in next successful build.
You'll first need to install the Email-ext plugin for Hudson.
Inside the project configuration, under Post-build Actions click the Email Notification and Editable Email Notification checkboxes. Instead of having the Content be $PROJECT_DEFAULT_CONTENT you'll want to use a different token. Those are described when you click the help icon (?) for Content Token Reference.
Specifically to your example, add (or edit if it exists) the trigger for Success. Change the Content of the success email to use the token ${CHANGES_SINCE_LAST_SUCCESS, reverse, format, showPaths, changesFormat, pathFormat}. The different options are explained in the reference. If you just want the defaults, simply use ${CHANGES_SINCE_LAST_SUCCESS}

Automator / AppleScript to process incoming emails in Mac Mail

I'm designing an app that allows users to email me crash reports if my app ever crashes. I'd like to leave Mac Mail running on a computer and when an email comes through, an automator script / AppleScript runs to process the contents of the body of the email.
I've got the entire parsing/processing done in a python script, except I have to manually copy the contents of the email into a file and then run my parser on that file.
What's the best way to set this up so I can the contents of the email be pushed into my parsing script?
Many thanks!
Probably the simplest approach is to define a Mail.app Rule. You can set up filtering conditions to specify the set of incoming email to apply the rule to and among the rule actions you can specify is one to run an AppleScript on incoming messages. Rules are managed with Mail.app Preferences -> Rules. Apple supplies examples of Rule Action scripts with Mac OS X. Look in /Library/Scripts/Mail Scripts/Rule Actions or search the web.
Here's a script that extracts from email into a file using a mail rule: MacScripter / Mail rule script for message export. Might be good for sample code for what you're doing.
Use the Dictionary in Applescript Editor to see the properties of mail and you'll quickly be able to see the properties of any mail message. Here's a quick and dirty example of getting the content of a mail message.
tell application "Mail"
set the_messages to selection
repeat with this_message in the_messages
set mytext to content of this_message
end repeat
end tell
Modify the script linked to above that copies output to a temporary file and then pass that file to your Python script to act on.

Resources