@@ -12,6 +12,7 @@ trigger:
1212 tags :
1313 include :
1414 - ' v*'
15+ - ' hidi-v*'
1516pr :
1617 branches :
1718 include :
@@ -54,6 +55,10 @@ extends:
5455 displayName : ' Publish Artifact: Nugets'
5556 artifactName : Nugets
5657 targetPath : ' $(Build.ArtifactStagingDirectory)'
58+ - output : pipelineArtifact
59+ displayName : ' Publish Artifact: Hidi Docker Context'
60+ artifactName : HidiDockerContext
61+ targetPath : ' $(Build.ArtifactStagingDirectory)\HidiDockerContext'
5762 steps :
5863
5964 - task : UseDotNet@2
@@ -66,6 +71,11 @@ extends:
6671 inputs :
6772 version : 8.x
6873
74+ - task : UseDotNet@2
75+ displayName : ' Use .NET 10'
76+ inputs :
77+ version : 10.x
78+
6979 # Install the nuget tool.
7080 - task : NuGetToolInstaller@1
7181 displayName : ' Use NuGet >=6.11.0'
@@ -96,12 +106,16 @@ extends:
96106
97107 # Run the Unit test
98108 - task : DotNetCoreCLI@2
99- displayName : ' test'
109+ displayName : ' test OData '
100110 inputs :
101111 command : test
102- projects : ' $(Build.SourcesDirectory)\Microsoft.OpenApi .OData.sln '
112+ projects : ' $(Build.SourcesDirectory)\test\ Microsoft.OpenAPI .OData.Reader.Tests\Microsoft.OpenAPI.OData.Reader.Tests.csproj '
103113 arguments : ' --configuration $(BuildConfiguration) --no-build'
104114
115+ - pwsh : dotnet test --configuration $(BuildConfiguration) --no-build
116+ workingDirectory : ' $(Build.SourcesDirectory)\test\Microsoft.OpenApi.Hidi.Tests'
117+ displayName : ' test Hidi'
118+
105119 - task : EsrpCodeSigning@6
106120 displayName : ' ESRP CodeSigning'
107121 inputs :
@@ -156,14 +170,21 @@ extends:
156170 MaxRetryAttempts : ' 5'
157171 PendingAnalysisWaitTimeoutMinutes : ' 5'
158172
159- # Pack
173+ # Pack OData
160174 - task : DotNetCoreCLI@2
161- displayName : ' pack'
175+ displayName : ' pack OData '
162176 inputs :
163177 command : pack
164178 projects : src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj
165179 arguments : ' -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg'
166180
181+ - task : DotNetCoreCLI@2
182+ displayName : ' pack Hidi'
183+ inputs :
184+ command : pack
185+ projects : src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
186+ arguments : ' -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg'
187+
167188 - task : EsrpCodeSigning@6
168189 displayName : ' ESRP CodeSigning Nuget Packages'
169190 inputs :
@@ -198,11 +219,93 @@ extends:
198219 MaxRetryAttempts : ' 5'
199220 PendingAnalysisWaitTimeoutMinutes : ' 5'
200221
222+ - task : DotNetCoreCLI@2
223+ displayName : ' publish Hidi as executable'
224+ inputs :
225+ command : publish
226+ projects : src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
227+ arguments : ' -c $(BuildConfiguration) --runtime win-x64 -p:RestoreConfigFile=$(Build.SourcesDirectory)\nuget.config /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)\Microsoft.OpenApi.Hidi'
228+ publishWebProjects : false
229+ zipAfterPublish : false
230+
231+ - task : EsrpCodeSigning@6
232+ displayName : ' ESRP CodeSigning Hidi executable'
233+ inputs :
234+ ConnectedServiceName : ' Federated DevX ESRP Managed Identity Connection'
235+ FolderPath : ' $(Build.ArtifactStagingDirectory)\Microsoft.OpenApi.Hidi'
236+ AppRegistrationClientId : ' 65035b7f-7357-4f29-bf25-c5ee5c3949f8'
237+ AppRegistrationTenantId : ' cdc5aeea-15c5-4db6-b079-fcadd2505dc2'
238+ AuthAKVName : ' akv-prod-eastus'
239+ AuthCertName : ' ReferenceLibraryPrivateCert'
240+ AuthSignCertName : ' ReferencePackagePublisherCertificate'
241+ signConfigType : inlineSignParams
242+ inlineOperation : |
243+ [
244+ {
245+ "keyCode": "CP-230012",
246+ "operationSetCode": "SigntoolSign",
247+ "parameters": [
248+ {
249+ "parameterName": "OpusName",
250+ "parameterValue": "Microsoft"
251+ },
252+ {
253+ "parameterName": "OpusInfo",
254+ "parameterValue": "http://www.microsoft.com"
255+ },
256+ {
257+ "parameterName": "FileDigest",
258+ "parameterValue": "/fd \"SHA256\""
259+ },
260+ {
261+ "parameterName": "PageHash",
262+ "parameterValue": "/NPH"
263+ },
264+ {
265+ "parameterName": "TimeStamp",
266+ "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
267+ }
268+ ],
269+ "toolName": "sign",
270+ "toolVersion": "1.0"
271+ },
272+ {
273+ "keyCode": "CP-230012",
274+ "operationSetCode": "SigntoolVerify",
275+ "parameters": [ ],
276+ "toolName": "sign",
277+ "toolVersion": "1.0"
278+ }
279+ ]
280+ SessionTimeout : ' 20'
281+ MaxConcurrency : ' 50'
282+ MaxRetryAttempts : ' 5'
283+ PendingAnalysisWaitTimeoutMinutes : ' 5'
284+
285+ - task : CopyFiles@2
286+ displayName : ' Prepare Hidi Docker context'
287+ inputs :
288+ SourceFolder : ' $(Build.SourcesDirectory)'
289+ Contents : |
290+ Dockerfile
291+ Directory.Build.props
292+ Build.props
293+ README.md
294+ src/Build.props
295+ src/Microsoft.OpenApi.Hidi/**
296+ src/Microsoft.OpenApi.OData.Reader/**
297+ tool/Microsoft.OpenApi.Hidi.snk
298+ tool/Microsoft.OpenApi.OData.snk
299+ !**/bin/**
300+ !**/obj/**
301+ TargetFolder : ' $(Build.ArtifactStagingDirectory)\HidiDockerContext'
302+
201303 - stage : deploy
202- condition : and(contains( variables['build.sourceBranch '], 'refs/tags/v'), succeeded())
304+ condition : and(or(startsWith( variables['Build.SourceBranch '], 'refs/tags/v'), startsWith(variables['Build.SourceBranch'], 'refs/tags/hidi-v'), eq(variables['Build.SourceBranch'], 'refs/heads/main') ), succeeded())
203305 dependsOn : build
204306 jobs :
205307 - deployment : deploy
308+ condition : and(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), succeeded())
206309 templateContext :
207310 type : releaseJob
208311 isProduction : true
@@ -225,7 +328,32 @@ extends:
225328 publishFeedCredentials : ' OpenAPI Nuget Connection'
226329 packageParentPath : ' $(Pipeline.Workspace)'
227330
331+ - deployment : deploy_hidi
332+ condition : and(startsWith(variables['Build.SourceBranch'], 'refs/tags/hidi-v'), succeeded())
333+ templateContext :
334+ type : releaseJob
335+ isProduction : true
336+ inputs :
337+ - input : pipelineArtifact
338+ artifactName : Nugets
339+ targetPath : ' $(Pipeline.Workspace)'
340+ environment : nuget-org
341+ strategy :
342+ runOnce :
343+ deploy :
344+ pool :
345+ vmImage : ubuntu-latest
346+ steps :
347+ - task : 1ES.PublishNuget@1
348+ displayName : ' NuGet push Hidi'
349+ inputs :
350+ packagesToPush : ' $(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg'
351+ nuGetFeedType : external
352+ publishFeedCredentials : ' OpenAPI Nuget Connection'
353+ packageParentPath : ' $(Pipeline.Workspace)'
354+
228355 - deployment : create_github_release
356+ condition : and(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), succeeded())
229357 templateContext :
230358 type : releaseJob
231359 isProduction : true
@@ -242,7 +370,7 @@ extends:
242370 vmImage : ubuntu-latest
243371 steps :
244372 - pwsh : |
245- $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1
373+ $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.OData. *.nupkg -recurse | select -First 1
246374 $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.OData.", "" -replace ".nupkg", ""
247375 #Set Variable $artifactName and $artifactVersion
248376 Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion"
@@ -258,5 +386,93 @@ extends:
258386 tag : ' v$(artifactVersion)'
259387 title : ' v$(artifactVersion)'
260388 releaseNotesSource : inline
261- assets : ' $(Pipeline.Workspace)\**\ *.nupkg'
389+ assets : ' $(Pipeline.Workspace)/**/Microsoft.OpenApi.OData. *.nupkg'
262390 addChangeLog : false
391+
392+ - deployment : create_hidi_github_release
393+ condition : and(startsWith(variables['Build.SourceBranch'], 'refs/tags/hidi-v'), succeeded())
394+ templateContext :
395+ type : releaseJob
396+ isProduction : true
397+ inputs :
398+ - input : pipelineArtifact
399+ artifactName : Nugets
400+ targetPath : ' $(Pipeline.Workspace)'
401+ dependsOn : []
402+ environment : kiota-github-releases
403+ strategy :
404+ runOnce :
405+ deploy :
406+ pool :
407+ vmImage : ubuntu-latest
408+ steps :
409+ - pwsh : |
410+ $version = "$(Build.SourceBranch)" -replace "^refs/tags/hidi-v", ""
411+ Write-Host "##vso[task.setvariable variable=hidiVersion;isSecret=false]$version"
412+ displayName: 'Read Hidi version from tag'
413+ - task : GitHubRelease@1
414+ displayName : ' GitHub release Hidi'
415+ inputs :
416+ gitHubConnection : ' Github-MaggieKimani1'
417+ action : edit
418+ tagSource : userSpecifiedTag
419+ tag : ' hidi-v$(hidiVersion)'
420+ title : ' Hidi v$(hidiVersion)'
421+ releaseNotesSource : inline
422+ assets : |
423+ $(Pipeline.Workspace)/**/Microsoft.OpenApi.Hidi.*.nupkg
424+ $(Pipeline.Workspace)/**/Microsoft.OpenApi.Hidi/**
425+ addChangeLog : false
426+
427+ - deployment : deploy_hidi_docker
428+ condition : and(or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/hidi-v')), succeeded())
429+ templateContext :
430+ type : releaseJob
431+ isProduction : true
432+ inputs :
433+ - input : pipelineArtifact
434+ artifactName : HidiDockerContext
435+ targetPath : ' $(Pipeline.Workspace)/HidiDockerContext'
436+ environment : docker-images-deploy
437+ strategy :
438+ runOnce :
439+ deploy :
440+ pool :
441+ vmImage : ubuntu-latest
442+ steps :
443+ - task : AzureCLI@2
444+ displayName : ' Login to Azure Container Registry'
445+ inputs :
446+ azureSubscription : ' ACR Images Push Service Connection'
447+ scriptType : bash
448+ scriptLocation : inlineScript
449+ inlineScript : az acr login --name msgraphprodregistry.azurecr.io
450+ - bash : |
451+ docker run --privileged --rm msgraphprodregistry.azurecr.io/tonistiigi/binfmt --install all
452+ docker buildx create --use --name hidi-builder
453+ docker buildx inspect --bootstrap
454+ displayName: 'Configure multi-platform build'
455+ - bash : |
456+ version=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | head -1)
457+ runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$')
458+ docker buildx build \
459+ --platform linux/amd64,linux/arm64/v8 \
460+ --push \
461+ -t "msgraphprodregistry.azurecr.io/public/openapi/hidi:nightly" \
462+ -t "msgraphprodregistry.azurecr.io/public/openapi/hidi:${version}.$(date +'%Y%m%d')${runnumber}" \
463+ .
464+ workingDirectory: '$(Pipeline.Workspace)/HidiDockerContext'
465+ displayName: 'Build and push Hidi nightly image'
466+ condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
467+ - bash : |
468+ version="$(Build.SourceBranch)"
469+ version="${version#refs/tags/hidi-v}"
470+ docker buildx build \
471+ --platform linux/amd64,linux/arm64/v8 \
472+ --push \
473+ -t "msgraphprodregistry.azurecr.io/public/openapi/hidi:latest" \
474+ -t "msgraphprodregistry.azurecr.io/public/openapi/hidi:${version}" \
475+ .
476+ workingDirectory: '$(Pipeline.Workspace)/HidiDockerContext'
477+ displayName: 'Build and push Hidi release image'
478+ condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/hidi-v')
0 commit comments