From 7ae9446e2038fbeb4b6dfc24c1c9f3457b7bc8aa Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Dec 2024 09:46:07 -0500 Subject: [PATCH 1/7] chore: renames extraneous references to master to clear confusion Signed-off-by: Vincent Biret --- .gitignore | 2 +- README.md | 8 ++++---- src/OoasUtil/README.md | 2 +- tool/PoliCheck/RunPoliCheck.ps1 | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 940794e60..4caae17f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # User-specific files *.suo diff --git a/README.md b/README.md index 575d609e0..b02123072 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ The **Microsoft.OpenAPI.OData.Reader** library helps represent an OData service The conversion is based on the mapping doc from [OASIS OData OpenAPI v1.0](https://www.oasis-open.org/committees/document.php?document_id=61852&wg_abbrev=odata) and uses the following : -1. [Capabilities vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Capabilities.V1.xml) -2. [Authorization vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Authorization.V1.xml) -3. [Core vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Core.V1.xml) +1. [Capabilities vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.xml) +2. [Authorization vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Authorization.V1.xml) +3. [Core vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.xml) 4. Navigation property path 5. Edm operation and operation import path ## Overview -The image below is generic overview of how this library can convert the EDM model to an [OpenAPI.NET document](https://github.com/Microsoft/OpenAPI.NET/blob/master/src/Microsoft.OpenApi/Models/OpenApiDocument.cs) object. +The image below is generic overview of how this library can convert the EDM model to an [OpenAPI.NET document](https://github.com/Microsoft/OpenAPI.NET/blob/main/src/Microsoft.OpenApi/Models/OpenApiDocument.cs) object. ![Convert OData CSDL to OpenAPI](docs/images/odata-2-openapi.png "Map /// OData CSDL --> OpenAPI.NET") diff --git a/src/OoasUtil/README.md b/src/OoasUtil/README.md index 2eaa7a6d4..95435d412 100644 --- a/src/OoasUtil/README.md +++ b/src/OoasUtil/README.md @@ -70,7 +70,7 @@ Indicate to output file name. `OoasUtil.exe -j -k -drs -drq -p -u -s 3 -i http://services.odata.org/TrippinRESTierService -o trip.json` -The content of `trip.json` is similar at https://github.com/xuzhg/OData.OpenAPI/blob/master/Microsoft.OData.OpenAPI/Microsoft.OData.OpenAPI.Tests/Resources/TripService.OpenApi.json +The content of `trip.json` is similar at https://github.com/xuzhg/OData.OpenAPI/blob/main/Microsoft.OData.OpenAPI/Microsoft.OData.OpenAPI.Tests/Resources/TripService.OpenApi.json # Alternative Tool - Hidi diff --git a/tool/PoliCheck/RunPoliCheck.ps1 b/tool/PoliCheck/RunPoliCheck.ps1 index 92bb179d1..3eb663fbd 100644 --- a/tool/PoliCheck/RunPoliCheck.ps1 +++ b/tool/PoliCheck/RunPoliCheck.ps1 @@ -10,7 +10,7 @@ param( #Example: # RunPoliCheck.ps1 -BuildSourceDir "C:\BuildAgent\_work\32\s" # -folderName "src" -# -branchName "odata.net-master" +# -branchName "odata.net-main" # -resultRoot "C:\Users\ODatabld\Documents\PoliCheck\LatestRunResult" # -PoliCheckPath "C:\Program Files (x86)\Microsoft\PoliCheck\" # From 0e354cb99dc9ab546f37fdb0e989e82ea63a389a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Dec 2024 09:46:51 -0500 Subject: [PATCH 2/7] ci: renames master to main Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 8 ++++---- .github/policies/OpenAPI.NET.OData-branch-protection.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 4548a8e66..a33a99906 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -6,11 +6,11 @@ name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) trigger: branches: include: - - master + - main pr: branches: include: - - master + - main variables: buildPlatform: 'Any CPU' @@ -145,7 +145,7 @@ extends: - task: PowerShell@2 displayName: 'Validate project version has been incremented' - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded()) + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) inputs: targetType: 'filePath' filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 @@ -186,7 +186,7 @@ extends: PendingAnalysisWaitTimeoutMinutes: '5' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded()) + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) dependsOn: build jobs: - deployment: deploy diff --git a/.github/policies/OpenAPI.NET.OData-branch-protection.yml b/.github/policies/OpenAPI.NET.OData-branch-protection.yml index 42f6d7cf0..2b22c2441 100644 --- a/.github/policies/OpenAPI.NET.OData-branch-protection.yml +++ b/.github/policies/OpenAPI.NET.OData-branch-protection.yml @@ -9,9 +9,9 @@ resource: repository configuration: branchProtectionRules: - - branchNamePattern: master + - branchNamePattern: main # This branch pattern applies to the following branches as of 06/09/2024 20:45:44: - # master + # main # Specifies whether this branch can be deleted. boolean allowsDeletions: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cd365f878..5772937cb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ master ] + branches: [ main ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ main ] schedule: - cron: '32 2 * * 6' workflow_dispatch: From e6241db8f241ba651ea00323f24598b4d34b60a4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Dec 2024 09:53:24 -0500 Subject: [PATCH 3/7] ci: adds support v1 branch policies Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 6 ++-- .../OpenAPI.NET.OData-branch-protection.yml | 36 +++++++++++++++++++ .github/workflows/codeql-analysis.yml | 4 +-- .github/workflows/sonarcloud.yml | 1 + 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index a33a99906..54519682c 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -7,10 +7,12 @@ trigger: branches: include: - main + - support/v1 pr: branches: include: - main + - support/v1 variables: buildPlatform: 'Any CPU' @@ -145,7 +147,7 @@ extends: - task: PowerShell@2 displayName: 'Validate project version has been incremented' - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) + condition: and(or(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/support/v1')), succeeded()) inputs: targetType: 'filePath' filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 @@ -186,7 +188,7 @@ extends: PendingAnalysisWaitTimeoutMinutes: '5' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), 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 diff --git a/.github/policies/OpenAPI.NET.OData-branch-protection.yml b/.github/policies/OpenAPI.NET.OData-branch-protection.yml index 2b22c2441..7a91aec7e 100644 --- a/.github/policies/OpenAPI.NET.OData-branch-protection.yml +++ b/.github/policies/OpenAPI.NET.OData-branch-protection.yml @@ -13,6 +13,42 @@ configuration: # This branch pattern applies to the following branches as of 06/09/2024 20:45:44: # 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: false + # 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 + - Continuous Integration + - CodeQL + # Require branches to be up to date before merging. This should be false since the repo contains autogenerated files. 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 06/09/2024 20:45:44: + # support/v1 + # Specifies whether this branch can be deleted. boolean allowsDeletions: false # Specifies whether forced pushes are allowed on this branch. boolean diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5772937cb..56409ee78 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ main ] + branches: [ main, support/v1 ] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [ main, support/v1 ] schedule: - cron: '32 2 * * 6' workflow_dispatch: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 19e9543fe..567536c5f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - support/v1 paths-ignore: ['.vscode/**'] pull_request: types: [opened, synchronize, reopened] From 70c83d4ff7356095f9af9a44ddba94d3d1786718 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Dec 2024 10:04:02 -0500 Subject: [PATCH 4/7] chore: enables 1es tools in vscode Signed-off-by: Vincent Biret --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9cc75cead..9893070db 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,6 @@ "MD025": { "front_matter_title": "" } - } + }, + "azure-pipelines.1ESPipelineTemplatesSchemaFile": true } \ No newline at end of file From 9b966172f2cf4ff1b50db8b4152a9af961633b49 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Dec 2024 10:46:13 -0500 Subject: [PATCH 5/7] security: fix #611 switches to input Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 54519682c..ee1fdf1d9 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -192,6 +192,13 @@ extends: dependsOn: build jobs: - deployment: deploy + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' environment: nuget-org strategy: runOnce: @@ -199,15 +206,10 @@ 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: - packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.OData.*.nupkg' + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.OData.*.nupkg' nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' packageParentPath: '$(Pipeline.Workspace)' From dcbb719839bb03f64c740022e062b6a7b13d9971 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Dec 2024 10:48:51 -0500 Subject: [PATCH 6/7] ci: adds github release Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index ee1fdf1d9..6f608aeab 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -213,4 +213,47 @@ extends: nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' packageParentPath: '$(Pipeline.Workspace)' + + - 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.OData", "" -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' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: create + tagSource: userSpecifiedTag + tag: '$(artifactVersion)' + title: '$(artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.nupkg' + 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 c90412f4810ad37d2801968e508c688e01f15dda Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Dec 2024 10:51:34 -0500 Subject: [PATCH 7/7] fix: adds missing v prefix for github release Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 6f608aeab..ee410f158 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -244,8 +244,8 @@ extends: gitHubConnection: 'Github-MaggieKimani1' action: create tagSource: userSpecifiedTag - tag: '$(artifactVersion)' - title: '$(artifactVersion)' + tag: 'v$(artifactVersion)' + title: 'v$(artifactVersion)' releaseNotesSource: inline assets: '$(Pipeline.Workspace)\**\*.nupkg' changeLogType: issueBased