Skip to content

Commit caacaa4

Browse files
authored
add install script validation to build pipeline (#541)
- Add initial validation for our install scripts - Currently depending on log output for expected installed file validation. - Checking installation directory existence. - Not checking actual install file dotnet dependency. - Update pr/ci pipelines to run validation with build stage
1 parent 37f5d08 commit caacaa4

File tree

4 files changed

+163
-8
lines changed

4 files changed

+163
-8
lines changed

.vsts-ci.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,30 @@ variables:
1111
BuildConfiguration: 'Release'
1212
TeamName: 'Package Experience'
1313

14-
steps:
15-
- template: build/build.yml
16-
parameters:
17-
nuspecProperties: 'VersionSuffix=CI-$(Build.BuildNumber)'
14+
stages:
15+
- stage: Build
16+
dependsOn: []
17+
jobs:
18+
- job: build
19+
steps:
20+
- template: build/build.yml
21+
parameters:
22+
nuspecProperties: 'VersionSuffix=CI-$(Build.BuildNumber)'
23+
24+
- stage: ValidateInstallScriptWindows
25+
dependsOn: []
26+
pool:
27+
vmImage: windows-latest
28+
jobs:
29+
- template: build/validate-install-script-ps.yml
30+
parameters:
31+
repo: 'self'
32+
33+
- stage: ValidateInstallScriptLinux
34+
dependsOn: []
35+
pool:
36+
vmImage: ubuntu-latest
37+
jobs:
38+
- template: build/validate-install-script-sh.yml
39+
parameters:
40+
repo: 'self'

.vsts-pr.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,30 @@ variables:
1111
BuildConfiguration: 'Debug'
1212
TeamName: 'Package Experience'
1313

14-
steps:
15-
- template: build/build.yml
16-
parameters:
17-
nuspecProperties: 'VersionSuffix=PR-$(Build.BuildNumber)'
14+
stages:
15+
- stage: Build
16+
dependsOn: []
17+
jobs:
18+
- job: build
19+
steps:
20+
- template: build/build.yml
21+
parameters:
22+
nuspecProperties: 'VersionSuffix=CI-$(Build.BuildNumber)'
23+
24+
- stage: ValidateInstallScriptWindows
25+
dependsOn: []
26+
pool:
27+
vmImage: windows-latest
28+
jobs:
29+
- template: build/validate-install-script-ps.yml
30+
parameters:
31+
repo: 'self'
32+
33+
- stage: ValidateInstallScriptLinux
34+
dependsOn: []
35+
pool:
36+
vmImage: ubuntu-latest
37+
jobs:
38+
- template: build/validate-install-script-sh.yml
39+
parameters:
40+
repo: 'self'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
parameters:
2+
- name: repo
3+
type: string
4+
5+
jobs:
6+
- job: WindowsInstallDefault
7+
steps:
8+
- checkout: ${{ parameters.repo }}
9+
- task: PowerShell@2
10+
displayName: Validate Install Script
11+
inputs:
12+
targetType: 'inline'
13+
script: |
14+
./helpers/installcredprovider.ps1 -Force 6>> ./output.log
15+
cat ./output.log
16+
if( (Select-String -Path .\output.log -Pattern "Microsoft.Net6.NuGet.CredentialProvider") -eq $null) {echo "Expected credential provider file not found."; exit 1}
17+
workingDirectory: $(Build.SourcesDirectory)
18+
- job: WindowsInstallNet8
19+
steps:
20+
- checkout: ${{ parameters.repo }}
21+
- task: PowerShell@2
22+
displayName: Validate Install Script
23+
inputs:
24+
targetType: 'inline'
25+
script: |
26+
./helpers/installcredprovider.ps1 -InstallNet8 -Force 6>> ./output.log
27+
cat ./output.log
28+
if( (Select-String -Path .\output.log -Pattern "Microsoft.Net8.NuGet.CredentialProvider") -eq $null) {echo "Expected credential provider file not found."; exit 1}
29+
workingDirectory: $(Build.SourcesDirectory)
30+
- job: WindowsInstallNetfxDefault
31+
steps:
32+
- checkout: ${{ parameters.repo }}
33+
- task: PowerShell@2
34+
displayName: Validate Install Script
35+
inputs:
36+
targetType: 'inline'
37+
script: |
38+
./helpers/installcredprovider.ps1 -AddNetfx -Force 6>> ./output.log
39+
cat ./output.log
40+
if( (Select-String -Path .\output.log -Pattern "Microsoft.NuGet.CredentialProvider") -eq $null) {echo "Expected credential provider file not found."; exit 1}
41+
workingDirectory: $(Build.SourcesDirectory)
42+
- job: WindowsInstallNetfx48
43+
steps:
44+
- checkout: ${{ parameters.repo }}
45+
- task: PowerShell@2
46+
displayName: Validate Install Script
47+
inputs:
48+
targetType: 'inline'
49+
script: |
50+
./helpers/installcredprovider.ps1 -AddNetFx48 -Force 6>> ./output.log
51+
cat ./output.log
52+
if((Select-String -Path .\output.log -Pattern "Microsoft.NetFx48.NuGet.CredentialProvider") -eq $null) {echo "Expected credential provider file not found."; exit 1}
53+
workingDirectory: $(Build.SourcesDirectory)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
parameters:
2+
- name: repo
3+
type: string
4+
5+
jobs:
6+
- job: validateLineEndings
7+
steps:
8+
- checkout: ${{ parameters.repo }}
9+
- bash: |
10+
if grep $'\r' ./helpers/installcredprovider.sh; then
11+
echo "CRLF line ending found"
12+
exit 1
13+
fi
14+
workingDirectory: $(Build.SourcesDirectory)
15+
displayName: Validate Install Script
16+
- job: LinuxInstallDefault
17+
steps:
18+
- checkout: ${{ parameters.repo }}
19+
- bash: |
20+
./helpers/installcredprovider.sh -Force >> ./output.log
21+
cat ./output.log
22+
23+
if ! grep "Microsoft.Net6.NuGet.CredentialProvider" ./output.log; then
24+
echo "Expected credential provider not found"
25+
exit 1
26+
fi
27+
if [ ! -d "$HOME/.nuget/plugins/netcore/CredentialProvider.Microsoft" ]; then
28+
echo "Credential provider plugin directory not found"
29+
exit 1
30+
fi
31+
32+
echo "Credential provider installed successfully"
33+
workingDirectory: $(Build.SourcesDirectory)
34+
displayName: Validate Install Script
35+
- job: LinuxInstallNet8
36+
steps:
37+
- checkout: ${{ parameters.repo }}
38+
- bash: |
39+
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
40+
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
41+
./helpers/installcredprovider.sh -Force >> ./output.log
42+
cat ./output.log
43+
44+
if ! grep "Microsoft.Net8.NuGet.CredentialProvider" ./output.log; then
45+
echo "Expected credential provider not found"
46+
exit 1
47+
fi
48+
if [ ! -d "$HOME/.nuget/plugins/netcore/CredentialProvider.Microsoft" ]; then
49+
echo "Credential provider plugin directory not found"
50+
exit 1
51+
fi
52+
53+
echo "Credential provider installed successfully"
54+
workingDirectory: $(Build.SourcesDirectory)
55+
displayName: Validate Install Script
56+

0 commit comments

Comments
 (0)