@@ -6,191 +6,202 @@ schedules:
6
6
- main
7
7
always : true
8
8
9
-
10
- jobs :
11
- - job : BuildIndex
12
- displayName : Build Source Index
13
-
14
- pool :
15
- name : NetCore1ESPool-Internal-XL
16
- demands : ImageOverride -equals 1es-windows-2022
17
-
18
- timeoutInMinutes : 360
19
-
20
- variables :
21
- - group : source-dot-net stage1 variables
22
-
23
- steps :
24
- - checkout : self
25
- clean : true
26
- submodules : true
27
-
28
- - task : DeleteFiles@1
29
- displayName : Delete files from bin
30
- inputs :
31
- SourceFolder : bin
32
- Contents : ' **/*'
33
-
34
- - task : UseDotNet@2
35
- displayName : Install .NET Sdk
36
- inputs :
37
- useGlobalJson : true
38
-
39
- - task : DotNetCoreCLI@2
40
- displayName : dotnet restore
41
- inputs :
42
- command : custom
43
- custom : restore
44
- projects : |
45
- **\*.sln
46
-
47
- - task : DotNetCoreCLI@2
48
- displayName : dotnet build
49
- inputs :
50
- command : ' build'
51
- projects : |
52
- src\source-indexer.sln
53
- src\SourceBrowser\SourceBrowser.sln
54
- arguments : ' /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)/packages'
55
-
56
- - task : ComponentGovernanceComponentDetection@0
57
-
58
- - task : NuGetCommand@2
59
- displayName : NuGet push
60
- inputs :
61
- command : ' push'
62
- packagesToPush : ' $(Build.ArtifactStagingDirectory)/packages/*.nupkg'
63
- nuGetFeedType : ' internal'
64
- publishVstsFeed : ' 9ee6d478-d288-47f7-aacc-f6e6d082ae6d/d1622942-d16f-48e5-bc83-96f4539e7601'
65
-
66
- - task : VSBuild@1
67
- displayName : Clone All Repositories
68
- inputs :
69
- solution : build.proj
70
- msbuildArgs : /t:Clone /v:n /bl:$(Build.ArtifactStagingDirectory)/logs/clone.binlog
71
- msbuildArchitecture : x64
72
- env :
73
- source-dot-net-stage1-blob-container-url : $(source-dot-net-stage1-blob-container-url)
74
-
75
- - task : VSBuild@1
76
- displayName : Prepare All Repositories
77
- inputs :
78
- solution : build.proj
79
- msbuildArgs : /t:Prepare /v:n /bl:$(Build.ArtifactStagingDirectory)/logs/prepare.binlog
80
- msbuildArchitecture : x64
81
-
82
- - task : VSBuild@1
83
- displayName : Build source index
84
- inputs :
85
- solution : build.proj
86
- msbuildArgs : /t:BuildIndex /v:n /bl:$(Build.ArtifactStagingDirectory)/logs/build.binlog
87
- msbuildArchitecture : x64
88
-
89
- - task : CopyFiles@2
90
- inputs :
91
- sourceFolder : bin/index/
92
- contents : |
93
- **
94
- !index/**
95
- targetFolder : bin/index-stage/
96
- cleanTargetFolder : true
97
-
98
- - powershell : deployment/normalize-case.ps1 -Root bin/index/index/
99
- displayName : Normalize Case Of Index Files
100
-
101
- - task : AzureCLI@2
102
- displayName : Upload Index to Azure Storage
103
- inputs :
104
- azureSubscription : SourceDotNet-Deployment-ARM
105
- scriptLocation : inlineScript
106
- scriptType : ps
107
- inlineScript : >
108
- deployment/upload-index-to-container.ps1
109
- -StorageAccountName netsourceindex
110
- -IndexSource bin/index/index/
111
- -OutFile bin/index.url
112
-
113
- - task : AzureRmWebAppDeployment@4
114
- displayName : ' Azure App Service Deploy: netsourceindex'
115
- inputs :
116
- ConnectionType : AzureRM
117
- azureSubscription : SourceDotNet-Deployment-ARM
118
- appType : webApp
119
- WebAppName : netsourceindex
120
- ResourceGroupName : source.dot.net
121
- deployToSlotOrASE : true
122
- SlotName : staging
123
- packageForLinux : bin/index-stage/
124
- enableCustomDeployment : true
125
- DeploymentType : zipDeploy
126
- RemoveAdditionalFilesFlag : true
127
-
128
- - task : AzureCLI@2
129
- displayName : Deploy Storage Proxy Url to WebApp
130
- inputs :
131
- azureSubscription : SourceDotNet-Deployment-ARM
132
- scriptLocation : inlineScript
133
- scriptType : ps
134
- inlineScript : >
135
- deployment/deploy-storage-proxy.ps1
136
- -ProxyUrlFile bin/index.url
137
- -ResourceGroup source.dot.net
138
- -WebappName netsourceindex
139
- -Slot staging
140
-
141
- - task : AzureCLI@2
142
- displayName : Restart WebApp
143
- inputs :
144
- azureSubscription : SourceDotNet-Deployment-ARM
145
- scriptLocation : inlineScript
146
- scriptType : ps
147
- inlineScript : >
148
- az webapp restart --name netsourceindex --slot staging --resource-group source.dot.net
149
-
150
- - pwsh : |
151
- Start-Sleep 60
152
- $urls = @(
153
- "https://netsourceindex-staging.azurewebsites.net",
154
- "https://netsourceindex-staging.azurewebsites.net/System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/String.cs.html"
155
- )
156
- foreach ($url in $urls) {
157
- $statusCode = Invoke-WebRequest $url -UseBasicParsing -SkipHttpErrorCheck | select -ExpandProperty StatusCode
158
- if ($statusCode -ne 200) {
159
- Write-Host "##vso[task.logissue type=error;]Deployed website returned undexpected status code $statusCode from url $url"
160
- Write-Host "##vso[task.complete result=Failed;]Deployed website returned undexpected status code $statusCode from url $url"
161
- }
162
- }
163
- displayName: Test Deployed WebApp
164
-
165
- - task : AzureCLI@2
166
- displayName : Swap Staging Slot into Production
167
- inputs :
168
- azureSubscription : SourceDotNet-Deployment-ARM
169
- scriptLocation : inlineScript
170
- scriptType : ps
171
- inlineScript : >
172
- az webapp deployment slot swap
173
- --resource-group source.dot.net
174
- --name netsourceindex
175
- --slot staging
176
- --target-slot production
177
-
178
- - task : AzureCLI@2
179
- displayName : Cleanup Old Storage Containers
180
- inputs :
181
- azureSubscription : SourceDotNet-Deployment-ARM
182
- scriptLocation : inlineScript
183
- scriptType : ps
184
- inlineScript : >
185
- deployment/cleanup-old-containers.ps1
186
- -ResourceGroup source.dot.net
187
- -WebappName netsourceindex
188
- -StorageAccountName netsourceindex
189
-
190
- - publish : $(Build.ArtifactStagingDirectory)/logs
191
- artifact : logs
192
- condition : always()
193
-
194
- - publish : bin/repo
195
- artifact : repo-logs
196
- condition : always()
9
+ resources :
10
+ repositories :
11
+ - repository : 1ESPipelineTemplates
12
+ type : git
13
+ name : 1ESPipelineTemplates/1ESPipelineTemplates
14
+ ref : refs/tags/release
15
+
16
+ extends :
17
+ template : v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
18
+ parameters :
19
+ pool :
20
+ name : NetCore1ESPool-Internal-XL
21
+ image : 1es-windows-2022
22
+ os : windows
23
+ customBuildTags :
24
+ - ES365AIMigrationTooling
25
+ stages :
26
+ - stage : stage
27
+ jobs :
28
+ - job : BuildIndex
29
+ displayName : Build Source Index
30
+ timeoutInMinutes : 360
31
+
32
+ variables :
33
+ - group : source-dot-net stage1 variables
34
+
35
+ templateContext :
36
+ outputs :
37
+ - output : nuget
38
+ displayName : ' NuGet push'
39
+ packageParentPath : ' $(Build.ArtifactStagingDirectory)'
40
+ packagesToPush : ' $(Build.ArtifactStagingDirectory)/packages/*.nupkg'
41
+ nuGetFeedType : ' internal'
42
+ publishVstsFeed : ' 9ee6d478-d288-47f7-aacc-f6e6d082ae6d/d1622942-d16f-48e5-bc83-96f4539e7601'
43
+ - output : pipelineArtifact
44
+ condition : always()
45
+ targetPath : $(Build.ArtifactStagingDirectory)/logs
46
+ artifactName : logs
47
+ - output : pipelineArtifact
48
+ condition : always()
49
+ targetPath : bin/repo
50
+ artifactName : repo-logs
51
+
52
+ steps :
53
+ - checkout : self
54
+ clean : true
55
+ submodules : true
56
+
57
+ - task : DeleteFiles@1
58
+ displayName : Delete files from bin
59
+ inputs :
60
+ SourceFolder : bin
61
+ Contents : ' **/*'
62
+
63
+ - task : UseDotNet@2
64
+ displayName : Install .NET Sdk
65
+ inputs :
66
+ useGlobalJson : true
67
+
68
+ - task : DotNetCoreCLI@2
69
+ displayName : dotnet restore
70
+ inputs :
71
+ command : custom
72
+ custom : restore
73
+ projects : |
74
+ **\*.sln
75
+
76
+ - task : DotNetCoreCLI@2
77
+ displayName : dotnet build
78
+ inputs :
79
+ command : ' build'
80
+ projects : |
81
+ src\source-indexer.sln
82
+ src\SourceBrowser\SourceBrowser.sln
83
+ arguments : ' /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)/packages'
84
+
85
+ - task : VSBuild@1
86
+ displayName : Clone All Repositories
87
+ inputs :
88
+ solution : build.proj
89
+ msbuildArgs : /t:Clone /v:n /bl:$(Build.ArtifactStagingDirectory)/logs/clone.binlog
90
+ msbuildArchitecture : x64
91
+ env :
92
+ source-dot-net-stage1-blob-container-url : $(source-dot-net-stage1-blob-container-url)
93
+
94
+ - task : VSBuild@1
95
+ displayName : Prepare All Repositories
96
+ inputs :
97
+ solution : build.proj
98
+ msbuildArgs : /t:Prepare /v:n /bl:$(Build.ArtifactStagingDirectory)/logs/prepare.binlog
99
+ msbuildArchitecture : x64
100
+
101
+ - task : VSBuild@1
102
+ displayName : Build source index
103
+ inputs :
104
+ solution : build.proj
105
+ msbuildArgs : /t:BuildIndex /v:n /bl:$(Build.ArtifactStagingDirectory)/logs/build.binlog
106
+ msbuildArchitecture : x64
107
+
108
+ - task : CopyFiles@2
109
+ inputs :
110
+ sourceFolder : bin/index/
111
+ contents : |
112
+ **
113
+ !index/**
114
+ targetFolder : bin/index-stage/
115
+ cleanTargetFolder : true
116
+
117
+ - powershell : deployment/normalize-case.ps1 -Root bin/index/index/
118
+ displayName : Normalize Case Of Index Files
119
+
120
+ - task : AzureCLI@2
121
+ displayName : Upload Index to Azure Storage
122
+ inputs :
123
+ azureSubscription : SourceDotNet-Deployment-ARM
124
+ scriptLocation : inlineScript
125
+ scriptType : ps
126
+ inlineScript : >
127
+ deployment/upload-index-to-container.ps1
128
+ -StorageAccountName netsourceindex
129
+ -IndexSource bin/index/index/
130
+ -OutFile bin/index.url
131
+
132
+ - task : AzureRmWebAppDeployment@4
133
+ displayName : ' Azure App Service Deploy: netsourceindex'
134
+ inputs :
135
+ ConnectionType : AzureRM
136
+ azureSubscription : SourceDotNet-Deployment-ARM
137
+ appType : webApp
138
+ WebAppName : netsourceindex
139
+ ResourceGroupName : source.dot.net
140
+ deployToSlotOrASE : true
141
+ SlotName : staging
142
+ packageForLinux : bin/index-stage/
143
+ enableCustomDeployment : true
144
+ DeploymentType : zipDeploy
145
+ RemoveAdditionalFilesFlag : true
146
+
147
+ - task : AzureCLI@2
148
+ displayName : Deploy Storage Proxy Url to WebApp
149
+ inputs :
150
+ azureSubscription : SourceDotNet-Deployment-ARM
151
+ scriptLocation : inlineScript
152
+ scriptType : ps
153
+ inlineScript : >
154
+ deployment/deploy-storage-proxy.ps1
155
+ -ProxyUrlFile bin/index.url
156
+ -ResourceGroup source.dot.net
157
+ -WebappName netsourceindex
158
+ -Slot staging
159
+
160
+ - task : AzureCLI@2
161
+ displayName : Restart WebApp
162
+ inputs :
163
+ azureSubscription : SourceDotNet-Deployment-ARM
164
+ scriptLocation : inlineScript
165
+ scriptType : ps
166
+ inlineScript : |
167
+ az webapp restart --name netsourceindex --slot staging --resource-group source.dot.net
168
+
169
+ - pwsh : |
170
+ Start-Sleep 60
171
+ $urls = @(
172
+ "https://netsourceindex-staging.azurewebsites.net",
173
+ "https://netsourceindex-staging.azurewebsites.net/System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/String.cs.html"
174
+ )
175
+ foreach ($url in $urls) {
176
+ $statusCode = Invoke-WebRequest $url -UseBasicParsing -SkipHttpErrorCheck | select -ExpandProperty StatusCode
177
+ if ($statusCode -ne 200) {
178
+ Write-Host "##vso[task.logissue type=error;]Deployed website returned undexpected status code $statusCode from url $url"
179
+ Write-Host "##vso[task.complete result=Failed;]Deployed website returned undexpected status code $statusCode from url $url"
180
+ }
181
+ }
182
+ displayName: Test Deployed WebApp
183
+
184
+ - task : AzureCLI@2
185
+ displayName : Swap Staging Slot into Production
186
+ inputs :
187
+ azureSubscription : SourceDotNet-Deployment-ARM
188
+ scriptLocation : inlineScript
189
+ scriptType : ps
190
+ inlineScript : >
191
+ az webapp deployment slot swap
192
+ --resource-group source.dot.net
193
+ --name netsourceindex
194
+ --slot staging
195
+ --target-slot production
196
+
197
+ - task : AzureCLI@2
198
+ displayName : Cleanup Old Storage Containers
199
+ inputs :
200
+ azureSubscription : SourceDotNet-Deployment-ARM
201
+ scriptLocation : inlineScript
202
+ scriptType : ps
203
+ inlineScript : >
204
+ deployment/cleanup-old-containers.ps1
205
+ -ResourceGroup source.dot.net
206
+ -WebappName netsourceindex
207
+ -StorageAccountName netsourceindex
0 commit comments