Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to get correct autorest config #9857

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Failed to get correct autorest config #9857

wants to merge 9 commits into from

Conversation

wanlwanl
Copy link
Member

@wanlwanl wanlwanl commented Feb 18, 2025

Bugs:

@wanlwanl wanlwanl marked this pull request as ready for review February 18, 2025 10:01
@wanlwanl wanlwanl marked this pull request as draft February 19, 2025 03:11
@wanlwanl wanlwanl changed the title Failed to update package path and relative path Failed to update package path/ autorest config Feb 19, 2025
@wanlwanl wanlwanl changed the title Failed to update package path/ autorest config Failed to get correct autorest config Feb 19, 2025
@wanlwanl wanlwanl marked this pull request as ready for review February 20, 2025 01:07
@wanlwanl wanlwanl enabled auto-merge (squash) February 20, 2025 01:07
logger.warn(`Don't find autorest configuration in spec PR comment or sdk repository, skip generating codes.`);
logger.warn(`Failed to find autorest configuration in spec PR comment or sdk repository, skip generating codes.`);
logger.warn(`The autorest config file path should be 'sdk/<RP_NAME>-rest/swagger/README.md' in sdk repository, and the autorest config should contain one of the patterns:`);
logger.warn(`- input-file field contains the 'specification/<RP_NAME>/data-plane' in swagger repository.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there're cases where subfolder could exist after data-plane or resource-manager folder https://github.com/Azure/azure-rest-api-specs/blob/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/StackHCI/readme.md see this as an example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiaozha , it's a critical issue for sdk automation pipeline v2, could you prioritize the review? we must fix it ASAP.

Looks like the config is messy.

  • some sdks has "require" field in swagger/readme.md in sdk repo
  • some sdks has "input" field in swagger/readme.md in sk repo
  • this one you mention is different, doesn't have above 2 patterns. could you suggest the pattern?
  • any more patterns to avoid breaking sdk automation? can we limit the patterns we support? e.g. we only support the first two, if sdk autoamtion due to other patterns, we ask spec PR authors to fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why do you even care if it's require or input? That is just how autorest load the input swagger files, it's a codegen implementation detail. What SDK automation should care is the readme.md file location if it's generated from swagger which could exist in either SDK repo or in rest api specs repo.

  1. if it's in SDK repo, then it must exist in the SDK project folder like sdk/synapse/synapse-access-control-rest/swagger/README.md This is most commonly seeing from the data plane.
  2. if it's in the rest api specs repo, then it should follow the rest api spec folder guideline https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/directory-structure.md

Any cases that's violating the above two scenarios, should be fixed/reported in the automation.

Please note, the folder structure will change as there's new guideline which will unify the folder structure of both swagger and typespec, mgmt plane and data plane. But I don't think that part of work has started this semester. Please reach out to @mikeharder for more details.

Copy link
Contributor

@albertxavier100 albertxavier100 Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check line 185, autorest --version=3.9.7 ${path.basename(autorestConfigFilePath)} --output-folder=${packagePath}, autorest requires autorestConfig.

In case 1, the problem is how to find the swagger/README.md. From pipeline perspective, it does no know where the swagger/README.md is, 'cause the input readme file may not contain the info of output location. e.g. https://github.com/Azure/azure-rest-api-specs/blob/master/specification/apicenter/data-plane/readme.md. So the pipeline has to search for the swagger/readme.md matches the require... for input... pattern who indicate the spec is the one the pipeline is generating. If we cannot find it, the pipeline will stop sdk genreration. This is what current pipeline's behavior defined by previous owner.

In case 2, The doc you refer mentions The structure described in this article is recommended. There exist some exceptions for historical reasons. These exceptions are strongly discouraged going forward. So I'm discussing for cases including historical RPs who does not follow the recommendation.

Any cases that's violating the above two scenarios, should be fixed/reported in the automation.

fix or report? e.g. - from this readme, pipeline cannot locate the swagger/readme.md in sdk repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JS Automation Tool Fails to Process Multiple Packages
3 participants