Skip to content

Commit b5736df

Browse files
committed
fix(ci): hand off hidi Docker context through a pipeline artifact
Stage only required hidi and OData sources, build files, and public signing keys. Consume the context without release checkout and use the existing protected Docker deployment environment. Keep publishing disabled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7410eba7-e02c-4628-aeb3-dca59d99f3f1
1 parent 516f5b5 commit b5736df

2 files changed

Lines changed: 43 additions & 4 deletions

File tree

‎.azure-pipelines/hidi-release.yml‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,34 @@ extends:
4343
- output: pipelineArtifact
4444
artifactName: Hidi
4545
targetPath: '$(Build.ArtifactStagingDirectory)\hidi'
46+
- output: pipelineArtifact
47+
artifactName: HidiDockerContext
48+
targetPath: '$(Build.ArtifactStagingDirectory)\HidiDockerContext'
4649
steps:
50+
- task: CopyFiles@2
51+
displayName: Stage public-only hidi Docker context
52+
inputs:
53+
SourceFolder: '$(Build.SourcesDirectory)'
54+
Contents: |
55+
src\Microsoft.OpenApi.Hidi\**
56+
src\Microsoft.OpenApi.OData.Reader\**
57+
src\Build.props
58+
Build.props
59+
Directory.Build.props
60+
global.json
61+
build.root
62+
README.md
63+
Dockerfile
64+
.dockerignore
65+
!**\bin\**
66+
!**\obj\**
67+
!**\.git\**
68+
!**\artifacts\**
69+
!**\*.snk
70+
tool\Microsoft.OpenApi.Hidi.public.snk
71+
tool\Microsoft.OpenApi.OData.public.snk
72+
TargetFolder: '$(Build.ArtifactStagingDirectory)\HidiDockerContext'
73+
CleanTargetFolder: true
4774
- task: UseDotNet@2
4875
displayName: Use .NET 6 for ESRP
4976
inputs:
@@ -221,16 +248,19 @@ extends:
221248
templateContext:
222249
type: releaseJob
223250
isProduction: true
224-
environment: hidi-container
251+
inputs:
252+
- input: pipelineArtifact
253+
artifactName: HidiDockerContext
254+
targetPath: '$(Pipeline.Workspace)/HidiDockerContext'
255+
environment: docker-images-deploy
225256
strategy:
226257
runOnce:
227258
deploy:
228259
pool:
229260
vmImage: ubuntu-latest
230261
steps:
231-
- checkout: self
232262
- pwsh: |
233-
$version = ([xml](Get-Content src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version
263+
$version = ([xml](Get-Content -LiteralPath '$(Pipeline.Workspace)/HidiDockerContext/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj')).Project.PropertyGroup.Version
234264
if ('$(Build.SourceBranch)' -ne "refs/tags/hidi-v$version") { throw "Hidi tag does not match project version." }
235265
if ([version]($version -split '-')[0] -le [version]'2.12.2') { throw "Do not republish the migration baseline or an older hidi version." }
236266
Write-Host "##vso[task.setvariable variable=HidiReleaseVersion]$version"
@@ -241,12 +271,14 @@ extends:
241271
azureSubscription: ACR Images Push Service Connection
242272
scriptType: bash
243273
scriptLocation: inlineScript
274+
workingDirectory: '$(Pipeline.Workspace)/HidiDockerContext'
244275
inlineScript: |
245276
set -euo pipefail
246277
az acr login --name msgraphprodregistry
247278
docker run --privileged --rm tonistiigi/binfmt --install all
248279
docker buildx create --use
249280
docker buildx build --platform linux/amd64,linux/arm64/v8 \
281+
--file "$(Pipeline.Workspace)/HidiDockerContext/Dockerfile" \
250282
--tag "msgraphprodregistry.azurecr.io/public/openapi/hidi:$(HidiReleaseVersion)" \
251283
--tag "msgraphprodregistry.azurecr.io/public/openapi/hidi:latest" \
252-
--push .
284+
--push "$(Pipeline.Workspace)/HidiDockerContext"

‎src/Microsoft.OpenApi.Hidi/readme.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ Docker builds opt into `HidiPublicSignBuild=true` for the local OData project,
7979
using its own public-only key without changing normal OData signing behavior.
8080
Private `.snk` resources are excluded from the Docker context.
8181

82+
The official pipeline stages a separate `HidiDockerContext` pipeline artifact
83+
in the build job. It contains only the hidi and OData reader sources, required
84+
build and Docker files, and the two public-only signing keys; build outputs and
85+
private keys are excluded. The container release job consumes this artifact as
86+
a 1ES input without checking out the repository. NuGet and Windows release
87+
artifacts continue to use the separate `Hidi` artifact.
88+
8289
The gated official pipeline retains the consumer image
8390
`mcr.microsoft.com/openapi/hidi`, backed by
8491
`msgraphprodregistry.azurecr.io/public/openapi/hidi`. Stable images use `latest`

0 commit comments

Comments
 (0)