Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
113 stars 177 forks source link

LintDiff throws AutoRest error when a specs PR moves README / renames dir #7748

Closed konrad-jamrozik closed 8 months ago

konrad-jamrozik commented 8 months ago

Affected PR:

Failing check:

ADO log:

2024-02-26T03:11:43.4688807Z ENTER definition momentOfTruth.runLintDiffForBranch. beforeOrAfter: after, branchName: pull/17115/merge
2024-02-26T03:11:43.4689653Z Processing "specification/messagingconnectors/resource-manager/readme.md". beforeOrAfter "after":
2024-02-26T03:11:43.4692102Z ENTER definition momentOfTruth.executeAutoRestWithLintDiff. swaggerPath: specification/messagingconnectors/resource-manager/readme.md, tag: package-2024-01-20-preview, beforeOrAfter: after, openapiType: undefined, rpaasLint: false
2024-02-26T03:11:43.4732939Z Executing AutoRest with LintDiff: node /mnt/vss/_work/_tasks/AzureApiValidation_5654d05d-82c1-48da-ad8f-161b817f6d41/0.0.79/private/azure-swagger-validation/azureSwaggerValidation/node_modules/autorest/dist/app.js --v3 --spectral --azure-validator --semantic-validator=false --model-validator=false --message-format=json --openapi-type=arm --openapi-subtype=arm  --use=@microsoft.azure/openapi-validator@2.1.7 --tag=package-2024-01-20-preview /mnt/vss/_work/1/azure-rest-api-specs-pr/specification/messagingconnectors/resource-manager/readme.md

2024-02-26T03:11:58.2476687Z Processing "specification/messagingconnector/resource-manager/readme.md". beforeOrAfter "after":
2024-02-26T03:11:58.2477434Z ENTER definition momentOfTruth.executeAutoRestWithLintDiff. swaggerPath: specification/messagingconnector/resource-manager/readme.md, tag: null, beforeOrAfter: after, openapiType: undefined, rpaasLint: false
2024-02-26T03:11:58.2478178Z parse failed with msg:Error: ENOENT: no such file or directory, open 'specification/messagingconnector/resource-manager/readme.md'
2024-02-26T03:11:58.2479381Z Executing AutoRest with LintDiff: node /mnt/vss/_work/_tasks/AzureApiValidation_5654d05d-82c1-48da-ad8f-161b817f6d41/0.0.79/private/azure-swagger-validation/azureSwaggerValidation/node_modules/autorest/dist/app.js --v3 --spectral --azure-validator --semantic-validator=false --model-validator=false --message-format=json --openapi-type=arm --openapi-subtype=arm  --use=@microsoft.azure/openapi-validator@2.1.7 /mnt/vss/_work/1/azure-rest-api-specs-pr/specification/messagingconnector/resource-manager/readme.md
2024-02-26T03:12:00.0879945Z Execution of AutoRest with LintDiff done. Error is not null: true, stdout contains AutoRest 'error': true, stdout contains AutoRest 'fatal': false, stderr contains AutoRest 'error': false, stderr contains AutoRest 'fatal': false
2024-02-26T03:12:00.0881138Z RETURN definition momentOfTruth.executeAutoRestWithLintDiff.
2024-02-26T03:12:00.0881696Z {"level":"information","message":"AutoRest core version selected from configuration: ^3.2.0."}
2024-02-26T03:12:00.0887243Z 
2024-02-26T03:12:00.0888049Z There is a new version of AutoRest available (3.7.1).
2024-02-26T03:12:00.0888814Z  > You can install the newer version with with npm install -g autorest@latest
2024-02-26T03:12:00.0889066Z 
2024-02-26T03:12:00.0889764Z {"level":"information","message":"> Loading AutoRest extension '@microsoft.azure/openapi-validator' (2.1.7->2.1.7)"}
2024-02-26T03:12:00.0890655Z {"level":"error","message":"[Exception] No input files provided.\n\nUse --help to get help information or see https://aka.ms/autorest/cli for additional documentation"}
2024-02-26T03:12:00.0904228Z {"level":"error","message":"!Error: [Exception] No input files provided.\n\nUse --help to get help information or see https://aka.ms/autorest/cli for additional documentation"}
2024-02-26T03:12:00.0905499Z {"level":"error","message":"Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing."}

2024-02-26T03:12:00.0909682Z ENTER definition momentOfTruth.runLintDiffForBranch. beforeOrAfter: before, branchName: RPSaaSMaster
2024-02-26T03:12:00.0910215Z Processing "specification/messagingconnectors/resource-manager/readme.md". beforeOrAfter "before":
2024-02-26T03:12:00.0910889Z ENTER definition momentOfTruth.executeAutoRestWithLintDiff. swaggerPath: specification/messagingconnectors/resource-manager/readme.md, tag: null, beforeOrAfter: before, openapiType: undefined, rpaasLint: false
2024-02-26T03:12:00.0917144Z Executing AutoRest with LintDiff: node /mnt/vss/_work/_tasks/AzureApiValidation_5654d05d-82c1-48da-ad8f-161b817f6d41/0.0.79/private/azure-swagger-validation/azureSwaggerValidation/node_modules/autorest/dist/app.js --v3 --spectral --azure-validator --semantic-validator=false --model-validator=false --message-format=json --openapi-type=arm --openapi-subtype=arm  --use=@microsoft.azure/openapi-validator@2.1.7 /mnt/vss/_work/1/lint-c93b354fd9c14905bb574a8834c4d69b/specification/messagingconnectors/resource-manager/readme.md
2024-02-26T03:12:02.0424393Z Execution of AutoRest with LintDiff done. Error is not null: true, stdout contains AutoRest 'error': true, stdout contains AutoRest 'fatal': false, stderr contains AutoRest 'error': false, stderr contains AutoRest 'fatal': false
2024-02-26T03:12:02.0426025Z RETURN definition momentOfTruth.executeAutoRestWithLintDiff.
2024-02-26T03:12:02.0426875Z {"level":"information","message":"AutoRest core version selected from configuration: ^3.2.0."}
2024-02-26T03:12:02.0427283Z 
2024-02-26T03:12:02.0427824Z There is a new version of AutoRest available (3.7.1).
2024-02-26T03:12:02.0428687Z  > You can install the newer version with with npm install -g autorest@latest
2024-02-26T03:12:02.0429002Z 
2024-02-26T03:12:02.0429829Z {"level":"information","message":"> Loading AutoRest extension '@microsoft.azure/openapi-validator' (2.1.7->2.1.7)"}
2024-02-26T03:12:02.0431028Z {"level":"error","message":"[Exception] No input files provided.\n\nUse --help to get help information or see https://aka.ms/autorest/cli for additional documentation"}
2024-02-26T03:12:02.0432115Z {"level":"error","message":"!Error: [Exception] No input files provided.\n\nUse --help to get help information or see https://aka.ms/autorest/cli for additional documentation"}
2024-02-26T03:12:02.0432891Z {"level":"error","message":"Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing."}

2024-02-26T03:12:02.0440260Z ENTER definition momentOfTruth.executeAutoRestWithLintDiff. swaggerPath: specification/messagingconnector/resource-manager/readme.md, tag: null, beforeOrAfter: before, openapiType: undefined, rpaasLint: false
2024-02-26T03:12:02.0440970Z parse failed with msg:Error: ENOENT: no such file or directory, open 'specification/messagingconnector/resource-manager/readme.md'
2024-02-26T03:12:02.0442185Z Executing AutoRest with LintDiff: node /mnt/vss/_work/_tasks/AzureApiValidation_5654d05d-82c1-48da-ad8f-161b817f6d41/0.0.79/private/azure-swagger-validation/azureSwaggerValidation/node_modules/autorest/dist/app.js --v3 --spectral --azure-validator --semantic-validator=false --model-validator=false --message-format=json --openapi-type=arm --openapi-subtype=arm  --use=@microsoft.azure/openapi-validator@2.1.7 /mnt/vss/_work/1/lint-c93b354fd9c14905bb574a8834c4d69b/specification/messagingconnector/resource-manager/readme.md

Riot-cause analysis

The PR has moved:

specification/messagingconnector/resource-manager/readme.md -> specification/messagingconnectors/resource-manager/readme.md

LintDiff runs AutoRest 4 times, with following results:

Branch Run type Path dir Result
pull/17115/merge after messagingconnectors OK
pull/17115/merge after messagingconnector AutoRest Error
RPSaaSMaster before messagingconnectors AutoRest Error
RPSaaSMaster before messagingconnector OK

As we can see, the after run on messagingconnector fails, because this is branch pull/17115/merge after the README has been moved to messagingconnectors.

Similarly, the before run on messagingconnectors fails, because this is branch RPSaaSMaster before the README has been moved to messagingconnectors.

konrad-jamrozik commented 8 months ago

PR with a fix: