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

support track2 codegen in swagger pipeline #16257

Merged
merged 2 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .scripts/automation_generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
track2-codegen-automation-for-pipeline --inputJsonPath=$1 --outputJsonPath=$2 --use=@autorest/[email protected]
Copy link
Member

Choose a reason for hiding this comment

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

@dw511214992 I realize this is a very old PR but after looking through it I have a few questions and suggestions.

  • Where do we publish track2-codegen-automation-for-pipeline? It should probably be scripts in this repo
  • Can we please move these scripts under eng/scripts?
  • Can we please move the swagger_to_sdk_config.json under eng directory?

Copy link
Member Author

@dw511214992 dw511214992 Sep 8, 2021

Choose a reason for hiding this comment

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

Hi @weshaggard

  • Answer for question 1: the codes of track2-codegen-automation-for-pipeline is in DevOps Repository now, and we planned to move it to js sdk repository in next month (I don't have time to do it in this month, and I'll do it once I have time. Sorry for it)
  • Answer for question 2: I agree to put automation_generate.sh in eng/scripts, and I'll do it. However, the tool track2-codegen-automation-for-pipeline not only contains script for swagger pipeline, but also contains other tools, such as generating changelog, bumping version automatically, generate codes automatically in local. So I think it's better to put it in common/tools.
  • Answer for question 3: I don't think we can move swagger_to_sdk_config.json to other places because the swagger pipeline asks this file should be in the root of js sdk repository.

Thanks

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @dw511214992

  1. Cool yes I would like to get that tool moved into the repo and if possible under the eng folder. I'm trying to get more of the common/tools folder under eng as well.
  2. It is perfectly fine for all the script automation to be in the JS repo we have lots of similar scripts already. Part of the reason we want it in the repo is so we can share stuff where possible.
  3. You can move it to another location but it requires a change in in the specs repo. See https://github.com/Azure/azure-rest-api-specs/blob/main/specificationRepositoryConfiguration.json#L35 as an example. Ideally we would also not call the config "track2" either, I know a number of others already are so I won't worry much but I generally try to avoid code names like track 2 and instead use the versioning of the tool instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

@weshaggard thanks, and I'll do these tasks together. About moving the scripts to eng folder, the code in DevOps Repository is complex (it's a project) and I'm not sure whether moving it to eng folder is a good solution. Anywhere, I'll rethink about it.

6 changes: 6 additions & 0 deletions .scripts/automation_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# rush install
npm install -g @microsoft/rush
rush install
# install release tools
npm install -g azure-track2-js-sdk-release-tools
32 changes: 18 additions & 14 deletions swagger_to_sdk_config.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{
"$schema": "https://openapistorageprod.blob.core.windows.net/sdkautomation/prod/schemas/swagger_to_sdk_config.schema.json",
"meta": {
"autorest_options": {
"version": "V2",
"typescript": "",
"license-header": "MICROSOFT_MIT_NO_VERSION",
"sdkrel:typescript-sdks-folder": ".",
"use": "@microsoft.azure/[email protected]"
"advancedOptions": {
"createSdkPullRequests": true,
"generationCallMode": "one-per-config"
dw511214992 marked this conversation as resolved.
Show resolved Hide resolved
},
"initOptions": {
"initScript": {
"path": "sh .scripts/automation_init.sh"
}
},
"generateOptions": {
"generateScript": {
"path": "sh .scripts/automation_generate.sh",
"stderr": {
"showInComment": "^\\[AUTOREST\\]",
"scriptError": "^\\[ERROR\\]",
"scriptWarning": "^\\[WARNING\\]"
}
},
"advanced_options": {
"clone_dir": "./azure-sdk-for-js",
"create_sdk_pull_requests": true,
"sdk_generation_pull_request_base": "integration_branch"
},
"version": "0.2.0"
"parseGenerateOutput": true
}
}