From 8ff1bbf550f5deaa293a3748ee31fedc98bc1748 Mon Sep 17 00:00:00 2001 From: Wei Dong Date: Wed, 7 Jul 2021 16:20:10 +0800 Subject: [PATCH 1/2] support track2 codegen in swagger pipeline --- .scripts/automation_generate.sh | 7 +++++++ swagger_to_sdk_config.json | 27 +++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 .scripts/automation_generate.sh diff --git a/.scripts/automation_generate.sh b/.scripts/automation_generate.sh new file mode 100644 index 000000000000..9daab3bc5ccf --- /dev/null +++ b/.scripts/automation_generate.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# rush install +npm install -g @microsoft/rush +rush install +# generate +npm install -g azure-track2-js-sdk-release-tools +track2-codegen-automation-for-pipeline --inputJsonPath=$1 --outputJsonPath=$2 --use=@autorest/typescript@6.0.0-beta.5 diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index a5dbf1c2011a..b183d5f2ad30 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -1,18 +1,17 @@ { - "$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/autorest.typescript@4.7.0" + "advancedOptions": { + "createSdkPullRequests": true, + "generationCallMode": "one-per-config" + }, + "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 } } From f2583eff8df1e4eeac3f725fa579a216209d9685 Mon Sep 17 00:00:00 2001 From: dw511214992 Date: Fri, 9 Jul 2021 11:17:02 +0800 Subject: [PATCH 2/2] use init options --- .scripts/automation_generate.sh | 5 ----- .scripts/automation_init.sh | 6 ++++++ swagger_to_sdk_config.json | 11 ++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 .scripts/automation_init.sh diff --git a/.scripts/automation_generate.sh b/.scripts/automation_generate.sh index 9daab3bc5ccf..bc722cdd19fd 100644 --- a/.scripts/automation_generate.sh +++ b/.scripts/automation_generate.sh @@ -1,7 +1,2 @@ #!/usr/bin/env bash -# rush install -npm install -g @microsoft/rush -rush install -# generate -npm install -g azure-track2-js-sdk-release-tools track2-codegen-automation-for-pipeline --inputJsonPath=$1 --outputJsonPath=$2 --use=@autorest/typescript@6.0.0-beta.5 diff --git a/.scripts/automation_init.sh b/.scripts/automation_init.sh new file mode 100644 index 000000000000..313a0e3132dd --- /dev/null +++ b/.scripts/automation_init.sh @@ -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 diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index b183d5f2ad30..159192b300ea 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -3,13 +3,18 @@ "createSdkPullRequests": true, "generationCallMode": "one-per-config" }, + "initOptions": { + "initScript": { + "path": "sh .scripts/automation_init.sh" + } + }, "generateOptions": { "generateScript": { "path": "sh .scripts/automation_generate.sh", "stderr": { - "showInComment": "^\\[AUTOREST\\]", - "scriptError": "^\\[ERROR\\]", - "scriptWarning": "^\\[WARNING\\]" + "showInComment": "^\\[AUTOREST\\]", + "scriptError": "^\\[ERROR\\]", + "scriptWarning": "^\\[WARNING\\]" } }, "parseGenerateOutput": true