{"id":6065,"date":"2019-06-06T14:17:32","date_gmt":"2019-06-06T14:17:32","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=6065"},"modified":"2021-11-16T11:36:32","modified_gmt":"2021-11-16T11:36:32","slug":"octopus-deploy-send-a-notification-when-deployments-fail","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/octopus-deploy-send-a-notification-when-deployments-fail\/","title":{"rendered":"Octopus Deploy &#8211; Send a Notification When Deployments Fail"},"content":{"rendered":"\n<p>If you are using Octopus Deploy as part of a continuous delivery pipeline, you\u2019ll probably find that deployments don\u2019t fail very often. This means, you need to send an email about staus of each deployment process to differnet stake holders.<\/p>\n\n\n\n<p>Here is a simple email notification step that tells you when a deployment fails, including a reasonable amount of information about the failure.<\/p>\n\n\n\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-steve-fenton\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"IbLYrngoti\"><a href=\"https:\/\/www.stevefenton.co.uk\/2015\/08\/send-a-notification-when-deployments-fail\/\" target=\"_blank\" rel=\"noopener\">Send a Notification When Deployments Fail<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"https:\/\/www.stevefenton.co.uk\/2015\/08\/send-a-notification-when-deployments-fail\/embed\/#?secret=IbLYrngoti\" data-secret=\"IbLYrngoti\" width=\"600\" height=\"338\" title=\"&#8220;Send a Notification When Deployments Fail&#8221; &#8212; Steve Fenton\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>You must also needs to understand a Octopus Deploy system variable which can be used to customized a email body. As a work-around you could use two steps for sending the &#8216;status-email&#8217;:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>One step sending &#8216;success&#8217;-email. This step should have its &#8216;Run condition&#8217; set to &#8216;Success: only run when previous steps are successfull&#8217;.<\/li><li> Another step sending &#8216;failure&#8217;-email. This step should have &#8216;Run condition&#8217; set to &#8216;Failure: only run when a previous step failed&#8217;. <\/li><\/ul>\n\n\n\n<p>Perhaps the system-variables Octopus.Deployment.Error Octopus.Deployment.ErrorDetail could also be helpfull.<br><\/p>\n\n\n\n<p>https:\/\/octopus.com\/docs\/deployment-process\/variables\/system-variables<\/p>\n\n\n\n<p>https:\/\/stackoverflow.com\/questions\/41474157\/how-do-i-add-the-job-status-success-or-failure-in-the-email-notification<\/p>\n\n\n\n<p><br><\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_39683\"><iframe loading=\"lazy\"  id=\"_ytid_13077\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_39683\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>If you are using Octopus Deploy as part of a continuous delivery pipeline, you\u2019ll probably find that deployments don\u2019t fail very often. This means, you need to send an email&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5208],"tags":[5215,629,5209],"class_list":["post-6065","post","type-post","status-publish","format-standard","hentry","category-octopus-deploy","tag-deployments-fail","tag-notification","tag-octopus-deploy"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/6065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=6065"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/6065\/revisions"}],"predecessor-version":[{"id":25514,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/6065\/revisions\/25514"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=6065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=6065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=6065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}