diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 9521826f..12561818 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -11,7 +11,7 @@ trigger: - support/v2 tags: include: - - 'v*' + - 'v3.*' pr: branches: include: @@ -56,6 +56,18 @@ extends: targetPath: '$(Build.ArtifactStagingDirectory)' steps: + - pwsh: | + $ErrorActionPreference = 'Stop' + $version = ([xml](Get-Content Directory.Build.props)).Project.PropertyGroup.Version + if ($env:BUILD_SOURCEBRANCH -like 'refs/tags/*') { + if ($env:BUILD_SOURCEBRANCH -cnotmatch '^refs/tags/v(3\.\d+\.\d+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)$') { + throw "Expected an OData v3.x release tag, got $env:BUILD_SOURCEBRANCH." + } + if ($Matches[1] -cne $version) { throw "OData tag must exactly match Directory.Build.props version $version." } + } + Write-Host "##vso[task.setvariable variable=ODataVersion]$version" + displayName: 'Validate OData component tag and project version' + - task: UseDotNet@2 displayName: 'Use .NET 6' # needed for ESRP signing inputs: @@ -173,8 +185,13 @@ extends: displayName: 'pack' inputs: command: pack - projects: src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj - arguments: '-o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg' + packagesToPack: src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj + configuration: '$(BuildConfiguration)' + packDirectory: '$(Build.ArtifactStagingDirectory)' + nobuild: true + includesymbols: true + includesource: true + buildProperties: 'SymbolPackageFormat=snupkg' - task: EsrpCodeSigning@6 displayName: 'ESRP CodeSigning Nuget Packages' @@ -186,7 +203,7 @@ extends: AuthAKVName: 'akv-prod-eastus' AuthCertName: 'ReferenceLibraryPrivateCert' AuthSignCertName: 'ReferencePackagePublisherCertificate' - Pattern: '*.nupkg' + Pattern: 'Microsoft.OpenApi.OData.$(ODataVersion).nupkg' signConfigType: inlineSignParams inlineOperation: | [ @@ -211,7 +228,7 @@ extends: PendingAnalysisWaitTimeoutMinutes: '5' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()) + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v3.')) dependsOn: build jobs: - deployment: deploy @@ -229,10 +246,20 @@ extends: pool: vmImage: ubuntu-latest steps: + - pwsh: | + $ErrorActionPreference = 'Stop' + if ($env:BUILD_SOURCEBRANCH -cnotmatch '^refs/tags/v(3\.\d+\.\d+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)$') { + throw "Expected an OData v3.x release tag, got $env:BUILD_SOURCEBRANCH." + } + $version = $Matches[1] + $packages = @(Get-ChildItem -LiteralPath '$(Pipeline.Workspace)' -Recurse -File -Filter "Microsoft.OpenApi.OData.$version.nupkg") + if ($packages.Count -ne 1) { throw "Expected exactly one OData package matching tag version $version." } + Write-Host "##vso[task.setvariable variable=ODataPackagePath]$($packages[0].FullName)" + displayName: 'Verify exact OData release package' - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.OData.*.nupkg' + packagesToPush: '$(ODataPackagePath)' nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' packageParentPath: '$(Pipeline.Workspace)' @@ -254,21 +281,25 @@ extends: vmImage: ubuntu-latest steps: - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.OData.*.nupkg -recurse | select -First 1 - $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.OData.", "" -replace ".nupkg", "" - #Set Variable $artifactName and $artifactVersion - Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - echo "$artifactVersion" - displayName: 'Fetch Artifact Name' + $ErrorActionPreference = 'Stop' + if ($env:BUILD_SOURCEBRANCH -cnotmatch '^refs/tags/v(3\.\d+\.\d+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)$') { + throw "Expected an OData v3.x release tag, got $env:BUILD_SOURCEBRANCH." + } + $version = $Matches[1] + $packages = @(Get-ChildItem -LiteralPath '$(Pipeline.Workspace)' -Recurse -File -Filter "Microsoft.OpenApi.OData.$version.nupkg") + if ($packages.Count -ne 1) { throw "Expected exactly one OData package matching tag version $version." } + Write-Host "##vso[task.setvariable variable=ODataReleaseVersion]$version" + Write-Host "##vso[task.setvariable variable=ODataPackagePath]$($packages[0].FullName)" + displayName: 'Verify OData tag and exact GitHub release asset' - task: GitHubRelease@1 displayName: 'GitHub release' - condition: succeededOrFailed() + condition: succeeded() inputs: gitHubConnection: 'Github-MaggieKimani1' action: edit tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)' - title: 'v$(artifactVersion)' + tag: 'v$(ODataReleaseVersion)' + title: 'v$(ODataReleaseVersion)' releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\Microsoft.OpenApi.OData.*.nupkg' + assets: '$(ODataPackagePath)' addChangeLog: false diff --git a/.azure-pipelines/hidi-release.yml b/.azure-pipelines/hidi-release.yml index 9094e5dd..5329000f 100644 --- a/.azure-pipelines/hidi-release.yml +++ b/.azure-pipelines/hidi-release.yml @@ -50,6 +50,15 @@ extends: artifactName: HidiDockerContext targetPath: '$(Build.ArtifactStagingDirectory)\hidi-docker-context' steps: + - pwsh: | + $ErrorActionPreference = 'Stop' + $version = ([xml](Get-Content src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version + if ($version -cnotmatch '^3\.\d+\.\d+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?$') { throw "Expected a hidi 3.x version, got $version." } + if ($env:BUILD_SOURCEBRANCH -like 'refs/tags/*' -and $env:BUILD_SOURCEBRANCH -cne "refs/tags/hidi-v$version") { + throw "Hidi tag must exactly match the hidi project version." + } + Write-Host "##vso[task.setvariable variable=HidiVersion]$version" + displayName: Validate Hidi component tag and project version - task: UseDotNet@2 displayName: Use .NET 6 for ESRP inputs: @@ -123,12 +132,7 @@ extends: } displayName: Stage public-only hidi Docker context - pwsh: | - $version = ([xml](Get-Content src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version - if ($version -notmatch '^3\.\d+\.\d+(-[0-9A-Za-z.-]+)?$') { throw "Expected a hidi 3.x version, got $version." } - if ('$(Build.SourceBranch)' -like 'refs/tags/*' -and '$(Build.SourceBranch)' -ne "refs/tags/hidi-v$version") { - throw "Hidi tag must exactly match the hidi project version." - } - Write-Host "##vso[task.setvariable variable=HidiVersion]$version" + $ErrorActionPreference = 'Stop' dotnet build src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c $(buildConfiguration) -p:GeneratePackageOnBuild=false if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c $(buildConfiguration) -- --minimum-expected-tests 1 @@ -246,12 +250,19 @@ extends: deploy: steps: - pwsh: | - $tag = '$(Build.SourceBranch)' -replace '^refs/tags/hidi-v', '' + $ErrorActionPreference = 'Stop' + if ($env:BUILD_SOURCEBRANCH -cnotmatch '^refs/tags/hidi-v(3\.\d+\.\d+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)$') { + throw "Expected a hidi-v3.x release tag, got $env:BUILD_SOURCEBRANCH." + } + $tag = $Matches[1] if ([version]($tag -split '-')[0] -le [version]'3.10.2') { throw "Never republish the source migration baseline or an older hidi version." } $package = "$(Pipeline.Workspace)\hidi\Microsoft.OpenApi.Hidi.$tag.nupkg" - if (-not (Test-Path $package)) { throw "Missing exact hidi package: $package" } + if (-not (Test-Path -LiteralPath $package -PathType Leaf)) { throw "Missing exact hidi package: $package" } $symbols = "$(Pipeline.Workspace)\hidi\Microsoft.OpenApi.Hidi.$tag.snupkg" - if (-not (Test-Path $symbols)) { throw "Missing exact hidi symbols: $symbols" } + if (-not (Test-Path -LiteralPath $symbols -PathType Leaf)) { throw "Missing exact hidi symbols: $symbols" } + foreach ($asset in @("$(Pipeline.Workspace)\hidi\Microsoft.OpenApi.Hidi.exe", "$(Pipeline.Workspace)\hidi\hidi-win-x64-$tag.zip")) { + if (-not (Test-Path -LiteralPath $asset -PathType Leaf)) { throw "Missing exact hidi release asset: $asset" } + } Write-Host "##vso[task.setvariable variable=HidiReleaseVersion]$tag" displayName: Verify new hidi release version and exact package - task: PowerShell@2 @@ -323,8 +334,10 @@ extends: vmImage: ubuntu-latest steps: - pwsh: | + $ErrorActionPreference = 'Stop' $version = ([xml](Get-Content src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version - if ('$(Build.SourceBranch)' -ne "refs/tags/hidi-v$version") { throw "Hidi tag does not match project version." } + if ($version -cnotmatch '^3\.\d+\.\d+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?$') { throw "Expected a hidi 3.x version, got $version." } + if ($env:BUILD_SOURCEBRANCH -cne "refs/tags/hidi-v$version") { throw "Hidi tag does not match project version." } if ([version]($version -split '-')[0] -le [version]'3.10.2') { throw "Do not republish the migration baseline or an older hidi version." } Write-Host "##vso[task.setvariable variable=HidiReleaseVersion]$version" displayName: Read independent hidi version diff --git a/.github/workflows/release-please-gha.yml b/.github/workflows/release-please-gha.yml index f503b3d4..31b2ea29 100644 --- a/.github/workflows/release-please-gha.yml +++ b/.github/workflows/release-please-gha.yml @@ -50,25 +50,3 @@ jobs: config-file: release-please-config.json manifest-file: .release-please-manifest.json target-branch: ${{ github.ref_name }} - - release-please-hidi: - # Enable only after destination merges and source publishing is cut over. - if: ${{ false }} - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 - with: - client-id: ${{ vars.RELEASE_PLEASE_TOKEN_PROVIDER_APP_ID }} - private-key: ${{ secrets.RELEASE_PLEASE_TOKEN_PROVIDER_PEM }} - - name: Release Please (independent hidi version) - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 - with: - token: ${{ steps.app-token.outputs.token }} - config-file: hidi-release-please-config.json - manifest-file: .hidi-release-please-manifest.json - target-branch: ${{ github.ref_name }} diff --git a/.hidi-release-please-manifest.json b/.hidi-release-please-manifest.json deleted file mode 100644 index 0ddfa5e4..00000000 --- a/.hidi-release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "3.10.2" -} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a9e40ee0..2899cedb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,4 @@ { - ".": "3.2.1" + ".": "3.2.1", + "src/Microsoft.OpenApi.Hidi": "3.10.2" } \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 334509be..f87b51b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,4 +47,32 @@ The recommended commit types used are: - __ci__ for CI configuration file changes e.g. updating a pipeline - __chore__ for miscallaneous non-sdk changesin the repo e.g. removing an unused file -Adding an exclamation mark after the commit type (`feat!`) or footer with the prefix __BREAKING CHANGE:__ will cause an increment of the _major_ version. \ No newline at end of file +Adding an exclamation mark after the commit type (`feat!`) or footer with the prefix __BREAKING CHANGE:__ will cause an increment of the _major_ version. + +## Independent component versions + +`release-please-config.json` defines OData at `.` and Hidi at +`src/Microsoft.OpenApi.Hidi`; `.release-please-manifest.json` tracks their versions +independently. The standard release-please action manages both components. +The standard `separate-pull-requests` setting retains component-specific PR +branches so the pinned engine can parse OData-only releases with componentless +tags; the default combined PR format cannot produce those release candidates. +Hidi uses `hidi-v3.*` tags on `main`, its own changelog and the project +`` property. OData retains its root changelog, `Directory.Build.props` +version and componentless `v*` tags. A Hidi source change does not bump OData; +an OData-only change does not bump Hidi. + +Routing follows package directories, not commit scopes. Hidi tests outside the +source package are excluded from OData releases and do not independently trigger +a Hidi release. Root distribution/helper files remain outside the Hidi component; +they follow the root package's standard routing, not custom Hidi routing. +Existing root OData exclusions remain configured. The official Hidi +package/container publishing gates remain disabled during migration. + +The ADO OData pipeline accepts `v3.*` tags and deploys only the exact OData +package matching that tag and `Directory.Build.props`. The dedicated Hidi +pipeline accepts `hidi-v3.*` tags; its package, symbols, executable, ZIP and +container version must match the Hidi tag/project version. Malformed, +other-component or mismatched tags fail validation rather than publishing a +different component. With publishing disabled, branch/PR builds remain validation-only; the existing +Hidi publishing flags, migration floor and protected environments are unchanged. \ No newline at end of file diff --git a/hidi-release-please-config.json b/hidi-release-please-config.json deleted file mode 100644 index 457dc524..00000000 --- a/hidi-release-please-config.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", - "bootstrap-sha": "5574ccc6d8d129d7a49729619fac3e3e36d334fd", - "release-type": "simple", - "include-component-in-tag": true, - "include-v-in-tag": true, - "exclude-paths": [ - ".azure-pipelines", - ".github", - ".idea", - ".vs", - ".vscode", - "src/Microsoft.OpenApi.OData.Reader", - "src/OoasGui", - "src/OoasUtil", - "test/Microsoft.OpenAPI.OData.Reader.Tests", - "docs", - "CHANGELOG.md", - "Directory.Build.props", - "release-please-config.json", - ".release-please-manifest.json" - ], - "packages": { - ".": { - "package-name": "Microsoft.OpenApi.Hidi", - "component": "hidi", - "changelog-path": "src/Microsoft.OpenApi.Hidi/CHANGELOG.md", - "extra-files": [ - { - "type": "xml", - "path": "src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj", - "xpath": "//Project/PropertyGroup/Version" - } - ] - } - } -} diff --git a/release-please-config.json b/release-please-config.json index 75e417d6..69409496 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,21 +5,7 @@ ".github", ".idea", ".vs", - ".vscode", - "src/Microsoft.OpenApi.Hidi", - "src/Microsoft.OpenApi.Tool", - "src/Microsoft.Hidi", - "Microsoft.OpenApi.Hidi.Tests", - "test/Microsoft.OpenApi.Hidi.Tests", - "test/Microsoft.OpenApi.Tests", - "tool/Microsoft.OpenApi.Hidi.public.snk", - "tool/Microsoft.OpenApi.OData.public.snk", - "tool/hidi-local-nuget.config", - "Dockerfile", - ".dockerignore", - "install-tool.ps1", - "hidi-release-please-config.json", - ".hidi-release-please-manifest.json" + ".vscode" ], "release-type": "simple", "bump-minor-pre-major": true, @@ -27,10 +13,30 @@ "include-component-in-tag": false, "include-v-in-tag": true, "draft": false, + "separate-pull-requests": true, "packages": { ".": { "package-name": "Microsoft.OpenApi.OData", "changelog-path": "CHANGELOG.md", + "exclude-paths": [ + ".azure-pipelines", + ".github", + ".idea", + ".vs", + ".vscode", + "src/Microsoft.OpenApi.Hidi", + "src/Microsoft.OpenApi.Tool", + "src/Microsoft.Hidi", + "Microsoft.OpenApi.Hidi.Tests", + "test/Microsoft.OpenApi.Hidi.Tests", + "test/Microsoft.OpenApi.Tests", + "tool/Microsoft.OpenApi.Hidi.public.snk", + "tool/Microsoft.OpenApi.OData.public.snk", + "tool/hidi-local-nuget.config", + "Dockerfile", + ".dockerignore", + "install-tool.ps1" + ], "extra-files": [ { "type": "xml", @@ -38,6 +44,20 @@ "xpath": "//Project/PropertyGroup/Version" } ] + }, + "src/Microsoft.OpenApi.Hidi": { + "package-name": "Microsoft.OpenApi.Hidi", + "component": "hidi", + "changelog-path": "CHANGELOG.md", + "include-component-in-tag": true, + "include-v-in-tag": true, + "extra-files": [ + { + "type": "xml", + "path": "Microsoft.OpenApi.Hidi.csproj", + "xpath": "//Project/PropertyGroup/Version" + } + ] } }, "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"