forked from dotnet/templating
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search-cache-pipeline.yml
138 lines (119 loc) · 4.5 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
# 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
pool:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Ubuntu.2204.Amd64
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: PublishBuildArtifacts@1
displayName: Publish Test Log and Results
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: Test_LogResults
publishLocation: Container
continueOnError: true
condition: always()
- task: UseDotNet@2
displayName: 'Use .NET 3.1'
inputs:
packageType: sdk
version: 3.1.x
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: 'Use .NET 5.0.100'
inputs:
packageType: sdk
version: 5.0.100
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: 'Use .NET 5.0.300'
inputs:
packageType: sdk
version: 5.0.300
installationPath: $(Build.SourcesDirectory)/.dotnet
- task: UseDotNet@2
displayName: 'Use .NET 6.0.100'
inputs:
packageType: sdk
version: 6.0.100
installa6ionPath: $(Build.SourcesDirectory)/.dotnet
- bash: >
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin
-Channel 7.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/net7.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/
- publish: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
artifact: outputs
displayName: Publish Artifacts
- ${{ 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
| 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
| 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
| 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