From 55352f183eb89980046a1123a82514f5d0dbf863 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 10:18:53 -0500 Subject: [PATCH 01/12] ci: updates main with the latest ci changes --- .azure-pipelines/ci-build.yml | 48 ++++++++++++++++----------- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docker.yml | 16 ++++----- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index f381a4303..e9aa773a3 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -5,13 +5,15 @@ name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) trigger: branches: include: - - master - - vnext + - main + - dev + - support/v1 pr: branches: include: - - master - - vnext + - main + - dev + - support/v1 variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' @@ -206,10 +208,17 @@ extends: content: '*.nupkg' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded()) + condition: and(or(contains(variables['build.sourceBranch'], 'refs/heads/main'),contains(variables['build.sourceBranch'], 'refs/heads/support/v1')), succeeded()) dependsOn: build jobs: - deployment: deploy_hidi + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: @@ -218,11 +227,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - task: DownloadPipelineArtifact@2 displayName: Download hidi executable from artifacts inputs: @@ -264,6 +268,13 @@ extends: ]' - deployment: deploy_lib + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: @@ -272,11 +283,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - powershell: | $fileNames = "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Workbench.*.nupkg" foreach($fileName in $fileNames) { @@ -294,6 +300,13 @@ extends: publishFeedCredentials: 'OpenAPI Nuget Connection' - deployment: deploy_readers + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' dependsOn: deploy_lib environment: nuget-org strategy: @@ -302,11 +315,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 22eb5f8fa..4224ace24 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,7 +2,7 @@ name: CodeQL Analysis on: push: - branches: [ vnext ] + branches: [ main, dev ] pull_request: schedule: - cron: '0 8 * * *' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a2a2bb104..7e81a456d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,7 +2,7 @@ name: Publish Docker image on: workflow_dispatch: push: - branches: [master, vnext] + branches: [main, dev, support/v1] paths: ['src/Microsoft.OpenApi.Hidi/**', '.github/workflows/**'] env: REGISTRY: msgraphprod.azurecr.io @@ -16,7 +16,7 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v4 - - name: Login to GitHub package feed + - name: Login to registry uses: docker/login-action@v3.3.0 with: username: ${{ secrets.ACR_USERNAME }} @@ -28,15 +28,15 @@ jobs: echo "::set-output name=version::${version}" shell: pwsh id: getversion - - name: Push to GitHub Packages - Nightly - if: ${{ github.ref == 'refs/heads/vnext' }} - uses: docker/build-push-action@v6.9.0 + - name: Push to registry - Nightly + if: ${{ github.ref == 'refs/heads/dev' }} + uses: docker/build-push-action@v6.10.0 with: push: true tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly - - name: Push to GitHub Packages - Release - if: ${{ github.ref == 'refs/heads/master' }} - uses: docker/build-push-action@v6.9.0 + - name: Push to registry - Release + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/support/v1' }} + uses: docker/build-push-action@v6.10.0 with: push: true tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }} From a3c6c8330f26db5a181f17024a2b9e20ca8529f2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 12:12:27 -0500 Subject: [PATCH 02/12] fix: removes extraneous download artifact task Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index e9aa773a3..2303ea0a0 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -227,10 +227,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download hidi executable from artifacts - inputs: - source: current - pwsh: | $artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" From 662e9d7405b1d75099348a28e4884c08dc4da7ad Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 13:02:08 -0500 Subject: [PATCH 03/12] fix: hidi GH release Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 2303ea0a0..922fde421 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -45,8 +45,8 @@ extends: targetPath: '$(Build.ArtifactStagingDirectory)/Nugets' - output: pipelineArtifact displayName: 'Publish Artifact: Hidi' - artifactName: Microsoft.OpenApi.Hidi-v$(hidiversion) - targetPath: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)' + artifactName: Hidi + targetPath: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi' steps: - task: UseDotNet@2 displayName: 'Use .NET 6' @@ -179,23 +179,13 @@ extends: MaxConcurrency: '50' MaxRetryAttempts: '5' PendingAnalysisWaitTimeoutMinutes: '5' - - - task: PowerShell@2 - displayName: "Get Hidi's version-number from .csproj" - inputs: - targetType: 'inline' - script: | - $xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj) - $version = $xml.Project.PropertyGroup.Version - echo $version - echo "##vso[task.setvariable variable=hidiversion]$version" - + # 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-v$(hidiversion) + 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 @@ -219,6 +209,9 @@ extends: - input: pipelineArtifact artifactName: Nugets targetPath: '$(Pipeline.Workspace)' + - input: pipelineArtifact + artifactName: Hidi + targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: From 1ae06b1ed1d1870236f24e7894dc46af25cf8c90 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 13:39:59 -0500 Subject: [PATCH 04/12] fix: redundant artifact upload Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 922fde421..449142a91 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -43,10 +43,6 @@ extends: displayName: 'Publish Artifact: Nugets' artifactName: Nugets targetPath: '$(Build.ArtifactStagingDirectory)/Nugets' - - output: pipelineArtifact - displayName: 'Publish Artifact: Hidi' - artifactName: Hidi - targetPath: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi' steps: - task: UseDotNet@2 displayName: 'Use .NET 6' @@ -209,9 +205,6 @@ extends: - input: pipelineArtifact artifactName: Nugets targetPath: '$(Pipeline.Workspace)' - - input: pipelineArtifact - artifactName: Hidi - targetPath: '$(Pipeline.Workspace)' dependsOn: [] environment: nuget-org strategy: From 166747f21d904c493603b5f84b6f72606a33c66b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Dec 2024 09:47:07 -0500 Subject: [PATCH 05/12] fix: removes actions steps that create extraneous tags Signed-off-by: Vincent Biret --- .github/workflows/ci-cd.yml | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 01861ee2d..13a34f171 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -3,15 +3,12 @@ name: CI/CD Pipeline on: [push, pull_request, workflow_dispatch] permissions: - contents: write + contents: read jobs: ci: name: Continuous Integration runs-on: ubuntu-latest - outputs: - latest_version: ${{ steps.tag_generator.outputs.new_version }} - is_default_branch: ${{ steps.conditionals_handler.outputs.is_default_branch }} env: ARTIFACTS_FOLDER: ${{ github.workspace }}/Artifacts GITHUB_RUN_NUMBER: ${{ github.run_number }} @@ -21,27 +18,6 @@ jobs: with: dotnet-version: 8.0.x - - name: Data gatherer - id: data_gatherer - shell: pwsh - run: | - # Get default branch - $repo = 'microsoft/OpenAPI.NET' - $defaultBranch = Invoke-RestMethod -Method GET -Uri https://api.github.com/repos/$repo | Select-Object -ExpandProperty default_branch - Write-Output "::set-output name=default_branch::$(echo $defaultBranch)" - - - name: Conditionals handler - id: conditionals_handler - shell: pwsh - run: | - $defaultBranch = "${{ steps.data_gatherer.outputs.default_branch }}" - $githubRef = "${{ github.ref }}" - $isDefaultBranch = 'false' - if ( $githubRef -like "*$defaultBranch*" ) { - $isDefaultBranch = 'true' - } - Write-Output "::set-output name=is_default_branch::$(echo $isDefaultBranch)" - - name: Checkout repository id: checkout_repo uses: actions/checkout@v4 @@ -49,15 +25,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 - - if: steps.conditionals_handler.outputs.is_default_branch == 'true' - name: Bump GH tag - id: tag_generator - uses: mathieudutour/github-tag-action@v6.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - default_bump: false - release_branches: ${{ steps.data_gatherer.outputs.default_branch }} - - name: Build projects id: build_projects shell: pwsh From ff52d8345e3936b8fdeb6923875a4612b614d4d3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Dec 2024 09:50:49 -0500 Subject: [PATCH 06/12] fix: updates output syntax for tag version Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 449142a91..614174516 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -218,10 +218,9 @@ extends: $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" #Set Variable $artifactName and $artifactVersion Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false; isOutput=true]$artifactVersion" - Write-Host "##vso[task.setvariable variable=artifactName; isSecret=false; isOutput=true]$artifactName.FullName" - echo "$artifactName" echo "$artifactVersion" displayName: 'Fetch Artifact Name' + name: getTagVersion - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: @@ -234,10 +233,10 @@ extends: condition: succeededOrFailed() inputs: gitHubConnection: 'Github-MaggieKimani1' - action: edit + action: create tagSource: userSpecifiedTag - tag: '$(artifactVersion)' - title: '$(artifactVersion)' + tag: '$(getTagVersion.artifactVersion)' + title: '$(getTagVersion.artifactVersion)' releaseNotesSource: inline assets: '$(Pipeline.Workspace)\**\*.exe' changeLogType: issueBased From 2fcda792101dbd5bd3af6192360af7c0df471269 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Dec 2024 09:55:32 -0500 Subject: [PATCH 07/12] ci: moves create github release to its own job Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 74 ++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 614174516..a72bfe48b 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -213,14 +213,6 @@ extends: pool: vmImage: ubuntu-latest steps: - - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -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; isOutput=true]$artifactVersion" - echo "$artifactVersion" - displayName: 'Fetch Artifact Name' - name: getTagVersion - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: @@ -228,25 +220,6 @@ extends: packageParentPath: '$(Pipeline.Workspace)' nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' - - task: GitHubRelease@1 - displayName: 'GitHub release (edit)' - condition: succeededOrFailed() - inputs: - gitHubConnection: 'Github-MaggieKimani1' - action: create - tagSource: userSpecifiedTag - tag: '$(getTagVersion.artifactVersion)' - title: '$(getTagVersion.artifactVersion)' - releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.exe' - changeLogType: issueBased - changeLogLabels: '[ - { "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" }, - { "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" }, - { "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" }, - { "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"}, - { "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" } - ]' - deployment: deploy_lib templateContext: @@ -302,4 +275,49 @@ extends: packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg' packageParentPath: '$(Pipeline.Workspace)' nuGetFeedType: external - publishFeedCredentials: 'OpenAPI Nuget Connection' \ No newline at end of file + 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)\Nugets -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; isOutput=true]$artifactVersion" + echo "$artifactVersion" + displayName: 'Fetch Artifact Name' + name: getTagVersion + - task: GitHubRelease@1 + displayName: 'GitHub release (edit)' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: create + tagSource: userSpecifiedTag + tag: '$(getTagVersion.artifactVersion)' + title: '$(getTagVersion.artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.exe' + changeLogType: issueBased + changeLogLabels: '[ + { "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" }, + { "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" }, + { "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" }, + { "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"}, + { "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" } + ]' + From ee99c4d82e37b6b437b5cef63285f9e11e382364 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Dec 2024 09:58:44 -0500 Subject: [PATCH 08/12] nit: fixes indent Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index a72bfe48b..5c07e63ee 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -302,22 +302,22 @@ extends: displayName: 'Fetch Artifact Name' name: getTagVersion - task: GitHubRelease@1 - displayName: 'GitHub release (edit)' - condition: succeededOrFailed() - inputs: - gitHubConnection: 'Github-MaggieKimani1' - action: create - tagSource: userSpecifiedTag - tag: '$(getTagVersion.artifactVersion)' - title: '$(getTagVersion.artifactVersion)' - releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.exe' - changeLogType: issueBased - changeLogLabels: '[ - { "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" }, - { "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" }, - { "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" }, - { "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"}, - { "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" } - ]' + displayName: 'GitHub release (edit)' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: create + tagSource: userSpecifiedTag + tag: '$(getTagVersion.artifactVersion)' + title: '$(getTagVersion.artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.exe' + changeLogType: issueBased + changeLogLabels: '[ + { "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" }, + { "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" }, + { "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" }, + { "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"}, + { "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" } + ]' From e7dfa1a2c0b79c5aa2030e2265fea19dca2b329e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Dec 2024 10:47:04 -0500 Subject: [PATCH 09/12] fix: reverts to a regular variable for the tag value Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 5c07e63ee..d59d69cd3 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -297,10 +297,9 @@ extends: $artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -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; isOutput=true]$artifactVersion" + Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" echo "$artifactVersion" displayName: 'Fetch Artifact Name' - name: getTagVersion - task: GitHubRelease@1 displayName: 'GitHub release (edit)' condition: succeededOrFailed() @@ -308,8 +307,8 @@ extends: gitHubConnection: 'Github-MaggieKimani1' action: create tagSource: userSpecifiedTag - tag: '$(getTagVersion.artifactVersion)' - title: '$(getTagVersion.artifactVersion)' + tag: '$(artifactVersion)' + title: '$(artifactVersion)' releaseNotesSource: inline assets: '$(Pipeline.Workspace)\**\*.exe' changeLogType: issueBased From 5a824bbaecad98bf96ea1470c8792b0653c92c39 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Dec 2024 10:55:27 -0500 Subject: [PATCH 10/12] ci: fix artefacts path --- .azure-pipelines/ci-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index d59d69cd3..6686bba75 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -216,7 +216,7 @@ extends: - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: - packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg' + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' packageParentPath: '$(Pipeline.Workspace)' nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' @@ -238,7 +238,7 @@ extends: vmImage: ubuntu-latest steps: - powershell: | - $fileNames = "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Workbench.*.nupkg" + $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" foreach($fileName in $fileNames) { if(Test-Path $fileName) { rm $fileName -Verbose @@ -248,7 +248,7 @@ extends: - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: - packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.*.nupkg' + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' packageParentPath: '$(Pipeline.Workspace)' nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' @@ -272,7 +272,7 @@ extends: - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: - packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg' + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Readers.*.nupkg' packageParentPath: '$(Pipeline.Workspace)' nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' @@ -294,7 +294,7 @@ extends: vmImage: ubuntu-latest steps: - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $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" From e861c08442fe7b2f1b0e4079d4a007e525a75ca9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 2 Jan 2025 16:16:10 -0500 Subject: [PATCH 11/12] fix: removes all obsolete APIs --- .../Interfaces/IStreamLoader.cs | 10 ---- .../Reader/Services/DefaultStreamLoader.cs | 13 +---- .../Validations/ValidationRule.cs | 10 ---- .../Writers/OpenApiWriterSettings.cs | 50 ------------------- 4 files changed, 1 insertion(+), 82 deletions(-) diff --git a/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs b/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs index c3edebe1b..c3cb9b256 100644 --- a/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs +++ b/src/Microsoft.OpenApi/Interfaces/IStreamLoader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using System.ComponentModel; using System.IO; using System.Threading.Tasks; using Microsoft.OpenApi.Models; @@ -20,14 +19,5 @@ public interface IStreamLoader /// Identifier of some source of an OpenAPI Description /// A data object that can be processed by a reader to generate an Task LoadAsync(Uri uri); - - /// - /// Use Uri to locate data and convert into an input object. - /// - /// - /// - [Obsolete("Use the Async overload")] - [EditorBrowsable(EditorBrowsableState.Never)] - Stream Load(Uri uri); } } diff --git a/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs b/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs index 746ca0c96..bb230c4a9 100644 --- a/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs +++ b/src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using System.ComponentModel; using System.IO; using System.Net.Http; using System.Threading.Tasks; @@ -17,7 +16,7 @@ namespace Microsoft.OpenApi.Reader.Services public class DefaultStreamLoader : IStreamLoader { private readonly Uri baseUrl; - private HttpClient _httpClient = new(); + private readonly HttpClient _httpClient = new(); /// /// The default stream loader @@ -27,16 +26,6 @@ public DefaultStreamLoader(Uri baseUrl) { this.baseUrl = baseUrl; } -/// - - [Obsolete] - [EditorBrowsable(EditorBrowsableState.Never)] - public Stream Load(Uri uri) - { -#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits - return LoadAsync(uri).GetAwaiter().GetResult(); -#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits - } /// /// Use Uri to locate data and convert into an input object. diff --git a/src/Microsoft.OpenApi/Validations/ValidationRule.cs b/src/Microsoft.OpenApi/Validations/ValidationRule.cs index bccb28be6..35503606f 100644 --- a/src/Microsoft.OpenApi/Validations/ValidationRule.cs +++ b/src/Microsoft.OpenApi/Validations/ValidationRule.cs @@ -44,16 +44,6 @@ public class ValidationRule : ValidationRule { private readonly Action _validate; - /// - /// Initializes a new instance of the class. - /// - /// Action to perform the validation. - [Obsolete("Please use the other constructor and specify a name")] - public ValidationRule(Action validate) - : this (Guid.NewGuid().ToString("D"), validate) - { - } - /// /// Initializes a new instance of the class. /// diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index c647436ea..f05fd13a7 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -5,63 +5,13 @@ namespace Microsoft.OpenApi.Writers { - /// - /// Indicates if and when the writer should convert references into complete object renderings - /// - [Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public enum ReferenceInlineSetting - { - /// - /// Render all references as $ref. - /// - DoNotInlineReferences, - /// - /// Render all local references as inline objects - /// - InlineLocalReferences, - /// - /// Render all references as inline objects. - /// - InlineAllReferences - } - /// /// Configuration settings to control how OpenAPI documents are written /// public class OpenApiWriterSettings { - [Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - private ReferenceInlineSetting referenceInline = ReferenceInlineSetting.DoNotInlineReferences; - internal LoopDetector LoopDetector { get; } = new(); /// - /// Indicates how references in the source document should be handled. - /// - [Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public ReferenceInlineSetting ReferenceInline - { - get { return referenceInline; } - set - { - referenceInline = value; - switch (referenceInline) - { - case ReferenceInlineSetting.DoNotInlineReferences: - InlineLocalReferences = false; - InlineExternalReferences = false; - break; - case ReferenceInlineSetting.InlineLocalReferences: - InlineLocalReferences = true; - InlineExternalReferences = false; - break; - case ReferenceInlineSetting.InlineAllReferences: - InlineLocalReferences = true; - InlineExternalReferences = true; - break; - } - } - } - /// /// Indicates if local references should be rendered as an inline object /// public bool InlineLocalReferences { get; set; } From e478b75918e92fbf8124ed7cc16b674888ce2081 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 2 Jan 2025 16:17:03 -0500 Subject: [PATCH 12/12] chore: updates public api document --- .../PublicApi/PublicApi.approved.txt | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index 642dd0b82..1b8857c0f 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -237,8 +237,6 @@ namespace Microsoft.OpenApi.Interfaces } public interface IStreamLoader { - [System.Obsolete("Use the Async overload")] - System.IO.Stream Load(System.Uri uri); System.Threading.Tasks.Task LoadAsync(System.Uri uri); } } @@ -1401,8 +1399,6 @@ namespace Microsoft.OpenApi.Reader.Services public class DefaultStreamLoader : Microsoft.OpenApi.Interfaces.IStreamLoader { public DefaultStreamLoader(System.Uri baseUrl) { } - [System.Obsolete] - public System.IO.Stream Load(System.Uri uri) { } public System.Threading.Tasks.Task LoadAsync(System.Uri uri) { } } } @@ -1653,8 +1649,6 @@ namespace Microsoft.OpenApi.Validations } public class ValidationRule : Microsoft.OpenApi.Validations.ValidationRule { - [System.Obsolete("Please use the other constructor and specify a name")] - public ValidationRule(System.Action validate) { } public ValidationRule(string name, System.Action validate) { } } } @@ -1876,8 +1870,6 @@ namespace Microsoft.OpenApi.Writers public OpenApiWriterSettings() { } public bool InlineExternalReferences { get; set; } public bool InlineLocalReferences { get; set; } - [System.Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public Microsoft.OpenApi.Writers.ReferenceInlineSetting ReferenceInline { get; set; } } public class OpenApiYamlWriter : Microsoft.OpenApi.Writers.OpenApiWriterBase { @@ -1895,13 +1887,6 @@ namespace Microsoft.OpenApi.Writers public override void WriteValue(string value) { } protected override void WriteValueSeparator() { } } - [System.Obsolete("Use InlineLocalReference and InlineExternalReference settings instead")] - public enum ReferenceInlineSetting - { - DoNotInlineReferences = 0, - InlineLocalReferences = 1, - InlineAllReferences = 2, - } public sealed class Scope { public Scope(Microsoft.OpenApi.Writers.ScopeType type) { }