简体   繁体   中英

sending custom email notifications from teamcity

I am setting up an email notification in my teamcity server. I have a CICD pipeline and what i want to do is following-

when my first build configuration(Build automation) gets executed successfully, i want to notify app manager about it and ask for his approval to run the second build configuration(UAT deployment). Once he clicks on "OK", the other build configuration(UAT deployment) should run automatically.So i want to set a custom email notification with some custom subject and custom body.

Any help would be greatly appreciated.

i have read about email notifier and templates but that did not help.

you may want to try out a personal notification app like Notify17 .

The concept would be that, while this approach does NOT generate an email, it does generate a notification on your mobile phone, way far easier to notice (emails are so easy to miss, especially in developers environments).

What you would do is:

Eg in curl format:

read -r -d '' BODY <<EOF || true
The configuration(Build automation) has build successfully.

Click here to see the build: $BUILD_URL
EOF

curl -X POST \
  "https://hook.notify17.net/api/raw/RAW_API_KEY" \
  -F title="configuration(Build automation) complete" \
  -F content="$BODY"

You may want to replace $BUILD_URL with the actual correct URL to point to your build.

Once you test this out, and want to also send it to your boss, he can:

  • Create a Notify17 account.
  • Download the app for Android or iOS .
  • From the dashboard, create a raw API key .
  • He can then send you his raw API key, and you can add this key to a sharing group .
  • Once you created the sharing group, navigate to the raw API keys page, and add the sharing group to your own raw API key (in the Actions column). What happens here is that, whenever you trigger a new notification with your raw API key, it will also be forwarded to any other raw API key that exists in the specified sharing group (eg your team).

Triggering the build

From TeamCity docs, it's possible to trigger a build using this kind of request:

curl -v -u user:password http://teamcity.server.url:8111/app/rest/buildQueue --request POST --header "Content-Type:application/xml" --data-binary @build.xml

However, this requires a POST request, which you may not execute by directly visiting a URL (so, even in an email). In the future Notify17 will support actions, but for now it's possible to just generate simple notifications and parsing payloads .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM