-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathsearch-cache-pipeline.yml
More file actions
186 lines (166 loc) · 6.39 KB
/
search-cache-pipeline.yml
File metadata and controls
186 lines (166 loc) · 6.39 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# templating-search-cache-updater
# https://dev.azure.com/dnceng/internal/_build?definitionId=1025
# Don't trigger for CI events: push, PR created etc.
trigger: none
# Trigger periodically instead.
schedules:
- cron: 0 0 * * *
displayName: Run once a day
branches:
include:
- main
always: true # Trigger even when there are no code changes.
parameters:
- name: publishToBlob
displayName: Publish to blob?
type: boolean
default: true
variables:
# Variables used: DncEngInternalBuildPool
- template: /eng/common/templates-official/variables/pool-providers.yml
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
sdl:
sourceAnalysisPool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows
stages:
- stage: Build
jobs:
- job: Create
pool:
name: $(DncEngInternalBuildPool)
image: 1es-ubuntu-2204
os: linux
templateContext:
outputs:
- output: pipelineArtifact
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: Test_LogResults
- output: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
artifactName: ArtifactsToPublish
steps:
- script: $(Build.SourcesDirectory)/build.sh
displayName: Build
- task: CopyFiles@2
displayName: Gather Test Log and Results
inputs:
SourceFolder: $(Build.SourcesDirectory)/artifacts
Contents: |
log/**/*
TestResults/**/*
TargetFolder: $(Build.ArtifactStagingDirectory)
continueOnError: true
condition: always()
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: xUnit
testResultsFiles: '*.xml'
searchFolder: $(Build.SourcesDirectory)/artifacts/TestResults/Debug
mergeTestResults: true
continueOnError: true
condition: always()
- task: UseDotNet@2
displayName: Use .NET 6.0.100
inputs:
packageType: sdk
version: 6.0.100
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: Use .NET 6.0.300
inputs:
packageType: sdk
version: 6.0.300
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: Use .NET 6.0.400
inputs:
packageType: sdk
version: 6.0.400
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: Use .NET 7.0.100
inputs:
packageType: sdk
version: 7.0.100
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: Use .NET 7.0.200
inputs:
packageType: sdk
version: 7.0.200
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: Use .NET 8.0.200
inputs:
packageType: sdk
version: 8.0.200
installationPath: $(Build.SourcesDirectory)/.dotnet
- bash: >
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin
-Channel 7.0.3xx
-Quality daily
-InstallDir $(Build.SourcesDirectory)/.dotnet
-SkipNonVersionedFiles
displayName: Install daily .NET 7.0.3xx
- bash: >
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin
-Channel 8.0.1xx
-Quality daily
-InstallDir $(Build.SourcesDirectory)/.dotnet
-SkipNonVersionedFiles
displayName: Install latest daily .NET version
- bash: |
projectPath=$(Build.SourcesDirectory)/tools/Microsoft.TemplateSearch.TemplateDiscovery/Microsoft.TemplateSearch.TemplateDiscovery.csproj
netCurrent=$($(Build.SourcesDirectory)/.dotnet/dotnet msbuild $projectPath -getProperty:NetCurrent)
echo "Resolved NetCurrent: $netCurrent"
$(Build.SourcesDirectory)/.dotnet/dotnet run --no-build \
--framework $netCurrent \
--project $projectPath \
-- --basePath $(System.DefaultWorkingDirectory)/NugetDownloadDirectory --allowPreviewPacks -v --test --diff $(EnableDiffMode)
displayName: Run Cache Updater
- task: CopyFiles@2
displayName: Copy artifacts to publish
inputs:
SourceFolder: $(System.DefaultWorkingDirectory)/NugetDownloadDirectory/SearchCache/
Contents: |
NuGetTemplateSearchInfo*.json
nonTemplatePacks.json
TargetFolder: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
- ${{ if eq(parameters.publishToBlob, true) }}:
# An entirely separate job is required to run AzureFileCopy@6, which is a Windows-only task.
# If the Create job was rewritten to use PowerShell instead of Bash, Create and Publish could be combined into a single Windows job.
- job: Publish
dependsOn: Create
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
targetPath: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
artifactName: ArtifactsToPublish
steps:
- task: AzureFileCopy@6
displayName: Upload to blob storage
inputs:
SourcePath: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/*.json
# Service connection: https://dnceng.visualstudio.com/internal/_settings/adminservices?resourceId=010b0bdc-9487-484f-af2d-ca3ae3235b84
azureSubscription: DOTNET-Templating - PME
Destination: AzureBlob
# These variables are defined in the pipeline's Variables UI.
storage: $(CacheFileStorageAccount)
ContainerName: $(CacheFileStorageContainer)