Compare commits

...

20 Commits

Author SHA1 Message Date
Nikita Bykov 742c5dae81 update 2021-08-20 15:17:09 +03:00
Nikita Bykov f3f0d2026d update 2021-08-20 11:54:21 +03:00
Nikita Bykov 5e6f2c681c update 2021-08-20 11:48:02 +03:00
Nikita Bykov bb9fd35708 update 2021-08-19 15:17:18 +03:00
Nikita Bykov 9f535cd83f update 2021-08-19 14:36:29 +03:00
Nikita Bykov 750ff93e50 update 2021-08-19 14:31:13 +03:00
Nikita Bykov a29d98d3f2 update 2021-08-19 12:47:25 +03:00
Nikita Bykov 538be710eb update 2021-08-19 11:50:50 +03:00
Nikita Bykov 8f1a38e755 update 2021-08-19 11:32:59 +03:00
Nikita Bykov 9fc854ce04 update 2021-08-18 18:30:36 +03:00
Nikita Bykov 03ae7d095d add script for slack notification 2021-08-18 17:43:15 +03:00
Nikita Bykov 97e0e3a660 update get-new-tool-version.ps1 2021-08-17 16:57:27 +03:00
Nikita Bykov b01e7843b6 Update 2021-07-13 18:06:50 +03:00
Nikita Bykov 856cb1ed00 Update 2021-07-13 17:17:45 +03:00
Nikita Bykov 6b744d4218 Add CancelWorkflow method 2021-07-13 17:14:29 +03:00
Nikita Bykov 4b286369c5 Test 2021-07-12 15:42:01 +03:00
Nikita Bykov 65cd85d7fe Test 2021-07-12 15:37:20 +03:00
Nikita Bykov 7654b2e70d Test 2021-07-12 15:12:52 +03:00
Nikita Bykov 7847e40341 Test 2021-07-12 15:10:09 +03:00
Nikita Bykov d853f172e3 Update get-new-tool-version.ps1 2021-07-12 14:50:19 +03:00
6 changed files with 80 additions and 14 deletions
@@ -29,6 +29,7 @@ if ($ToolName -eq "Xamarin") {
if ($VersionsToBuild) {
$availableVersions = $VersionsToBuild -join $joinChars
Write-Host "The following versions are available to build:`n${availableVersions}"
Write-Host "::set-output name=TOOL_VERSIONS::${availableVersions}"
Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}"
} else {
Write-Host "There aren't versions to build"
+1 -1
View File
@@ -2,7 +2,7 @@ using module "./base-parser.psm1"
class GoVersionsParser: BaseVersionsParser {
[SemVer[]] GetUploadedVersions() {
$url = $this.BuildGitHubFileUrl("actions", "go-versions", "main", "versions-manifest.json")
$url = $this.BuildGitHubFileUrl("nikita-bykov", "go-versions", "move-get-go-version", "versions-manifest.json")
$releases = Invoke-RestMethod $url -MaximumRetryCount $this.ApiRetryCount -RetryIntervalSec $this.ApiRetryIntervalSeconds
return $releases.version
}
@@ -2,7 +2,7 @@ using module "./base-parser.psm1"
class NodeVersionsParser: BaseVersionsParser {
[SemVer[]] GetUploadedVersions() {
$url = $this.BuildGitHubFileUrl("actions", "node-versions", "main", "versions-manifest.json")
$url = $this.BuildGitHubFileUrl("nikita-bykov", "node-versions", "move-get-node-versions-test", "versions-manifest.json")
$releases = Invoke-RestMethod $url -MaximumRetryCount $this.ApiRetryCount -RetryIntervalSec $this.ApiRetryIntervalSeconds
return $releases.version
}
@@ -0,0 +1,60 @@
<#
.SYNOPSIS
Sending messages using Incoming Webhooks
.PARAMETER Url
Required parameter. Incoming Webhook URL to post a message
.PARAMETER ToolName
Required parameter. The name of tool
.PARAMETER ToolVersion
Required parameter. Specifies the version of tool
.PARAMETER PipelineUrl
Required parameter. The pipeline URL
.PARAMETER ImageUrl
Optional parameter. The image URL
#>
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.Uri]$Url,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.String]$ToolName,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.String]$ToolVersion,
[System.String]$PipelineUrl,
[System.String]$ImageUrl = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
)
# Import helpers module
Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking
# Create JSON body
$text = "Some jobs were not successful for the following detection pipelines of '$ToolName'\nLink to the pipeline: '$pipelineUrl'"
$jsonBodyMessage = @"
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "$text"
},
"accessory": {
"type": "image",
"image_url": "$imageUrl",
"alt_text": "$toolName"
}
}
]
}
"@
# Send Slack message
$null = Send-SlackPostMessageIncomingWebHook -Uri $url -Body $jsonBodyMessage
@@ -23,25 +23,25 @@ param(
[ValidateNotNullOrEmpty()]
[System.String]$ToolName,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.String]$ToolVersion,
[System.String]$PipelineUrl,
[System.String]$ImageUrl = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
[System.String]$ImageUrl = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png',
[System.String]$Text
)
# Import helpers module
Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking
# Create JSON body
if ($toolName -eq "Xamarin") {
$text = "The following versions of '$toolName' are available, consider adding them to toolset: $toolVersion"
} else {
$text = "The following versions of '$toolName' are available to upload: $toolVersion"
}
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
$text += "\nLink to the pipeline: $pipelineUrl"
if ([string]::IsNullOrWhiteSpace($Text)) {
if ($toolName -eq "Xamarin") {
$Text = "The following versions of '$toolName' are available, consider adding them to toolset: $toolVersion"
} else {
$Text = "The following versions of '$toolName' are available to upload: $toolVersion"
}
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
$Text += "\nLink to the pipeline: $pipelineUrl"
}
}
$jsonBodyMessage = @"
{
@@ -50,7 +50,7 @@ $jsonBodyMessage = @"
"type": "section",
"text": {
"type": "mrkdwn",
"text": "$text"
"text": "$Text"
},
"accessory": {
"type": "image",
+5
View File
@@ -124,6 +124,11 @@ class GitHubApi
}
}
[void] CancelWorkflow([string]$WorkflowId) {
$url = "actions/runs/$WorkflowId/cancel"
$this.InvokeRestMethod($url, 'POST', $null, $null)
}
[object] hidden InvokeRestMethod(
[string] $Url,
[string] $Method,