forked from dotnet/templating
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search-cache-pipeline.yml
168 lines (149 loc) · 5.71 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
# 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
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: 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
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:
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)