From 2a422a2d525852b90cba85c8a7acdb95c91ec6fc Mon Sep 17 00:00:00 2001 From: Yuriy-Kukushkin <87432006+Yuriy-Kukushkin@users.noreply.github.com> Date: Thu, 12 Aug 2021 10:06:34 +0300 Subject: [PATCH 1/7] Create validate_manifest.yml --- .github/workflows/validate_manifest.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/validate_manifest.yml diff --git a/.github/workflows/validate_manifest.yml b/.github/workflows/validate_manifest.yml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.github/workflows/validate_manifest.yml @@ -0,0 +1 @@ + From 6147177edd2267789024fb622864864d8c45fd87 Mon Sep 17 00:00:00 2001 From: Yuriy-Kukushkin <87432006+Yuriy-Kukushkin@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:13:40 +0300 Subject: [PATCH 2/7] Added Go validator --- .github/workflows/validate_manifest.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/validate_manifest.yml b/.github/workflows/validate_manifest.yml index 8b13789..11d8665 100644 --- a/.github/workflows/validate_manifest.yml +++ b/.github/workflows/validate_manifest.yml @@ -1 +1,15 @@ +name: Validate manifest + +on: + workflow_dispatch + +jobs: + validation: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Validate Go manifest + shell: pwsh + run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json From 98826eed538e949e1a5335e459fc3c6ea58b61bf Mon Sep 17 00:00:00 2001 From: Yuriy-Kukushkin <87432006+Yuriy-Kukushkin@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:34:50 +0300 Subject: [PATCH 3/7] Added node manifest validator --- .github/workflows/validate_manifest.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/validate_manifest.yml b/.github/workflows/validate_manifest.yml index 11d8665..439f656 100644 --- a/.github/workflows/validate_manifest.yml +++ b/.github/workflows/validate_manifest.yml @@ -9,7 +9,12 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Validate Go manifest shell: pwsh run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json + + - name: Validate Node manifest + shell: pwsh + run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json From ab37396421776f90fbcc226fdd93a8d41a29f6a7 Mon Sep 17 00:00:00 2001 From: Yuriy-Kukushkin <87432006+Yuriy-Kukushkin@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:54:56 +0300 Subject: [PATCH 4/7] Added python validator --- .github/workflows/validate_manifest.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate_manifest.yml b/.github/workflows/validate_manifest.yml index 439f656..483a460 100644 --- a/.github/workflows/validate_manifest.yml +++ b/.github/workflows/validate_manifest.yml @@ -1,4 +1,4 @@ -name: Validate manifest +name: Validate manifests on: workflow_dispatch @@ -10,11 +10,14 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Validate Go manifest + - name: Validate go-versions manifest shell: pwsh run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json - - name: Validate Node manifest + - name: Validate node-versions manifest shell: pwsh run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json + - name: Validate python-versions manifest + shell: pwsh + run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json From 3d09ce1d1983839631e042ac7295fdefbd440f64 Mon Sep 17 00:00:00 2001 From: Yuriy-Kukushkin <87432006+Yuriy-Kukushkin@users.noreply.github.com> Date: Fri, 3 Sep 2021 11:54:24 +0300 Subject: [PATCH 5/7] Delete validate_manifest.yml --- .github/workflows/validate_manifest.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/validate_manifest.yml diff --git a/.github/workflows/validate_manifest.yml b/.github/workflows/validate_manifest.yml deleted file mode 100644 index 483a460..0000000 --- a/.github/workflows/validate_manifest.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Validate manifests - -on: - workflow_dispatch - -jobs: - validation: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Validate go-versions manifest - shell: pwsh - run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json - - - name: Validate node-versions manifest - shell: pwsh - run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json - - - name: Validate python-versions manifest - shell: pwsh - run: .\packages-generation\manifest-validator.ps1 -ManifestUrl https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json From f72b7a85c7fde3007f51df66879947160d9304d8 Mon Sep 17 00:00:00 2001 From: Yuriy-Kukushkin <87432006+Yuriy-Kukushkin@users.noreply.github.com> Date: Fri, 3 Sep 2021 11:55:56 +0300 Subject: [PATCH 6/7] Update manifest-validator.ps1 --- packages-generation/manifest-validator.ps1 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages-generation/manifest-validator.ps1 b/packages-generation/manifest-validator.ps1 index 7266e11..6e82ae7 100644 --- a/packages-generation/manifest-validator.ps1 +++ b/packages-generation/manifest-validator.ps1 @@ -3,6 +3,7 @@ param ( [string] $AccessToken ) +$Global:validationFailed = $false $authorizationHeaderValue = "Basic $AccessToken" $webRequestHeaders = @{} if ($AccessToken) { @@ -14,9 +15,13 @@ function Publish-Error { [string] $ErrorDescription, [object] $Exception ) - Write-Host "##vso[task.logissue type=error]ERROR: $ErrorDescription." - Write-Host "##vso[task.logissue type=error] $Exception" - Write-Host "##vso[task.complete result=Failed;]" + + echo "::error ::$ErrorDescription" + if(-not [string]::IsNullOrEmpty($Exception)) + { + Write-Output "Exception: $Exception" + } + $Global:validationFailed = $true } function Test-DownloadUrl { @@ -61,3 +66,8 @@ $manifestJson | ForEach-Object { } } } + +if($Global:validationFailed) +{ + exit 1 +} From f07ff8ddf9946290b2cd62700194520271bc3213 Mon Sep 17 00:00:00 2001 From: Yuriy-Kukushkin <87432006+Yuriy-Kukushkin@users.noreply.github.com> Date: Thu, 9 Sep 2021 18:03:55 +0300 Subject: [PATCH 7/7] Refactoring --- packages-generation/manifest-validator.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages-generation/manifest-validator.ps1 b/packages-generation/manifest-validator.ps1 index 6e82ae7..0065c3a 100644 --- a/packages-generation/manifest-validator.ps1 +++ b/packages-generation/manifest-validator.ps1 @@ -17,7 +17,7 @@ function Publish-Error { ) echo "::error ::$ErrorDescription" - if(-not [string]::IsNullOrEmpty($Exception)) + if (-not [string]::IsNullOrEmpty($Exception)) { Write-Output "Exception: $Exception" } @@ -67,7 +67,6 @@ $manifestJson | ForEach-Object { } } -if($Global:validationFailed) -{ +if ($Global:validationFailed) { exit 1 }