Skip to content

Commit 8e33312

Browse files
authored
Add PublishPrebuiltReportData target to make rolling build prebuilt data available (#873)
1 parent 8e23f00 commit 8e33312

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.vsts.pipelines/jobs/ci-linux.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,15 @@ jobs:
195195
ArtifactName: Tarball $(artifactName)
196196
ArtifactType: Container
197197

198+
# Publish prebuilt report data to blob storage.
199+
- template: ../steps/publish-prebuilt-data-sh.yml
200+
parameters:
201+
relativeBlobPath: prebuilt-data/$(Build.SourceBranchName)/latest/$(artifactName)
202+
# Also publish per-build data to a unique location for future use.
203+
- template: ../steps/publish-prebuilt-data-sh.yml
204+
parameters:
205+
relativeBlobPath: prebuilt-data/$(Build.SourceBranchName)/rolling/$(Build.SourceVersion)/$(Build.BuildNumber)/$(Build.DefinitionName)/$(artifactName)
206+
198207
# Clean up (very large) working directory. root owner makes it difficult for others to remove.
199208
- script: $(docker.run) $(docker.root.map) $(imageName) bash -c 'rm -rf /root/sb'
200209
displayName: Clean sb directory
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parameters:
2+
relativeBlobPath: ''
3+
4+
steps:
5+
- script: |
6+
set -x
7+
# Publish tarball's prebuilt data. Use ./build.sh from production build.
8+
$(docker.run) $(docker.tb.map) $(docker.src.map) $(docker.src.work) $(imageName) ./build.sh \
9+
/t:PublishPrebuiltReportData \
10+
/p:ProjectDir=/tb/$(tarballName)/ \
11+
"/p:RelativeBlobPath=$relativeBlobPath" \
12+
/p:ContainerName=$(publish.blobStorage.container) \
13+
/p:AzureAccountName=$(publish.blobStorage.account) \
14+
/p:AzureAccessToken=$(publish.blobStorage.accessToken) \
15+
/clp:v=D
16+
displayName: ${{ format('Publish prebuilt report data ({0})', parameters.relativeBlobPath) }}
17+
env:
18+
relativeBlobPath: ${{ parameters.relativeBlobPath }}
19+
condition: and(succeeded(), ne(variables['publish.blobStorage.accessToken'], ''), eq(variables['sb.tarball'], true))

build.proj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,30 @@
137137
EnvironmentVariables="prodConBlobFeedUrl=$(ProdConBlobFeedUrl)" />
138138
</Target>
139139

140+
<UsingTask AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.CloudTestTasks.dll" TaskName="UploadToAzure" />
141+
142+
<Target Name="PublishPrebuiltReportData">
143+
<Error Text="RelativeBlobPath must be set to a non-empty string." Condition="'$(RelativeBlobPath)' == ''" />
144+
<Error Text="ContainerName must be set to a non-empty string." Condition="'$(ContainerName)' == ''" />
145+
<Error Text="AzureAccountName must be set to a non-empty string." Condition="'$(AzureAccountName)' == ''" />
146+
<Error Text="AzureAccessToken must be set to a non-empty string." Condition="'$(AzureAccessToken)' == ''" />
147+
148+
<ItemGroup>
149+
<ItemsToPublish Include="$(PackageReportDir)*.xml" />
150+
<ItemsToPublish>
151+
<RelativeBlobPath>$(RelativeBlobPath)/%(Filename)%(Extension)</RelativeBlobPath>
152+
</ItemsToPublish>
153+
</ItemGroup>
154+
155+
<Message Text="Uploading files to '$(AzureAccountName)' blob storage at $(ContainerName)/$(RelativeBlobPath)" />
156+
157+
<UploadToAzure AccountName="$(AzureAccountName)"
158+
AccountKey="$(AzureAccessToken)"
159+
ContainerName="$(ContainerName)"
160+
Items="@(ItemsToPublish)"
161+
Overwrite="true" />
162+
</Target>
163+
140164
<Import Project="$(ProjectDir)dependencies.targets" />
141165

142166
<Import Project="$(ToolsDir)VersionTools.targets" />

0 commit comments

Comments
 (0)