From 5f7de881d694c6ca54ec849c34fe25a8744a4358 Mon Sep 17 00:00:00 2001 From: Shadi Samadi Date: Thu, 4 Sep 2025 10:26:26 +1000 Subject: [PATCH 1/5] Delete .github/workflows directory --- .github/workflows/auto-merge-dependabot.yml | 32 ------- .github/workflows/ci-cd.yml | 97 --------------------- .github/workflows/codeql-analysis.yml | 54 ------------ .github/workflows/release-please-gha.yml | 37 -------- .github/workflows/sonarcloud.yml | 68 --------------- 5 files changed, 288 deletions(-) delete mode 100644 .github/workflows/auto-merge-dependabot.yml delete mode 100644 .github/workflows/ci-cd.yml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/release-please-gha.yml delete mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml deleted file mode 100644 index d454cd186..000000000 --- a/.github/workflows/auto-merge-dependabot.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Auto-merge dependabot updates - -on: - pull_request: - branches: [ main ] - -permissions: - pull-requests: write - contents: write - -jobs: - - dependabot-merge: - - runs-on: ubuntu-latest - - if: ${{ github.actor == 'dependabot[bot]' }} - - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v2.4.0 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - - name: Enable auto-merge for Dependabot PRs - # Only if version bump is not a major version change - if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}} - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml deleted file mode 100644 index 06a1402cf..000000000 --- a/.github/workflows/ci-cd.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: CI/CD Pipeline - -on: [push, pull_request, workflow_dispatch] - -permissions: - contents: read - -jobs: - ci: - name: Continuous Integration - runs-on: ubuntu-latest - env: - ARTIFACTS_FOLDER: ${{ github.workspace }}/Artifacts - GITHUB_RUN_NUMBER: ${{ github.run_number }} - steps: - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.x - - - name: Checkout repository - id: checkout_repo - uses: actions/checkout@v5 - with: - token: ${{ secrets.GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Build projects - id: build_projects - shell: pwsh - run: | - dotnet build Microsoft.OpenApi.sln -c Release - - - name: Run unit tests - id: run_unit_tests - shell: pwsh - run: | - dotnet test Microsoft.OpenApi.sln -c Release -v n - - validate-trimming: - name: Validate Project for Trimming - runs-on: windows-latest - steps: - - uses: actions/checkout@v5 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.x - - - name: Validate Trimming warnings - run: dotnet publish -c Release -r win-x64 /p:TreatWarningsAsErrors=true /warnaserror -f net8.0 - working-directory: ./test/Microsoft.OpenApi.Trimming.Tests - - validate-performance: - name: Validate performance of the library - runs-on: ubuntu-latest - needs: [ci] - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.x - - - name: Copy committed results - run: | - mkdir -p ./performanceResults - cp -r ./performance/benchmark/BenchmarkDotNet.Artifacts/results/* ./performanceResults - - - name: Run performance tests - run: | - dotnet run -c Release - working-directory: ./performance/benchmark - - - name: Publish benchmark results - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: benchmark-results - path: "${{ github.workspace }}/performance/benchmark/BenchmarkDotNet.Artifacts/results" - - - name: Run comparison tool for empty models - run: dotnet run -c Release --project ./performance/resultsComparer/resultsComparer.csproj -- compare $OLD_REPORT $NEW_REPORT -p IdenticalMemoryUsage - shell: bash - env: - NEW_REPORT: "${{ github.workspace }}/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.EmptyModels-report.json" - OLD_REPORT: "${{ github.workspace }}/performanceResults/performance.EmptyModels-report.json" - - - name: Run comparison tool for descriptions - run: dotnet run -c Release --project ./performance/resultsComparer/resultsComparer.csproj -- compare $OLD_REPORT $NEW_REPORT -p ZeroPointTwoPercentDifferenceMemoryUsage - shell: bash - env: - NEW_REPORT: "${{ github.workspace }}/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json" - OLD_REPORT: "${{ github.workspace }}/performanceResults/performance.Descriptions-report.json" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 73da4beea..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CodeQL Analysis - -on: - push: - branches: [ main, support/v1 ] - pull_request: - schedule: - - cron: '0 8 * * *' - workflow_dispatch: - -permissions: - contents: read # these permissions are required to run the codeql analysis - actions: read - security-events: write - -jobs: - analyze: - name: CodeQL Analysis - runs-on: ubuntu-latest - steps: - - name: Checkout repository - id: checkout_repo - uses: actions/checkout@v5 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - - name: Initialize CodeQL - id: init_codeql - uses: github/codeql-action/init@v3 - with: - queries: security-and-quality - - - name: Build projects - id: build_projects - shell: pwsh - run: | - $projectsArray = @( - '.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj', - '.\src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj', - '.\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj' - ) - - $projectsArray | ForEach-Object { - dotnet build $PSItem -c Release - } - - - name: Perform CodeQL Analysis - id: analyze_codeql - uses: github/codeql-action/analyze@v3 - -# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) \ No newline at end of file diff --git a/.github/workflows/release-please-gha.yml b/.github/workflows/release-please-gha.yml deleted file mode 100644 index a730548a2..000000000 --- a/.github/workflows/release-please-gha.yml +++ /dev/null @@ -1,37 +0,0 @@ -## ----------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE.txt in the project root for license information. -## ----------------------------------------------------------------------------- -# -# Summary: -# This GitHub Actions workflow automates the release process using Release Please. -# It triggers on pushes to the main branch, generates a GitHub App token using organization -# variables and secrets, and then runs the release-please-action to manage versioning and changelogs. - -name: Release Please - -on: - push: - branches: - - main - - support/v1 - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - - name: Generate GitHub App token - id: app-token - uses: actions/create-github-app-token@v2 - with: - app-id: ${{ vars.RELEASE_PLEASE_TOKEN_PROVIDER_APP_ID }} - private-key: ${{ secrets.RELEASE_PLEASE_TOKEN_PROVIDER_PEM }} - - - name: Release Please - uses: googleapis/release-please-action@v4 - with: - token: ${{ steps.app-token.outputs.token }} - config-file: release-please-config.json - manifest-file: .release-please-manifest.json diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index 5ec33537f..000000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Sonarcloud -on: - workflow_dispatch: - push: - branches: - - main - paths-ignore: ['.vscode/**'] - pull_request: - types: [opened, synchronize, reopened] - paths-ignore: ['.vscode/**'] - - -permissions: - contents: read - pull-requests: read - -env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - -jobs: - checksecret: - name: check if SONAR_TOKEN is set in github secrets - runs-on: ubuntu-latest - outputs: - is_SONAR_TOKEN_set: ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }} - steps: - - name: Check whether unity activation requests should be done - id: checksecret_job - run: | - echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT - build: - needs: [checksecret] - if: needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true' - name: Build - runs-on: windows-latest - steps: - - name: Set up JDK 17 - uses: actions/setup-java@v5 - with: - distribution: 'adopt' - java-version: 17 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - uses: actions/checkout@v5 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Cache SonarCloud packages - uses: actions/cache@v4 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Install SonarCloud scanner - run: dotnet tool install dotnet-sonarscanner --create-manifest-if-needed - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - CollectCoverage: true - CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682 - shell: pwsh - run: | - dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.opencover.xml" - dotnet workload restore - dotnet build - dotnet test Microsoft.OpenApi.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover - dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file From 7169a79258a3c99c28f19496a8279ad76bf17097 Mon Sep 17 00:00:00 2001 From: Shadi Samadi Date: Thu, 4 Sep 2025 10:26:41 +1000 Subject: [PATCH 2/5] Delete .github/dependabot.yml --- .github/dependabot.yml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index d82ae27c9..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - # default location of `.github/workflows` - directory: "/" - open-pull-requests-limit: 10 - schedule: - interval: "weekly" - - package-ecosystem: "nuget" - # location of package manifests - directory: "/" - open-pull-requests-limit: 10 - schedule: - interval: "daily" - - package-ecosystem: dotnet-sdk - directory: / - schedule: - interval: weekly - day: wednesday - ignore: - - dependency-name: '*' - update-types: - - version-update:semver-major - - version-update:semver-minor -# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) From 83f32b627338808163be69fefcb978739b7fc100 Mon Sep 17 00:00:00 2001 From: Shadi Samadi Date: Thu, 4 Sep 2025 10:26:50 +1000 Subject: [PATCH 3/5] Delete .github/release-please.yml --- .github/release-please.yml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .github/release-please.yml diff --git a/.github/release-please.yml b/.github/release-please.yml deleted file mode 100644 index c821fc166..000000000 --- a/.github/release-please.yml +++ /dev/null @@ -1,7 +0,0 @@ -manifest: true -primaryBranch: main -handleGHRelease: true -branches: - - branch: support/v1 - manifest: true - handleGHRelease: true \ No newline at end of file From e67cd5b7a8c316d692603ab6a7d4636eef52af64 Mon Sep 17 00:00:00 2001 From: Shadi Samadi Date: Thu, 4 Sep 2025 10:27:09 +1000 Subject: [PATCH 4/5] Delete .github/policies directory --- .../OpenAPI.NET-branch-protection.yml | 83 -------------- .github/policies/resourceManagement.yml | 101 ------------------ 2 files changed, 184 deletions(-) delete mode 100644 .github/policies/OpenAPI.NET-branch-protection.yml delete mode 100644 .github/policies/resourceManagement.yml diff --git a/.github/policies/OpenAPI.NET-branch-protection.yml b/.github/policies/OpenAPI.NET-branch-protection.yml deleted file mode 100644 index 6deeb87fa..000000000 --- a/.github/policies/OpenAPI.NET-branch-protection.yml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -# File initially created using https://github.com/MIchaelMainer/policyservicetoolkit/blob/main/branch_protection_export.ps1. - -name: OpenAPI.NET-branch-protection -description: Branch protection policy for the OpenAPI.NET repository -resource: repository -configuration: - branchProtectionRules: - - - branchNamePattern: main - # This branch pattern applies to the following branches as of approximately 02/27/2025 15:28:20: - # main - - # Specifies whether this branch can be deleted. boolean - allowsDeletions: false - # Specifies whether forced pushes are allowed on this branch. boolean - allowsForcePushes: false - # Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean - dismissStaleReviews: true - # Specifies whether admins can overwrite branch protection. boolean - isAdminEnforced: true - # Indicates whether "Require a pull request before merging" is enabled. boolean - requiresPullRequestBeforeMerging: true - # Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required - requiredApprovingReviewsCount: 1 - # Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean - requireCodeOwnersReview: true - # Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines. - requiresCommitSignatures: false - # Are conversations required to be resolved before merging? boolean - requiresConversationResolution: true - # Are merge commits prohibited from being pushed to this branch. boolean - requiresLinearHistory: false - # Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status - requiredStatusChecks: - - license/cla - - CodeQL - - Continuous Integration - # Require branches to be up to date before merging. boolean - requiresStrictStatusChecks: false - # Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush. - restrictsPushes: false - # Restrict who can dismiss pull request reviews. boolean - restrictsReviewDismissals: false - - - branchNamePattern: support/v1 - # This branch pattern applies to the following branches as of approximately 02/27/2025 15:28:20: - # support/v1 - - # Specifies whether this branch can be deleted. boolean - allowsDeletions: false - # Specifies whether forced pushes are allowed on this branch. boolean - allowsForcePushes: false - # Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean - dismissStaleReviews: true - # Specifies whether admins can overwrite branch protection. boolean - isAdminEnforced: true - # Indicates whether "Require a pull request before merging" is enabled. boolean - requiresPullRequestBeforeMerging: true - # Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required - requiredApprovingReviewsCount: 1 - # Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean - requireCodeOwnersReview: true - # Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines. - requiresCommitSignatures: false - # Are conversations required to be resolved before merging? boolean - requiresConversationResolution: true - # Are merge commits prohibited from being pushed to this branch. boolean - requiresLinearHistory: false - # Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status - requiredStatusChecks: - - license/cla - - CodeQL - - Continuous Integration - # Require branches to be up to date before merging. boolean - requiresStrictStatusChecks: false - # Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush. - restrictsPushes: false - # Restrict who can dismiss pull request reviews. boolean - restrictsReviewDismissals: false - diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml deleted file mode 100644 index 0fc5c93a2..000000000 --- a/.github/policies/resourceManagement.yml +++ /dev/null @@ -1,101 +0,0 @@ -id: -name: GitOps.PullRequestIssueManagement -description: GitOps.PullRequestIssueManagement primitive -owner: -resource: repository -disabled: false -where: -configuration: - resourceManagementConfiguration: - scheduledSearches: - - description: - frequencies: - - hourly: - hour: 6 - filters: - - isIssue - - isOpen - - hasLabel: - label: 'status:waiting-for-author-feedback' - - hasLabel: - label: 'status:no-recent-activity' - - noActivitySince: - days: 3 - actions: - - closeIssue - - description: - frequencies: - - hourly: - hour: 6 - filters: - - isIssue - - isOpen - - hasLabel: - label: 'status:waiting-for-author-feedback' - - noActivitySince: - days: 4 - - isNotLabeledWith: - label: 'status:no-recent-activity' - actions: - - addLabel: - label: 'status:no-recent-activity' - - addReply: - reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**. - - description: - frequencies: - - hourly: - hour: 6 - filters: - - isIssue - - isOpen - - hasLabel: - label: 'status:duplicate' - - noActivitySince: - days: 1 - actions: - - addReply: - reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes. - - closeIssue - eventResponderTasks: - - if: - - payloadType: Issue_Comment - - isAction: - action: Created - - isActivitySender: - issueAuthor: True - - hasLabel: - label: 'status:waiting-for-author-feedback' - - isOpen - then: - - addLabel: - label: 'Needs: Attention :wave:' - - removeLabel: - label: 'status:waiting-for-author-feedback' - description: - - if: - - payloadType: Issues - - not: - isAction: - action: Closed - - hasLabel: - label: 'status:no-recent-activity' - then: - - removeLabel: - label: 'status:no-recent-activity' - description: - - if: - - payloadType: Issue_Comment - - hasLabel: - label: 'status:no-recent-activity' - then: - - removeLabel: - label: 'status:no-recent-activity' - description: - - if: - - payloadType: Pull_Request - then: - - inPrLabel: - label: WIP - description: -onFailure: -onSuccess: From a87baa4cd6da737adbc05d845e7cebbb11feb0a8 Mon Sep 17 00:00:00 2001 From: Shadi Samadi Date: Thu, 4 Sep 2025 10:27:26 +1000 Subject: [PATCH 5/5] Delete .azure-pipelines directory --- .azure-pipelines/ci-build.yml | 472 ---------------------------------- 1 file changed, 472 deletions(-) delete mode 100644 .azure-pipelines/ci-build.yml diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml deleted file mode 100644 index 1f4c7a41e..000000000 --- a/.azure-pipelines/ci-build.yml +++ /dev/null @@ -1,472 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. - -name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) -trigger: - branches: - include: - - main - - support/v1 - tags: - include: - - 'v*' -pr: - branches: - include: - - main - - support/v1 - -variables: - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' - REGISTRY: 'msgraphprodregistry.azurecr.io' - IMAGE_NAME: 'public/openapi/hidi' - PREVIEW_BRANCH: 'refs/heads/main' - -resources: - repositories: - - repository: 1ESPipelineTemplates - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release -extends: - template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates - parameters: - pool: - name: Azure-Pipelines-1ESPT-ExDShared - image: windows-2022 - os: windows - customBuildTags: - - ES365AIMigrationTooling - stages: - - stage: build - jobs: - - job: build - templateContext: - outputs: - - output: pipelineArtifact - displayName: 'Publish Artifact: Nugets' - artifactName: Nugets - targetPath: '$(Build.ArtifactStagingDirectory)/Nugets' - - output: pipelineArtifact - displayName: 'Publish Artifact: RepoFiles' - artifactName: RepoFiles - targetPath: '$(Build.ArtifactStagingDirectory)/RepoFiles' - steps: - - task: UseDotNet@2 - displayName: 'Use .NET 6' - inputs: - version: 6.x - - - task: UseDotNet@2 - displayName: 'Use .NET 8' - inputs: - version: 8.x - - # Install the nuget tool. - - task: NuGetToolInstaller@1 - displayName: 'Use NuGet >=6.11.0' - inputs: - versionSpec: '>=6.11.0' - checkLatest: true - - # Build the Product project - - task: DotNetCoreCLI@2 - displayName: 'build' - inputs: - projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.sln' - arguments: '--configuration $(BuildConfiguration) --no-incremental' - - # Run the Unit test - - task: DotNetCoreCLI@2 - displayName: 'test' - inputs: - command: test - projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.sln' - arguments: '--configuration $(BuildConfiguration) --no-build' - - - task: EsrpCodeSigning@5 - displayName: 'ESRP CodeSigning binaries' - inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' - FolderPath: '$(Build.SourcesDirectory)\src' - signConfigType: 'inlineSignParams' - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ - { - "parameterName": "OpusName", - "parameterValue": "Microsoft" - }, - { - "parameterName": "OpusInfo", - "parameterValue": "http://www.microsoft.com" - }, - { - "parameterName": "FileDigest", - "parameterValue": "/fd \"SHA256\"" - }, - { - "parameterName": "PageHash", - "parameterValue": "/NPH" - }, - { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" - } - ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: '20' - MaxConcurrency: '50' - MaxRetryAttempts: '5' - PendingAnalysisWaitTimeoutMinutes: '5' - - # Pack core lib - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg - displayName: 'pack OpenAPI' - - # Pack YamlReader - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg - displayName: 'pack YamlReader' - - # Pack hidi - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg - displayName: 'pack Hidi' - - - task: EsrpCodeSigning@5 - displayName: 'ESRP CodeSigning Nuget Packages' - inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' - FolderPath: '$(Build.ArtifactStagingDirectory)' - Pattern: '*.nupkg' - signConfigType: 'inlineSignParams' - inlineOperation: | - [ - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetSign", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: '60' - MaxConcurrency: '50' - MaxRetryAttempts: '5' - PendingAnalysisWaitTimeoutMinutes: '5' - - # publish hidi as an .exe - - task: DotNetCoreCLI@2 - displayName: publish Hidi as executable - inputs: - command: 'publish' - arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi - projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj' - publishWebProjects: False - zipAfterPublish: false - - - task: CopyFiles@2 - displayName: Prepare staging folder for upload - inputs: - targetFolder: $(Build.ArtifactStagingDirectory)/Nugets - sourceFolder: $(Build.ArtifactStagingDirectory) - content: '*.nupkg' - - # Copy repository files to be used in the deploy stage - - task: CopyFiles@2 - displayName: 'Copy repository files for deploy stage' - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - **/* - !**/bin/** - !**/obj/** - !**/.git/** - TargetFolder: '$(Build.ArtifactStagingDirectory)/RepoFiles' - - - stage: deploy - condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) - dependsOn: build - pool: - name: Azure-Pipelines-1ESPT-ExDShared - os: linux - image: ubuntu-latest - jobs: - - deployment: deploy_hidi - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' - - - deployment: deploy_lib - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - pwsh: | - $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" - foreach($fileName in $fileNames) { - if(Test-Path $fileName) { - Remove-Item $fileName -Verbose - } - } - displayName: remove other nupkgs to avoid duplication - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' - - - deployment: deploy_yaml_reader - condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: deploy_lib - environment: nuget-org - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - task: 1ES.PublishNuget@1 - displayName: 'NuGet push' - inputs: - packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' - - - deployment: create_github_release - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: Nugets - targetPath: '$(Pipeline.Workspace)' - dependsOn: [] - environment: kiota-github-releases - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 - $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" - #Set Variable $artifactName and $artifactVersion - Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" - echo "$artifactVersion" - displayName: 'Fetch Artifact Name' - - task: GitHubRelease@1 - displayName: 'GitHub release (edit)' - condition: succeededOrFailed() - inputs: - gitHubConnection: 'Github-MaggieKimani1' - action: edit - tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)' - releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.exe' - addChangeLog: false - - - deployment: deploy_docker_image - environment: docker-images-deploy - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: RepoFiles - targetPath: '$(Pipeline.Workspace)' - strategy: - runOnce: - deploy: - pool: - vmImage: 'ubuntu-latest' - steps: - - task: AzureCLI@2 - displayName: 'Login to Azure Container Registry' - inputs: - azureSubscription: 'ACR Images Push Service Connection' - scriptType: bash - scriptLocation: inlineScript - inlineScript: | - az acr login --name $(REGISTRY) - - - pwsh: | - $content = [XML](Get-Content $(Pipeline.Workspace)/Directory.Build.props) - Write-Host "XML loaded, finding version..." - - # Handle PropertyGroup as either a single element or array - $version = $null - if ($content.Project.PropertyGroup -is [array]) { - Write-Host "PropertyGroup is an array, checking each entry..." - foreach ($pg in $content.Project.PropertyGroup) { - if ($pg.Version) { - $version = $pg.Version.ToString().Trim() - Write-Host "Found version in PropertyGroup array: $version" - break - } - } - } else { - # Single PropertyGroup - $version = $content.Project.PropertyGroup.Version - if ($version) { - $version = $version.ToString().Trim() - Write-Host "Found version in PropertyGroup: $version" - } - } - - if (-not $version) { - Write-Host "##vso[task.logissue type=error]Version not found in Directory.Build.props" - exit 1 - } - - Write-Host "Version found: $version" - Write-Host "##vso[task.setvariable variable=version;isoutput=true]$version" - Write-Host "##vso[task.setvariable variable=VERSION]$version" - displayName: 'Get version from csproj' - name: getversion - - - bash: | - # Debug output to verify version variable - echo "Version from previous step: $VERSION" - displayName: 'Verify version variable' - - - bash: | - echo "Build Number: $(Build.BuildNumber)" - # Extract the last 3 characters for the run number - runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$') - echo "Extracted Run Number: $runnumber" - - # If extraction fails, set a default - if [ -z "$runnumber" ]; then - echo "Extraction failed, using default value" - runnumber=$(date +"%S%N" | cut -c1-3) - echo "Generated fallback run number: $runnumber" - fi - - # Set the variable for later steps - echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber" - echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" - displayName: 'Get truncated run number' - name: getrunnumber - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - date=$(date +'%Y%m%d') - echo "Date value: $date" - echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date" - echo "##vso[task.setvariable variable=BUILDDATE]$date" - displayName: 'Get current date' - name: setdate - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - script: | - docker run --privileged --rm msgraphprodregistry.azurecr.io/tonistiigi/binfmt --install all - displayName: "Enable multi-platform builds" - - - script: | - docker buildx create --use --name mybuilder - displayName: "Set up Docker BuildX" - - - script: | - docker buildx inspect --bootstrap - displayName: "Ensure BuildX is working" - - - bash: | - echo "Building Docker image..." - echo "Using build date: ${BUILDDATE}" - # Using quotes around tags to prevent flag interpretation - docker buildx build \ - --platform linux/amd64,linux/arm64/v8 \ - --push \ - -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ - -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ - "$(Pipeline.Workspace)" - - displayName: 'Build and Push Nightly Image' - condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) - - - bash: | - echo "Building Docker image for release..." - docker buildx build\ - --platform linux/amd64,linux/arm64/v8 \ - --push \ - -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ - -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}" \ - "$(Pipeline.Workspace)" - displayName: 'Build and Push Release Image' - condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') \ No newline at end of file