Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@ param(
Import-Module $PSScriptRoot/../build.psm1 -Force
Import-Module $PSScriptRoot/packaging -Force


function Send-DailyWebHook
{
param (
[Parameter(Mandatory=$true,Position=0)][ValidateSet("Pass","Fail")]$result
)

# Only send web hook if the environment variable is present
# Varible should be set in Travis-CI.org settings
if ($env:WebHookUrl)
{
$webhook = $env:WebHookUrl

$Body = @{
'text'= @"
Build Result: $result </br>
OS Type: $($PSVersionTable.OS) </br>
<a href="https://travis-ci.org/$env:TRAVIS_REPO_SLUG/builds/$env:TRAVIS_BUILD_ID">Build $env:TRAVIS_BUILD_NUMBER</a> </br>
<a href="https://travis-ci.org/$env:TRAVIS_REPO_SLUG/jobs/$env:TRAVIS_JOB_ID">Job $env:TRAVIS_JOB_NUMBER</a>
"@
}

$params = @{
Headers = @{'accept'='application/json'}
Body = $Body | convertto-json
Method = 'Post'
URI = $webhook
}

Invoke-RestMethod @params
}
else
{
log "Skipping DailyWebHook. WebHookUrl environment variable not present."
}
}

# This function retrieves the appropriate svg to be used when presenting
# the daily test run badge
# the location in azure is public readonly
Expand Down Expand Up @@ -236,6 +273,12 @@ else
catch {
Write-Warning "Could not update status badge: $_"
}
try {
Send-DailyWebHook -result $result
}
catch {
Write-Warning "Could not send webhook: $_"
}
}
}

Expand Down