Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into teom-hobovm08-01-preview
  • Loading branch information
Teo Magnino Chaban committed Jul 17, 2023
2 parents 4b9165d + 6bad115 commit 47adff6
Show file tree
Hide file tree
Showing 592 changed files with 23,213 additions and 5,138 deletions.
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/control_plane_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ARM (Control Plane) API Specification Update Pull Request

## PR review workflow diagram

Please understand this diagram before proceeding. It explains how to get your PR approved & merged.

![diagram](https://github.com/Azure/azure-rest-api-specs/assets/4429827/5e91ff2d-1f5c-4e96-87c2-390e7451da37)

## Purpose of this PR

What's the purpose of this PR? Check all that apply. This is **mandatory**!
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions .github/comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
**ACTION ITEM ALTERNATIVE C**: Report false positive. <br/>
If you think there are no breaking changes,
i.e. the validation should pass yet it fails,
then please explain why in a PR comment and @ the PR assignee.
then proceed as explained in **ACTION ITEM ALTERNATIVE B**.<br/>
This applies even if the breaking change tool fails with internal runtime error.
In such case a manual breaking change review is necessary.
- rule:
type: label
Expand All @@ -47,7 +49,9 @@
**ACTION ITEM ALTERNATIVE C**: Report false positive. <br/>
If you think there are no changes in existing API version,
i.e. there should be no `NewApiVersionRequired` label,
then please explain why in a PR comment and @ the PR assignee.
then proceed as explained in **ACTION ITEM ALTERNATIVE B**.<br/>
This applies even if the breaking change tool fails with internal runtime error.
In such case a manual breaking change review is necessary.
<br/><br/>
For additional guidance, please see https://aka.ms/NewApiVersionRequired
Expand Down
1 change: 1 addition & 0 deletions .github/pull_request_assignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# OpenAI data-plane PR
paths:
- "specification/cognitiveservices/data-plane/AzureOpenAI/**"
- "specification/cognitiveservices/OpenAI.Inference/**"
reviewers:
- lmazuel

Expand Down
12 changes: 10 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,13 @@
/specification/**/resource-manager/**/readme.typescript.md @qiaozha
/specification/**/resource-manager/**/readme.az.md @jsntcy @qiaozha
/specification/**/resource-manager/**/readme.cli.md @jsntcy @qiaozha
/specification/**/resource-manager/**/readme.go.md @ArcturusZhang
/specification/**/resource-manager/**/readme.python.md @msyyc @Wzb123456789
/specification/**/resource-manager/**/readme.go.md @tadelesh
/specification/**/resource-manager/**/readme.python.md @msyyc

###########
# Eng Sys
###########
/.azure-pipelines/ @weshaggard @mikeharder @konrad-jamrozik
/.github/ @weshaggard @mikeharder @konrad-jamrozik
/eng/ @weshaggard @mikeharder @konrad-jamrozik
/scripts/ @weshaggard @mikeharder @konrad-jamrozik
3 changes: 3 additions & 0 deletions custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ continuationtoken
continuousdataexports
continuouswebjobs
contoso
Contoso's
contosodataset
contosomedia
contributer
Expand Down Expand Up @@ -2175,6 +2176,7 @@ removeaclentries
removedefaultacl
removenodes
removex
reoffer
reparent
replicationdetails
replicationstatus
Expand Down Expand Up @@ -2775,6 +2777,7 @@ unarchive
unassign
unassignment
unassigns
unassigning
unattend
unbilled
unclaim
Expand Down
26 changes: 20 additions & 6 deletions documentation/ci-fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,20 @@ Or you can run it in [OpenAPI Hub](https://portal.azure-devex-tools.com/tools/st
Refer to [Semantic and Model Violations Reference](https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/Semantic-and-Model-Violations-Reference.md) for detailed description of validations and how-to-fix guidance.

## Breaking Change Check

- An API contract is identified by its api-version value. Once published, no changes to this API contract are allowed. This applies regardless of whether the API contract is for private preview, public preview, or GA (stable).
- The same-version breaking change linter rules check for changes to an existing api-version swagger.
- When introducing a new API contract (preview or not), the new API contract must be backwards compatible with the previous GA’s API contract.
- However, during a (private or public) preview cycle, a new preview API contract does not have to be backwards compatible with the previous preview API contract although it must still be backwards compatible with the latest GA API contract.
- The cross version breaking change linter rules checks for this by comparing the new swagger with the latest GA swagger. If there is no latest GA swagger, then the latest preview if it > 1 year old. If nether a GA or preview > 1 year old exists, then the swagger is considered good.
- When introducing a new API contract (preview or not), the new API contract must be backwards compatible with the previous GA’s API contract.
- However, during a (private or public) preview cycle, a new preview API contract does not have to be backwards compatible with the previous preview API contract although it must still be backwards compatible with the latest GA API contract.
- The cross version breaking change linter rules checks for this by comparing the new swagger with the latest GA swagger. If there is no latest GA swagger, then the latest preview if it > 1 year old. If nether a GA or preview > 1 year old exists, then the swagger is considered good.

### Adding label on PR automatically

### adding label on PR automatically
The breaking change check has two types of violations: one is breaking change in the same version but not breaking change in a new version, the other is breaking change even in a new version.
For the former, a label 'NewApiVersionRequired' will be added automatically; For the latter , a label 'BreakingChangeReviewRequired' will be added automatically. Adding each label will trigger a github comment with guildance on how to fix.
For the former, a label 'NewApiVersionRequired' will be added automatically; For the latter, a label 'BreakingChangeReviewRequired' will be added automatically. Adding each label will trigger a github comment with guildance on how to fix.

### Run locally

### run locally
run oad locally (the breaking change is reported by oad tool):
```
npm install -g @azure/oad
Expand Down Expand Up @@ -129,6 +132,15 @@ To fix this CI check failure, if you haven't got ARM signed off, pls get ARM sig

NOTE: If your RP is RPaaS RP, since RPaaS requires swagger merge first. In this case, you could ignore this CI check.

## API Doc Preview

If you see `Swagger ApiDocPreview ` check fail with a failure [like this one](https://github.com/Azure/azure-rest-api-specs/pull/24841/checks?check_run_id=15056283615):

| Rule | Message |
|-|-|
| ❌ RestBuild error | "logUrl":"https://apidrop.visualstudio.com/Content%20CI/_build/results?buildId=373646&view=logs&j=fd490c07-0b22-5182-fac9-6d67fe1e939b",<br/>"detail":"Run.ps1 failed with exit code 1 " |

Then refer to [this TSG](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/79/Generation-of-docs-on-learn.microsoft.com?anchor=%22swagger-apidocpreview%22-build-is-failing).

## Service API Readiness Test

Expand All @@ -147,6 +159,7 @@ To fix the check, download the artifact `api_scenario_test_output` from Azure pi
This validator is to ensure the TypeSpec & swagger files in PR are consistent and passing validation.

### How to fix

| Error Code |Severity |Solution |
|---|---|---|
|MissingTypeSpecFile| Error |Adding the related TypeSpec project into {RP-Name} folder, like [Qumulo.Manaement](https://github.com/Azure/azure-rest-api-specs/tree/main/specification/liftrqumulo/Qumulo.Management)|
Expand All @@ -163,6 +176,7 @@ See [typespec-autorest](https://azure.github.io/typespec-azure/docs/emitters/typ
This validator generates traffic for all operations defined in Swagger files under default tag of readme.md by using [RESTler](https://github.com/microsoft/restler-fuzzer). Then, it validates the request and response pairs from the traffic against the corresponding Swagger definitions. Finally, it provides an html report that reports the Swagger accuracy.

### How to understand and improve the report

Please refer to [swagger-accuracy-report](./swagger-accuracy-report.md).

## Suppression Process
Expand Down
22 changes: 0 additions & 22 deletions eng/pipelines/templates/steps/typespec-ci.yml

This file was deleted.

95 changes: 9 additions & 86 deletions eng/pipelines/typespec-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,15 @@ pr:
- typespec-next
paths:
include:
- package.json
- .gitattributes
- .prettierrc.json
- package-lock.json
- eng/pipelines/typespec-ci.yml
- eng/pipelines/templates/steps/typespec-ci.yml
- eng/tools/TypeSpecValidation
- specification/contosowidgetmanager
- specification/cognitiveservices
- specification/confidentialledger
- specification/containerservice
- specification/containerstorage
- specification/eventgrid
- specification/servicenetworking
- specification/sphere
- specification/translation
- package.json
- tsconfig.json
- eng

jobs:
- job: TypeSpecCI
- job: Validate_All_Specs
pool:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: ubuntu-22.04
Expand All @@ -40,76 +32,7 @@ jobs:
displayName: npm ls -a
condition: succeededOrFailed()

- script: npm run build
displayName: npm run build
- pwsh: |
$(Build.SourcesDirectory)/eng/scripts/Validate-TypeSpec.ps1 $(Build.SourcesDirectory)
displayName: Validate All Specs
condition: succeededOrFailed()

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/contosowidgetmanager/Contoso.WidgetManager
DisplayName: Contoso.WidgetManager

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/cognitiveservices/AnomalyDetector
DisplayName: AnomalyDetector

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/cognitiveservices/ContentSafety
DisplayName: ContentSafety

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/cognitiveservices/HealthInsights/healthinsights.openapi
DisplayName: healthinsights.openapi

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype
DisplayName: healthinsights.oncophenotype

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher
DisplayName: healthinsights.trialmatcher

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/cognitiveservices/OpenAI.Inference
DisplayName: OpenAI.Inference

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/confidentialledger/Microsoft.ManagedCcf
DisplayName: ManagedCcf

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/containerservice/Fleet.Management
DisplayName: Fleet.Management

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/containerstorage/ContainerStorage.Management
DisplayName: ContainerStorage.Management

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/eventgrid/Azure.Messaging.EventGrid
DisplayName: Messaging.EventGrid

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/servicenetworking/ServiceNetworking.Management
DisplayName: Microsoft.ServiceNetworking

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/sphere/Sphere.Management
DisplayName: Sphere.Management

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/translation/Azure.AI.TextTranslation
DisplayName: AI.TextTranslation
32 changes: 32 additions & 0 deletions eng/pipelines/typespec-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
trigger: none

pr:
branches:
include:
- main
- typespec-next
paths:
include:
- specification

jobs:
- job: Validate_Changed_Specs
pool:
name: azsdk-pool-mms-ubuntu-2204-general
vmImage: ubuntu-22.04

steps:
- script: npm ci
displayName: npm ci

- script: npm ls -a
displayName: npm ls -a
condition: succeededOrFailed()

- pwsh: |
$(Build.SourcesDirectory)/eng/scripts/Validate-TypeSpec.ps1 `
$(Build.SourcesDirectory) `
"origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" `
"${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}"
displayName: Validate Changed Specs
condition: succeededOrFailed()
27 changes: 27 additions & 0 deletions eng/scripts/Get-TypeSpec-Folders.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $true)]
[string] $SpecsRepoRootDirectory,
[Parameter(Position = 1, Mandatory = $false)]
[string]$TargetBranch,
[Parameter(Position = 2, Mandatory = $false)]
[string]$SourceBranch
)

$tspFiles = @()
if ([string]::IsNullOrEmpty($TargetBranch) -or [string]::IsNullOrEmpty($SourceBranch)) {
$tspFiles = (Get-ChildItem -path ./specification tspconfig.yaml -Recurse).FullName -replace "$($pwd.Path)/"
}
else {
Write-Host "git -c core.quotepath=off -c i18n.logoutputencoding=utf-8 diff --name-only `"$TargetBranch...$SourceBranch`" -- | Where-Object {`$_.StartsWith('specification')}"
$tspFiles = git -c core.quotepath=off -c i18n.logoutputencoding=utf-8 diff --name-only `"$TargetBranch...$SourceBranch`" -- | Where-Object {$_.StartsWith('specification')}
}

$typespecFolders = @()
foreach ($file in $tspFiles) {
$file -match 'specification\/[^\/]*\/' | out-null
$typespecFolders += (Get-ChildItem -path $matches[0] tspconfig.yaml -Recurse).Directory.FullName -replace "$($pwd.Path)/"
}
$typespecFolders = $typespecFolders | Select-Object -Unique

return $typespecFolders
25 changes: 25 additions & 0 deletions eng/scripts/Validate-TypeSpec.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $true)]
[string] $SpecsRepoRootDirectory,
[Parameter(Position = 1, Mandatory = $false)]
[string]$TargetBranch,
[Parameter(Position = 2, Mandatory = $false)]
[string]$SourceBranch
)

$typespecFolders = @()

$typespecFolders = &"$PSScriptRoot/Get-TypeSpec-Folders.ps1" "$SpecsRepoRootDirectory" "$TargetBranch" "$SourceBranch"

$exitCode = 0
foreach ($typespecFolder in $typespecFolders) {
npx --no tsv $typespecFolder 2>&1 | Write-Host
if ($LASTEXITCODE) {
$exitCode = 1
}
git restore .
git clean -df
}

exit $exitCode
6 changes: 5 additions & 1 deletion eng/tools/TypeSpecValidation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
},
"devDependencies": {
"@types/debug": "^4.1.8",
"@types/node": "^18.16.18"
"@types/node": "^18.16.18",
"typescript": "~5.0.4"
},
"scripts": {
"postinstall": "tsc"
}
}
5 changes: 4 additions & 1 deletion eng/tools/TypeSpecValidation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"compilerOptions": {
"target": "ES6",
"module": "Node16",
"outDir": "./dist"
"outDir": "./dist",

// override "importHelpers:true" in root tsconfig.json
"importHelpers": false
}
}
7 changes: 7 additions & 0 deletions eng/tools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "azure-rest-api-specs-eng-tools",
"devDependencies": {
"@azure-tools/typespec-validation": "file:TypeSpecValidation"
},
"private": true
}
Loading

0 comments on commit 47adff6

Please sign in to comment.