Skip to content

Commit

Permalink
Adding Installation Check in Pre-Release Stage (#23575)
Browse files Browse the repository at this point in the history
* Adding Installation Check in Pre-Release Stage

* PR modifications

* Styling
  • Loading branch information
ckairen authored Aug 30, 2021
1 parent 544d1d5 commit fe1a256
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
12 changes: 12 additions & 0 deletions eng/pipelines/templates/stages/archetype-net-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ stages:
dependsOn: Signing
condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-net-pr'))
jobs:
- job: InstallationCheck
condition: ne('${{ artifact.skipPublishPackage }}', 'true')
displayName: "Installation Check"
steps:
- download: current
artifact: ${{parameters.ArtifactName}}-signed
- pwsh: mkdir InstallationCheck
displayName: Create Testing Directory
- pwsh: |
$(System.DefaultWorkingDirectory)/eng/scripts/InstallationCheck.ps1 -ArtifactsDirectory ${{parameters.ArtifactName}} -Artifact ${{artifact.name}} -PipelineWorkspace $(Pipeline.Workspace)
displayName: Verify Package Installation
workingDirectory: $(System.DefaultWorkingDirectory)/InstallationCheck
- deployment: TagRepository
displayName: "Create release tag"
condition: ne(variables['Skip.TagRepository'], 'true')
Expand Down
32 changes: 32 additions & 0 deletions eng/scripts/InstallationCheck.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
param (
[Parameter()]
[string] $ArtifactsDirectory,

[Parameter()]
[string] $Artifact,

[Parameter()]
[string] $PipelineWorkspace
)

Write-Host "dotnet new console"
dotnet new console
$localFeed = "$PipelineWorkspace/$ArtifactsDirectory-signed/$Artifact"
Write-Host "dotnet nuget add source $localFeed"
dotnet nuget add source $localFeed

$version = (Get-ChildItem "$localFeed/*.nupkg" -Exclude "*.symbols.nupkg" -Name).replace(".nupkg","").replace("$Artifact.","")
Write-Host "dotnet add package $Artifact --version $version --no-restore"
dotnet add package $Artifact --version $version --no-restore
if ($LASTEXITCODE) {
exit $LASTEXITCODE
}

Write-Host "dotnet nuget locals all --clear"
dotnet nuget locals all --clear

Write-Host "dotnet restore -s https://api.nuget.org/v3/index.json -s $localFeed --no-cache --verbosity detailed"
dotnet restore -s https://api.nuget.org/v3/index.json -s $localFeed --no-cache --verbosity detailed
if ($LASTEXITCODE) {
exit $LASTEXITCODE
}

0 comments on commit fe1a256

Please sign in to comment.