-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
112 lines (95 loc) · 3.76 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
variables:
projectVersion: 1
configuration: Release
solution: UKHO.Logging.EventHubLogProvider.sln
progetFeed: https://progetcloud.ukho.gov.uk/nuget/ukho.trusted/v3/index.json
name: $(Build.DefinitionName)_$(projectVersion).$(date:yy)$(DayOfYear)$(rev:.r)
trigger: none
stages:
- stage: build
jobs:
- job: run_build
pool:
name: NautilusBuild
workspace:
clean: all
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 8.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet restore
displayName: Restore Packages
- powershell: ./Apply-AssemblyVersionAndDefaults.ps1 -buildNumber $(Build.BuildNumber) -solutionDirectory $(Build.SourcesDirectory)
displayName: Apply Version Number
- task: CmdLine@1
displayName: "Run OWASP Dependency Checker"
inputs:
filename: "dependency-check.bat"
arguments: '--project "EventHubLogProvider - $(Build.SourceBranchName)" --scan "$(Build.SourcesDirectory)" --out "$(Build.SourcesDirectory)\DCReport" --suppression $(Build.SourcesDirectory)\NVDSuppressions.xml --noupdate'
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: OWASP Dependency Checker Report"
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\DCReport'
ArtifactName: "OWASP Dependency Checker Report"
- task: PowerShell@1
displayName: "Fail Build if Dependency Check Finds Any Vulnerabilities"
inputs:
scriptType: inlineScript
arguments: '-ReportLocation $(Build.SourcesDirectory)\DCReport\*'
inlineScript: |
param($ReportLocation)
Invoke-VulnerabilityCheck -ReportLocation $ReportLocation
- script: dotnet build $(solution) -c $(configuration) --no-restore
displayName: Build Project
- script: dotnet test $(solution) --no-build -c $(configuration) --logger:trx --results-directory $(Agent.BuildDirectory)/TestResults
displayName: Test Project
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testRunner: VSTest
testResultsFiles: '$(Agent.BuildDirectory)/TestResults/*.trx'
failTaskOnFailedTests: true
mergeTestResults: true
- script: dotnet pack $(solution) --no-build -c $(configuration) -o $(Build.ArtifactStagingDirectory)
displayName: Pack Project
- task: PublishPipelineArtifact@1
displayName: Publish Pipeline Atrifact
inputs:
path: $(Build.ArtifactStagingDirectory)
artifact: $(Build.DefinitionName)
- stage: Proget
jobs:
- deployment: Publish_To_ProGetCloud
displayName: Publish To ProGetCloud
pool:
name: NautilusRelease
environment: EventHubLogProvider-ProGet
strategy:
runOnce:
deploy:
steps:
- powershell: dotnet nuget push "$(Pipeline.Workspace)/**/$("$(Build.BuildNumber)".replace('_','.')).nupkg" -k $(progetApiKey) -s $(progetFeed)
env:
progetApiKey : $(progetApiKey)
displayName: Publish Package
- stage: Nuget
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
variables:
- group: nuget-deployment-vars
jobs:
- deployment: Publish_To_NuGet
displayName: Publish To NuGet
pool:
name: NautilusRelease
environment: EventHubLogProvider-NuGet
strategy:
runOnce:
deploy:
steps:
- powershell: dotnet nuget push "$(Pipeline.Workspace)/**/$("$(Build.BuildNumber)".replace('_','.')).nupkg" -k $(nugetApiKey) -s https://api.nuget.org/v3/index.json --no-symbols
env:
nugetApiKey : $(nugetApiKey)
displayName: Publish Package