Skip to content

Commit 1b5e9d6

Browse files
authored
Merge pull request #8028 from dotnet/feature/CacheTaskUsage
Update cache pipeline to use AzureFileCopy task
2 parents a5167d1 + 5d3ce3e commit 1b5e9d6

File tree

2 files changed

+51
-90
lines changed

2 files changed

+51
-90
lines changed

eng/SearchCache/InstallAzureCLI.sh

-26
This file was deleted.

search-cache-pipeline.yml

+51-64
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ parameters:
1818
type: boolean
1919
default: true
2020

21+
variables:
22+
# Variables used: DncEngInternalBuildPool
23+
- template: /eng/common/templates-official/variables/pool-providers.yml
24+
2125
resources:
2226
repositories:
2327
- repository: 1ESPipelineTemplates
@@ -30,81 +34,78 @@ extends:
3034
parameters:
3135
sdl:
3236
sourceAnalysisPool:
33-
name: NetCore1ESPool-Internal
37+
name: $(DncEngInternalBuildPool)
3438
image: 1es-windows-2022
3539
os: windows
36-
pool:
37-
name: NetCore1ESPool-Internal
38-
image: 1es-ubuntu-2204
39-
os: linux
4040
stages:
41-
- stage: stage
41+
- stage: Build
4242
jobs:
43-
- job: jobs
43+
- job: Create
44+
pool:
45+
name: $(DncEngInternalBuildPool)
46+
image: 1es-ubuntu-2204
47+
os: linux
4448
templateContext:
4549
outputs:
4650
- output: pipelineArtifact
47-
displayName: 'Publish Test Log and Results'
48-
condition: always()
49-
targetPath: '$(Build.ArtifactStagingDirectory)'
51+
targetPath: $(Build.ArtifactStagingDirectory)
5052
artifactName: Test_LogResults
51-
publishLocation: Container
5253
- output: pipelineArtifact
53-
displayName: 'Publish Artifacts'
5454
targetPath: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
55-
artifactName: outputs
55+
artifactName: ArtifactsToPublish
5656

5757
steps:
58-
- checkout: self
59-
- script: '$(Build.SourcesDirectory)/build.sh'
58+
- script: $(Build.SourcesDirectory)/build.sh
59+
displayName: Build
60+
6061
- task: CopyFiles@2
6162
displayName: Gather Test Log and Results
6263
inputs:
63-
SourceFolder: '$(Build.SourcesDirectory)/artifacts'
64+
SourceFolder: $(Build.SourcesDirectory)/artifacts
6465
Contents: |
6566
log/**/*
6667
TestResults/**/*
67-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
68+
TargetFolder: $(Build.ArtifactStagingDirectory)
6869
continueOnError: true
6970
condition: always()
7071

7172
- task: UseDotNet@2
72-
displayName: 'Use .NET 6.0.100'
73+
displayName: Use .NET 6.0.100
7374
inputs:
7475
packageType: sdk
7576
version: 6.0.100
7677
installationPath: $(Build.SourcesDirectory)/.dotnet
7778

7879
- task: UseDotNet@2
79-
displayName: 'Use .NET 6.0.300'
80+
displayName: Use .NET 6.0.300
8081
inputs:
8182
packageType: sdk
8283
version: 6.0.300
8384
installationPath: $(Build.SourcesDirectory)/.dotnet
8485

8586
- task: UseDotNet@2
86-
displayName: 'Use .NET 6.0.400'
87+
displayName: Use .NET 6.0.400
8788
inputs:
8889
packageType: sdk
8990
version: 6.0.400
9091
installationPath: $(Build.SourcesDirectory)/.dotnet
9192

9293
- task: UseDotNet@2
93-
displayName: 'Use .NET 7.0.100'
94+
displayName: Use .NET 7.0.100
9495
inputs:
9596
packageType: sdk
9697
version: 7.0.100
9798
installationPath: $(Build.SourcesDirectory)/.dotnet
9899

99100
- task: UseDotNet@2
100-
displayName: 'Use .NET 7.0.200'
101+
displayName: Use .NET 7.0.200
101102
inputs:
102103
packageType: sdk
103104
version: 7.0.200
104105
installationPath: $(Build.SourcesDirectory)/.dotnet
105106

106107
- task: UseDotNet@2
107-
displayName: 'Use .NET 8.0.200'
108+
displayName: Use .NET 8.0.200
108109
inputs:
109110
packageType: sdk
110111
version: 8.0.200
@@ -131,51 +132,37 @@ extends:
131132
displayName: Run Cache Updater
132133
133134
- task: CopyFiles@2
135+
displayName: Copy artifacts to publish
134136
inputs:
135137
SourceFolder: $(System.DefaultWorkingDirectory)/NugetDownloadDirectory/SearchCache/
136138
Contents: |
137139
NuGetTemplateSearchInfo*.json
138140
nonTemplatePacks.json
139141
TargetFolder: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
140-
- ${{ if eq(parameters.publishToBlob, true) }}:
141-
- script: '$(Build.SourcesDirectory)/eng/SearchCache/InstallAzureCLI.sh'
142-
displayName: Install Azure CLI
143-
144-
- bash: az config set extension.use_dynamic_install=yes_without_prompt
145-
displayName: Disable Azure CLI prompts
146-
147-
- bash: >
148-
az storage azcopy blob upload
149-
-c $(CacheFileStorageContainer)
150-
--account-name $(CacheFileStorageAccount)
151-
-s '$(System.DefaultWorkingDirectory)/ArtifactsToPublish/NuGetTemplateSearchInfoVer2.json'
152-
--sas-token "$(CacheFileStorageSasToken)"
153-
-d NuGetTemplateSearchInfoVer2.json
154-
--verbose
155-
| tee upload.log
156-
&& grep ".*Number of Transfers Completed: 1" upload.log || (echo ; echo "Cache file upload failed"; false)
157-
displayName: Upload to blob storage
158142

159-
- bash: >
160-
az storage azcopy blob upload
161-
-c $(LegacyCacheFileStorageContainer)
162-
--account-name $(LegacyCacheFileStorageAccount)
163-
-s '$(System.DefaultWorkingDirectory)/ArtifactsToPublish/NuGetTemplateSearchInfo.json'
164-
--sas-token "$(LegacyCacheFileStorageSasToken)"
165-
-d NuGetTemplateSearchInfo.json
166-
--verbose
167-
| tee upload-legacy.log
168-
&& grep ".*Number of Transfers Completed: 1" upload-legacy.log || (echo ; echo "Legacy cache file upload failed"; false)
169-
displayName: Upload legacy file to blob storage
170-
171-
- bash: >
172-
az storage azcopy blob upload
173-
-c $(NonTemplatePacksFileStorageContainer)
174-
--account-name $(NonTemplatePacksFileStorageAccount)
175-
-s '$(System.DefaultWorkingDirectory)/ArtifactsToPublish/nonTemplatePacks.json'
176-
--sas-token "$(NonTemplatePacksFileStorageSasToken)"
177-
-d nonTemplatePacks.json
178-
--verbose
179-
| tee upload-non-template-packs.log
180-
&& grep ".*Number of Transfers Completed: 1" upload-non-template-packs.log || (echo ; echo "Legacy cache file upload failed"; false)
181-
displayName: Upload non template packages file to blob storage
143+
- ${{ if eq(parameters.publishToBlob, true) }}:
144+
# An entirely separate job is required to run AzureFileCopy@6, which is a Windows-only task.
145+
# If the Create job was rewritten to use PowerShell instead of Bash, Create and Publish could be combined into a single Windows job.
146+
- job: Publish
147+
dependsOn: Create
148+
pool:
149+
name: $(DncEngInternalBuildPool)
150+
image: 1es-windows-2022
151+
os: windows
152+
templateContext:
153+
inputs:
154+
- input: pipelineArtifact
155+
targetPath: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/
156+
artifactName: ArtifactsToPublish
157+
158+
steps:
159+
- task: AzureFileCopy@6
160+
displayName: Upload to blob storage
161+
inputs:
162+
SourcePath: $(System.DefaultWorkingDirectory)/ArtifactsToPublish/*.json
163+
# Service connection: https://dnceng.visualstudio.com/internal/_settings/adminservices?resourceId=010b0bdc-9487-484f-af2d-ca3ae3235b84
164+
azureSubscription: DOTNET-Templating - PME
165+
Destination: AzureBlob
166+
# These variables are defined in the pipeline's Variables UI.
167+
storage: $(CacheFileStorageAccount)
168+
ContainerName: $(CacheFileStorageContainer)

0 commit comments

Comments
 (0)