forked from dotnet/templating
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search-cache-pipeline.yml
111 lines (95 loc) · 3.93 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
# 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:
vmImage: ubuntu-20.04
steps:
- checkout: self
- script: '$(Build.SourcesDirectory)/build.sh'
- bash: |
SdkVersion=$(dotnet msbuild $(Build.SourcesDirectory)/eng/Versions.props -verbosity:diagnostic | grep "VSRedistCommonNetCoreToolsetx64PackageVersion = " | xargs | cut -d' ' -f 3)
echo "##vso[task.setvariable variable=RepoSdkVersion;]$SdkVersion"
displayName: 'Determine SDK version'
- 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
- bash: >
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin
-Version $(RepoSdkVersion)
-InstallDir $(Build.SourcesDirectory)/.dotnet
-SkipNonVersionedFiles
displayName: Install .NET 6.0
- bash: >
$(Build.SourcesDirectory)/.dotnet/dotnet $(Build.SourcesDirectory)/artifacts/bin/Microsoft.TemplateSearch.TemplateDiscovery/Debug/net6.0/Microsoft.TemplateSearch.TemplateDiscovery.dll
--basePath $(System.DefaultWorkingDirectory)/NugetDownloadDirectory --allowPreviewPacks -v --test --latestVersionToTest $(RepoSdkVersion)
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
- bash: az config set extension.use_dynamic_install=yes_without_prompt
displayName: Disable Azure CLI prompts
- ${{ if eq(parameters.publishToBlob, true) }}:
- 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