Merge 33b79844a6
into 504e746b96
commit
cc7f5f12d3
@ -0,0 +1,39 @@
|
|||||||
|
name: 'Send Slack notification'
|
||||||
|
description: 'SendSlack notification about new versions of a tool'
|
||||||
|
inputs:
|
||||||
|
url:
|
||||||
|
required: true
|
||||||
|
description: 'Slack channel url'
|
||||||
|
tool-name:
|
||||||
|
required: true
|
||||||
|
description: 'Name of a tool to send notification for. Like Xamarin or Python'
|
||||||
|
default: 'Xamarin'
|
||||||
|
tool-version:
|
||||||
|
required: false
|
||||||
|
description: 'New versions of a tool'
|
||||||
|
pipeline-url:
|
||||||
|
required: false
|
||||||
|
description: 'Url of a pipeline'
|
||||||
|
image-url:
|
||||||
|
required: false
|
||||||
|
description: 'Image url for message'
|
||||||
|
default: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
|
||||||
|
text:
|
||||||
|
required: false
|
||||||
|
description: 'Message text'
|
||||||
|
add-to-toolset-flag:
|
||||||
|
required: false
|
||||||
|
description: 'Flag to use notification for adding new versions to toolset'
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- id: send-slack-notification
|
||||||
|
name: Send Slack notification
|
||||||
|
shell: pwsh
|
||||||
|
run: ./get-new-tool-versions/send-slack-notification.ps1 -Url "${{ inputs.url }}" `
|
||||||
|
-ToolName "${{ inputs.tool-name }}" `
|
||||||
|
-ToolVersion "${{ inputs.tool-version }}" `
|
||||||
|
-PipelineUrl "${{ inputs.pipeline-url }}" `
|
||||||
|
-ImageUrl "${{ inputs.image-url }}" `
|
||||||
|
-Text "${{ inputs.text }}" `
|
||||||
|
${{ inputs.add-to-toolset-flag }}
|
@ -0,0 +1,89 @@
|
|||||||
|
name: Get tools new versions
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 8 * * THU'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
find-new-tool-versions:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
tool:
|
||||||
|
- name: 'Xamarin'
|
||||||
|
image: 'https://avatars.githubusercontent.com/u/790012?s=200&v=4'
|
||||||
|
releases-url: 'null'
|
||||||
|
filter-parameter: 'null'
|
||||||
|
filter-arch: 'null'
|
||||||
|
- name: 'Python'
|
||||||
|
image: 'https://avatars.githubusercontent.com/u/1525981?s=200&v=4'
|
||||||
|
releases-url: 'https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json'
|
||||||
|
filter-parameter: 'version'
|
||||||
|
filter-arch: 'x64'
|
||||||
|
- name: 'PyPy'
|
||||||
|
image: 'https://avatars.githubusercontent.com/u/318667?s=200&v=4'
|
||||||
|
releases-url: 'https://downloads.python.org/pypy/versions.json'
|
||||||
|
filter-parameter: 'python_version'
|
||||||
|
filter-arch: 'x86'
|
||||||
|
- name: 'Node'
|
||||||
|
image: 'https://avatars.githubusercontent.com/u/9950313?s=200&v=4'
|
||||||
|
releases-url: 'https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json'
|
||||||
|
filter-parameter: 'version'
|
||||||
|
filter-arch: 'x64'
|
||||||
|
- name: 'Go'
|
||||||
|
image: 'https://avatars.githubusercontent.com/u/4314092?s=200&v=4'
|
||||||
|
releases-url: 'https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json'
|
||||||
|
filter-parameter: 'version'
|
||||||
|
filter-arch: 'x64'
|
||||||
|
name: 'Searching for new versions of ${{ matrix.tool.name }}'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- id: get-new-tool-versions
|
||||||
|
name: Get new tool versions
|
||||||
|
run: |
|
||||||
|
$versionsOutput = ./get-new-tool-versions/verify-new-tool-version-added-to-image.ps1 `
|
||||||
|
-ToolName ${{ matrix.tool.name }} `
|
||||||
|
-ReleasesUrl ${{ matrix.tool.releases-url }} `
|
||||||
|
-FilterParameter ${{ matrix.tool.filter-parameter }} `
|
||||||
|
-FilterArch ${{ matrix.tool.filter-arch }}
|
||||||
|
echo "::set-output name=versions-output::$versionsOutput"
|
||||||
|
- name: Check versions
|
||||||
|
if: steps.get-new-tool-versions.outputs.versions-output == ''
|
||||||
|
run: Write-Host "No new versions found"
|
||||||
|
- uses: ./.github/actions/send-slack-notification
|
||||||
|
name: Send Slack notification
|
||||||
|
if: steps.get-new-tool-versions.outputs.versions-output != ''
|
||||||
|
with:
|
||||||
|
url: ${{ secrets.SLACK_CHANNEL_URL }}
|
||||||
|
tool-name: '${{ matrix.tool.name }}'
|
||||||
|
tool-version: ${{ steps.get-new-tool-versions.outputs.versions-output }}
|
||||||
|
image-url: '${{ matrix.tool.image }}'
|
||||||
|
add-to-toolset-flag: '-AddToToolsetFlag'
|
||||||
|
|
||||||
|
check_build:
|
||||||
|
name: Check build for failures
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [find-new-tool-versions]
|
||||||
|
if: failure()
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- id: get-failed-jobs
|
||||||
|
name: Get failed jobs
|
||||||
|
run: |
|
||||||
|
$jobs_url = "$env:GITHUB_API_URL/repos/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID/jobs"
|
||||||
|
$failedJobs = (Invoke-RestMethod -Uri $jobs_url).jobs |
|
||||||
|
Where-Object conclusion -eq "failure" |
|
||||||
|
ForEach-Object {"\n\t" + $_.name.split(" ")[-1] + ": $($_.html_url)"}
|
||||||
|
echo "::set-output name=failed-jobs::$failedJobs"
|
||||||
|
- uses: ./.github/actions/send-slack-notification
|
||||||
|
name: Send Slack notification about failure
|
||||||
|
with:
|
||||||
|
url: ${{ secrets.SLACK_CHANNEL_URL }}
|
||||||
|
tool-name: 'Tool name'
|
||||||
|
pipeline-url: '$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID'
|
||||||
|
text: "Missing toolset tool versions checker pipeline has failed jobs:/n/t${{ steps.get-failed-jobs.outputs.failed-jobs }}"
|
@ -1,37 +0,0 @@
|
|||||||
name: $(date:yyyyMMdd)$(rev:.r)
|
|
||||||
trigger: none
|
|
||||||
pr: none
|
|
||||||
schedules:
|
|
||||||
- cron: "0 8 * * Thu"
|
|
||||||
displayName: Daily build
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- main
|
|
||||||
always: true
|
|
||||||
|
|
||||||
variables:
|
|
||||||
PoolName: 'Azure Pipelines'
|
|
||||||
VmImage: 'ubuntu-18.04'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- stage: Find_New_Versions
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- job: Find_New_Versions
|
|
||||||
pool:
|
|
||||||
name: $(PoolName)
|
|
||||||
vmImage: $(VmImage)
|
|
||||||
steps:
|
|
||||||
- template: /azure-pipelines/templates/get-tool-versions-steps.yml
|
|
||||||
|
|
||||||
- stage: Check_New_Versions
|
|
||||||
dependsOn: Find_New_Versions
|
|
||||||
jobs:
|
|
||||||
- job: Check_New_Versions
|
|
||||||
pool:
|
|
||||||
name: $(PoolName)
|
|
||||||
vmImage: $(VmImage)
|
|
||||||
variables:
|
|
||||||
ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]
|
|
||||||
steps:
|
|
||||||
- template: /azure-pipelines/templates/check-versions.yml
|
|
@ -0,0 +1,25 @@
|
|||||||
|
function Search-ToolsVersionsNotOnImage {
|
||||||
|
param (
|
||||||
|
[string]$ToolName,
|
||||||
|
[string]$ReleasesUrl,
|
||||||
|
[string]$FilterParameter,
|
||||||
|
[string]$FilterArch
|
||||||
|
)
|
||||||
|
|
||||||
|
$stableReleases = (Invoke-RestMethod $ReleasesUrl) | Where-Object stable -eq $true
|
||||||
|
$stableReleaseVersions = $stableReleases | ForEach-Object {
|
||||||
|
if ($ToolName -eq "Node") {
|
||||||
|
$_.$FilterParameter.split(".")[0] + ".0"
|
||||||
|
} else {
|
||||||
|
$_.$FilterParameter.split(".")[0,1] -join"."
|
||||||
|
}
|
||||||
|
} | Select-Object -Unique
|
||||||
|
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/win/toolsets/toolset-2022.json"
|
||||||
|
$latestMinorVersion = (Invoke-RestMethod $toolsetUrl).toolcache |
|
||||||
|
Where-Object {$_.name -eq $ToolName -and $_.arch -eq $FilterArch} |
|
||||||
|
ForEach-Object {$_.versions.Replace("*","0")} |
|
||||||
|
Select-Object -Last 1
|
||||||
|
$versionsToAdd = $stableReleaseVersions | Where-Object {[version]$_ -gt [version]$latestMinorVersion}
|
||||||
|
|
||||||
|
return $versionsToAdd
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
function Search-XamarinVersionsNotOnImage {
|
||||||
|
param (
|
||||||
|
[string]$ReleasesUrl,
|
||||||
|
[array]$FilterProducts
|
||||||
|
)
|
||||||
|
|
||||||
|
$xamarinReleases = (Invoke-RestMethod $ReleasesUrl).items
|
||||||
|
$filteredReleases = $xamarinReleases | Where-Object {$_.name -in $FilterProducts.name} | Sort-Object name | Select-Object name, version
|
||||||
|
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/macos/toolsets/toolset-11.json"
|
||||||
|
$uploadedReleases = (Invoke-RestMethod $toolsetUrl).xamarin
|
||||||
|
$releasesOnImage = @()
|
||||||
|
foreach ($FilterProduct in $FilterProducts) {
|
||||||
|
$releasesOnImage += @{$FilterProduct.name = $uploadedReleases.($FilterProduct.property)}
|
||||||
|
}
|
||||||
|
$versionsToAdd = $filteredReleases | Where-Object {$releasesOnImage.($_.name) -notcontains $_.version} | ForEach-Object {[string]::Empty} {
|
||||||
|
'{0,-15} : {1}' -f $_.name, $_.version
|
||||||
|
}
|
||||||
|
return $versionsToAdd
|
||||||
|
}
|
@ -1,30 +0,0 @@
|
|||||||
using module "./base-parser.psm1"
|
|
||||||
|
|
||||||
class XamarinVersionsParser: BaseVersionsParser {
|
|
||||||
[PSCustomObject] GetAvailableVersions() {
|
|
||||||
$allVersions = $this.ParseAllAvailableVersions()
|
|
||||||
return $allVersions
|
|
||||||
}
|
|
||||||
|
|
||||||
[hashtable] GetUploadedVersions() {
|
|
||||||
$url = $this.BuildGitHubFileUrl("actions", "virtual-environments", "main", "images/macos/toolsets/toolset-11.0.json")
|
|
||||||
$releases = Invoke-RestMethod $url -MaximumRetryCount $this.ApiRetryCount -RetryIntervalSec $this.ApiRetryIntervalSeconds
|
|
||||||
$xamarin = $releases.xamarin
|
|
||||||
$xamarinReleases = @{
|
|
||||||
'Mono Framework' = $xamarin.'mono-versions'
|
|
||||||
'Xamarin.Android' = $xamarin.'android-versions'
|
|
||||||
'Xamarin.iOS' = $xamarin.'ios-versions'
|
|
||||||
'Xamarin.Mac' = $xamarin.'mac-versions'
|
|
||||||
}
|
|
||||||
return $xamarinReleases
|
|
||||||
}
|
|
||||||
|
|
||||||
hidden [PSCustomObject] ParseAllAvailableVersions() {
|
|
||||||
$url = "http://aka.ms/manifest/stable"
|
|
||||||
$filteredProducts = @('Mono Framework', 'Xamarin.Android', 'Xamarin.iOS', 'Xamarin.Mac')
|
|
||||||
$releases = Invoke-RestMethod $url -MaximumRetryCount $this.ApiRetryCount -RetryIntervalSec $this.ApiRetryIntervalSeconds
|
|
||||||
$items = $releases.items
|
|
||||||
$products = $items | Where-Object {$_.name -in $filteredProducts} | Sort-Object name | Select-Object name, version
|
|
||||||
return $products
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,38 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Check and return list of new available tool versions that not added to toolsets yet
|
||||||
|
|
||||||
|
.PARAMETER ToolName
|
||||||
|
Required parameter. The name of tool for which parser is available (Python, Xamarin, PyPy, Node, Go)
|
||||||
|
#>
|
||||||
|
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory)]
|
||||||
|
[ValidateSet("Python", "Xamarin", "PyPy", "Node", "Go")]
|
||||||
|
[string] $ToolName,
|
||||||
|
[string] $ReleasesUrl,
|
||||||
|
[string] $FilterParameter,
|
||||||
|
[string] $FilterArch
|
||||||
|
)
|
||||||
|
|
||||||
|
Get-ChildItem "$PSScriptRoot/parsers/verify-added-to-image/" | ForEach-Object {Import-Module $_.FullName}
|
||||||
|
|
||||||
|
if ($ToolName -in "Python", "PyPy", "Node", "Go") {
|
||||||
|
$versionsToAdd = Search-ToolsVersionsNotOnImage -ToolName $ToolName -ReleasesUrl $ReleasesUrl -FilterParameter $FilterParameter -FilterArch $FilterArch
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ToolName -eq "Xamarin") {
|
||||||
|
$xamarinReleases = "http://aka.ms/manifest/stable"
|
||||||
|
$xamarinProducts = @(
|
||||||
|
[PSCustomObject] @{name = 'Mono Framework'; property = 'mono-versions'}
|
||||||
|
[PSCustomObject] @{name = 'Xamarin.Android'; property = 'android-versions'}
|
||||||
|
[PSCustomObject] @{name = 'Xamarin.iOS'; property = 'ios-versions'}
|
||||||
|
[PSCustomObject] @{name = 'Xamarin.Mac'; property = 'mac-versions'}
|
||||||
|
)
|
||||||
|
$versionsToAdd = Search-XamarinVersionsNotOnImage -ReleasesUrl $xamarinReleases -FilterProducts $xamarinProducts
|
||||||
|
$joinChars = "\n\t"
|
||||||
|
}
|
||||||
|
|
||||||
|
$versionsToAdd = $versionsToAdd -join $joinChars
|
||||||
|
|
||||||
|
return $versionsToAdd
|
Loading…
Reference in New Issue