Notification when build starts
Hi,
I want to send notification to RocketChat when build starts. I get notification when it completes (pass/fail). How can I send ' Build Started'?
I have checked all 3 checkboxes in notification settings - Build success, build failure and Build status changed. But it isn't sending for build starts.
- Capture.PNG 14 KB
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 26 Feb, 2020 06:35 PM
There is no way to send built-in notification at the start of the build. However, you can easily call that endpoint with a simple
curl
orInvoke-WebRequest
command ininit
section of yourappveyor.yml
.2 Posted by Suganya Karunan... on 27 Feb, 2020 07:50 PM
Hi Feodor,
Thanks for the quick response. Do you have a sample I can use pls.?
*From:* Feodor Fitsner <[email blocked]>
*Sent:* Wednesday, February 26, 2020 1:35 PM
*To:* [email blocked]
*Subject:* Re: Notification when build starts [Questions #46819]
3 Posted by Suganya Karunan... on 27 Feb, 2020 07:51 PM
I am trying below script and it doesn't work..
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Body = @{
User = 'Suganya'
password = 'Hello'
}
Invoke-WebRequest -Uri 'https://chat.imobile3.com/hooks/***********' -Headers @{'X-RocketChat-Channel' = '#cicd'} -Body $Body -Method Post -ErrorAction Stop
Support Staff 4 Posted by Feodor Fitsner on 27 Feb, 2020 07:53 PM
What error do you get?
5 Posted by Suganya Karunan... on 27 Feb, 2020 08:09 PM
Invoke-WebRequest : {"success":false,"error":"error-running-script"}
At line:8 char:1
+ Invoke-WebRequest -Uri 'https://chat.imobile3.com/hooks/TeAdLCzXAqw2a ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation:
(System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId :
WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
*From:* Feodor Fitsner <[email blocked]>
*Sent:* Thursday, February 27, 2020 2:54 PM
*To:* [email blocked]
*Subject:* Re: Notification when build starts [Questions #46819]
Support Staff 6 Posted by Feodor Fitsner on 27 Feb, 2020 08:13 PM
Is it a full error stack trace? It's hard to see what's wrong with the request. What do you get when running the same piece locally?
7 Posted by Suganya Karunan... on 27 Feb, 2020 08:22 PM
I get the same error locally as well.. The error is "The remote server returned an error: (400) Bad Request."
Invoke-WebRequest : {"success":false,"error":"error-running-script"}
At line:24 char:1
+ Invoke-WebRequest -Uri 'https://chat.imobile3.com/hooks/TeAdLCzXAqw2a ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Command executed with exception: The remote server returned an error: (400) Bad Request.
Support Staff 8 Posted by Feodor Fitsner on 27 Feb, 2020 08:27 PM
I'm not familiar with RocketChat, but looking at their API docs it seems you are calling it wrong: https://rocket.chat/docs/developer-guides/rest-api/chat/postmessage...
9 Posted by Suganya Karunan... on 27 Feb, 2020 08:31 PM
How is AppVeyor calling the webhook? Because below is all the configuration
is set in it..
- provider: Webhook
url: https://chat.imobile3.com/hooks/***Y7
method: POST
headers:
X-RocketChat-Channel: '#cicd'
on_build_success: true
on_build_failure: true
on_build_status_changed: true
*From:* Feodor Fitsner <[email blocked]>
*Sent:* Thursday, February 27, 2020 3:27 PM
*To:* [email blocked]
*Subject:* Re: Notification when build starts [Questions #46819]
Support Staff 10 Posted by Feodor Fitsner on 27 Feb, 2020 08:32 PM
You mean you are already calling like that and it works?
11 Posted by Suganya Karunan... on 27 Feb, 2020 08:52 PM
Yes, the AppVeyor webhook works. But it does not send a notification when
the build starts and I want to notify that. You mentioned using a
PowerShell webrequest but it is throwing an error.
*From:* Feodor Fitsner <[email blocked]>
*Sent:* Thursday, February 27, 2020 3:33 PM
*To:* [email blocked]
*Subject:* Re: Notification when build starts [Questions #46819]
Support Staff 12 Posted by Feodor Fitsner on 27 Feb, 2020 08:55 PM
Your PowerShell script differs from a screenshot in the initial post. In webhook settings you don't have a body while PS script sends username/password in the body.
13 Posted by Suganya Karunan... on 27 Feb, 2020 09:04 PM
What is the request body that AppVeyor sends? I am just trying a sample
body for the request.. Can you pls. share the request body that AppVeyor
sets for build
*From:* Feodor Fitsner <[email blocked]>
*Sent:* Thursday, February 27, 2020 3:56 PM
*To:* [email blocked]
*Subject:* Re: Notification when build starts [Questions #46819]
Support Staff 14 Posted by Feodor Fitsner on 27 Feb, 2020 09:07 PM
This is it: https://www.appveyor.com/docs/notifications/#webhook-payload-default
Feodor Fitsner closed this discussion on 29 Apr, 2020 09:02 PM.