/
search-cache-pipeline.yml
181 lines (162 loc) · 6.6 KB
/
search-cache-pipeline.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
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
# 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 * * * *
displayName: Run every hour
branches:
include:
- main
always: true # Trigger even when there are no code changes.
parameters:
- name: publishToBlob
displayName: Publish to blob?
type: boolean
default: true
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: NetCore1ESPool-Internal
image: 1es-windows-2022
os: windows
pool:
name: NetCore1ESPool-Internal
image: 1es-ubuntu-2204
os: linux
stages:
- stage: stage
jobs:
- job: jobs
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish Test Log and Results'
condition: always()
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: Test_LogResults
publishLocation: Container
- output: pipelineArtifact
displayName: 'Publish Artifacts'
targetPath: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
artifactName: outputs
steps:
- checkout: self
- script: '$(Build.SourcesDirectory)/build.sh'
- 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: 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: >
$(Build.SourcesDirectory)/.dotnet/dotnet $(Build.SourcesDirectory)/artifacts/bin/Microsoft.TemplateSearch.TemplateDiscovery/Debug/net9.0/Microsoft.TemplateSearch.TemplateDiscovery.dll --basePath $(System.DefaultWorkingDirectory)/NugetDownloadDirectory --allowPreviewPacks -v --test --diff $(EnableDiffMode)
displayName: Run Cache Updater
- task: CopyFiles@2
inputs:
SourceFolder: $(System.DefaultWorkingDirectory)/NugetDownloadDirectory/SearchCache/
Contents: |
NuGetTemplateSearchInfo*.json
nonTemplatePacks.json
TargetFolder: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
- ${{ if eq(parameters.publishToBlob, true) }}:
- script: '$(Build.SourcesDirectory)/eng/SearchCache/InstallAzureCLI.sh'
displayName: Install Azure CLI
- bash: az config set extension.use_dynamic_install=yes_without_prompt
displayName: Disable Azure CLI prompts
- bash: >
az storage azcopy blob upload
-c $(CacheFileStorageContainer)
--account-name $(CacheFileStorageAccount)
-s '$(System.DefaultWorkingDirectory)/ArtifactsToPublish/NuGetTemplateSearchInfoVer2.json'
--sas-token "$(CacheFileStorageSasToken)"
-d NuGetTemplateSearchInfoVer2.json
--verbose
| tee upload.log
&& grep ".*Number of Transfers Completed: 1" upload.log || (echo ; echo "Cache file upload failed"; false)
displayName: Upload to blob storage
- bash: >
az storage azcopy blob upload
-c $(LegacyCacheFileStorageContainer)
--account-name $(LegacyCacheFileStorageAccount)
-s '$(System.DefaultWorkingDirectory)/ArtifactsToPublish/NuGetTemplateSearchInfo.json'
--sas-token "$(LegacyCacheFileStorageSasToken)"
-d NuGetTemplateSearchInfo.json
--verbose
| tee upload-legacy.log
&& grep ".*Number of Transfers Completed: 1" upload-legacy.log || (echo ; echo "Legacy cache file upload failed"; false)
displayName: Upload legacy file to blob storage
- bash: >
az storage azcopy blob upload
-c $(NonTemplatePacksFileStorageContainer)
--account-name $(NonTemplatePacksFileStorageAccount)
-s '$(System.DefaultWorkingDirectory)/ArtifactsToPublish/nonTemplatePacks.json'
--sas-token "$(NonTemplatePacksFileStorageSasToken)"
-d nonTemplatePacks.json
--verbose
| tee upload-non-template-packs.log
&& grep ".*Number of Transfers Completed: 1" upload-non-template-packs.log || (echo ; echo "Legacy cache file upload failed"; false)
displayName: Upload non template packages file to blob storage