From a4862778c55fab5b7b145342a3c71d937d6a3b30 Mon Sep 17 00:00:00 2001 From: xiaofeicao Date: Sun, 28 Apr 2024 17:15:02 +0800 Subject: [PATCH 1/5] typespec generation pipeline echo command PR_TITLE --- eng/mgmt/automation/generation_typespec.yml | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 eng/mgmt/automation/generation_typespec.yml diff --git a/eng/mgmt/automation/generation_typespec.yml b/eng/mgmt/automation/generation_typespec.yml new file mode 100644 index 000000000000..0051362c3208 --- /dev/null +++ b/eng/mgmt/automation/generation_typespec.yml @@ -0,0 +1,46 @@ +trigger: none + +pr: none + +pool: + vmImage: 'ubuntu-20.04' + +variables: +- group: Release Secrets for GitHub +- name: MAVEN_CACHE_FOLDER + value: $(Pipeline.Workspace)/.m2/repository +- name: MAVEN_OPTS + value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' +- name: NodeVersion + value: '16.x' + +steps: +- bash: | + sudo apt-get install -y --upgrade python3-pip python3-setuptools + pip3 install --upgrade wheel + pip3 install --upgrade PyYAML requests + displayName: Update python + +- task: NodeTool@0 + displayName: 'Install Node.js $(NodeVersion)' + inputs: + versionSpec: '$(NodeVersion)' + +- bash: | + npm install -g @azure-tools/typespec-client-generator-cli + displayName: 'Install tsp-client' + +- bash: | + export PATH=$JAVA_HOME_11_X64/bin:$PATH + java -version + set -x + ./eng/mgmt/automation/generate.py --tsp-config "$(TSP_CONFIG)" --version "$(VERSION)" --auto-commit-external-change --user-name "azure-sdk" --user-email "azuresdk@microsoft.com" + displayName: Generation + +- template: /eng/common/pipelines/templates/steps/create-pull-request.yml + parameters: + PRBranchName: fluent-lite-generation-$(Build.BuildId) + CommitMsg: '$(AUTOMATION_PR_TITLE)' + PRTitle: '$(AUTOMATION_PR_TITLE)' + PRLabels: 'Mgmt - Track 2' + OpenAsDraft: '$(DRAFT_PULL_REQUEST)' From 596671ba7a3bdd1ba050fcfda433aa05b8f7b970 Mon Sep 17 00:00:00 2001 From: xiaofeicao Date: Tue, 30 Apr 2024 14:53:05 +0800 Subject: [PATCH 2/5] generation typespec Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines Update generation.yml for Azure Pipelines --- eng/mgmt/automation/generation.yml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/eng/mgmt/automation/generation.yml b/eng/mgmt/automation/generation.yml index d1423af5d341..3ff9fd46f926 100644 --- a/eng/mgmt/automation/generation.yml +++ b/eng/mgmt/automation/generation.yml @@ -13,6 +13,8 @@ variables: value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - name: NodeVersion value: '16.x' +- name: fromTypeSpec + value: $[ne(variables['TSP_CONFIG'], '')] steps: - bash: | @@ -29,6 +31,12 @@ steps: - bash: | npm install -g autorest displayName: 'Install autorest' + condition: eq(variables.fromTypeSpec, false) + +- bash: | + npm install -g @azure-tools/typespec-client-generator-cli + displayName: 'Install tsp-client' + condition: eq(variables.fromTypeSpec, true) # - template: /eng/common/testproxy/test-proxy-tool.yml # parameters: @@ -38,13 +46,27 @@ steps: - bash: | export PATH=$JAVA_HOME_11_X64/bin:$PATH java -version + set -x + ./eng/mgmt/automation/generate.py --tsp-config "$(TSP_CONFIG)" --version "$(VERSION)" --auto-commit-external-change --user-name "azure-sdk" --user-email "azuresdk@microsoft.com" + displayName: Generation from TypeSpec + condition: eq(variables.fromTypeSpec, true) + +- bash: | + export PATH=$JAVA_HOME_11_X64/bin:$PATH + java -version + set -x ./eng/mgmt/automation/generate.py --readme "$(README)" --tag "$(TAG)" --autorest-options="$(AUTOREST_OPTIONS)" --service "$(SERVICE)" --version "$(VERSION)" --suffix "$(SUFFIX)" --auto-commit-external-change --user-name "azure-sdk" --user-email "azuresdk@microsoft.com" - displayName: Generation + displayName: Generation from Swagger + condition: eq(variables.fromTypeSpec, false) - template: /eng/common/pipelines/templates/steps/create-pull-request.yml parameters: PRBranchName: fluent-lite-generation-$(Build.BuildId) - CommitMsg: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' - PRTitle: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' + ${{ if variables.fromTypeSpec }}: + CommitMsg: '[Automation] Generate Fluent Lite from TypeSpec $(README)' + PRTitle: '[Automation] Generate Fluent Lite from $(README)' + ${{ else }}: + CommitMsg: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' + PRTitle: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' PRLabels: 'Mgmt - Track 2' OpenAsDraft: '$(DRAFT_PULL_REQUEST)' From 71d18ee497b2ff4019be1de42868374c1f6c2615 Mon Sep 17 00:00:00 2001 From: xiaofeicao Date: Tue, 30 Apr 2024 15:26:41 +0800 Subject: [PATCH 3/5] remove typespec pipeline file --- eng/mgmt/automation/generation_typespec.yml | 46 --------------------- 1 file changed, 46 deletions(-) delete mode 100644 eng/mgmt/automation/generation_typespec.yml diff --git a/eng/mgmt/automation/generation_typespec.yml b/eng/mgmt/automation/generation_typespec.yml deleted file mode 100644 index 0051362c3208..000000000000 --- a/eng/mgmt/automation/generation_typespec.yml +++ /dev/null @@ -1,46 +0,0 @@ -trigger: none - -pr: none - -pool: - vmImage: 'ubuntu-20.04' - -variables: -- group: Release Secrets for GitHub -- name: MAVEN_CACHE_FOLDER - value: $(Pipeline.Workspace)/.m2/repository -- name: MAVEN_OPTS - value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' -- name: NodeVersion - value: '16.x' - -steps: -- bash: | - sudo apt-get install -y --upgrade python3-pip python3-setuptools - pip3 install --upgrade wheel - pip3 install --upgrade PyYAML requests - displayName: Update python - -- task: NodeTool@0 - displayName: 'Install Node.js $(NodeVersion)' - inputs: - versionSpec: '$(NodeVersion)' - -- bash: | - npm install -g @azure-tools/typespec-client-generator-cli - displayName: 'Install tsp-client' - -- bash: | - export PATH=$JAVA_HOME_11_X64/bin:$PATH - java -version - set -x - ./eng/mgmt/automation/generate.py --tsp-config "$(TSP_CONFIG)" --version "$(VERSION)" --auto-commit-external-change --user-name "azure-sdk" --user-email "azuresdk@microsoft.com" - displayName: Generation - -- template: /eng/common/pipelines/templates/steps/create-pull-request.yml - parameters: - PRBranchName: fluent-lite-generation-$(Build.BuildId) - CommitMsg: '$(AUTOMATION_PR_TITLE)' - PRTitle: '$(AUTOMATION_PR_TITLE)' - PRLabels: 'Mgmt - Track 2' - OpenAsDraft: '$(DRAFT_PULL_REQUEST)' From 2eb57451b67576c804348e29bc2c609786666581 Mon Sep 17 00:00:00 2001 From: xiaofeicao Date: Tue, 30 Apr 2024 15:27:44 +0800 Subject: [PATCH 4/5] fix pr title --- eng/mgmt/automation/generation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/mgmt/automation/generation.yml b/eng/mgmt/automation/generation.yml index 3ff9fd46f926..a134073f6310 100644 --- a/eng/mgmt/automation/generation.yml +++ b/eng/mgmt/automation/generation.yml @@ -64,7 +64,7 @@ steps: PRBranchName: fluent-lite-generation-$(Build.BuildId) ${{ if variables.fromTypeSpec }}: CommitMsg: '[Automation] Generate Fluent Lite from TypeSpec $(README)' - PRTitle: '[Automation] Generate Fluent Lite from $(README)' + PRTitle: '[Automation] Generate Fluent Lite from TypeSpec $(README)' ${{ else }}: CommitMsg: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' PRTitle: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' From 9ab5b89a67ddaf66608fbc8c9419debb0d2b2f21 Mon Sep 17 00:00:00 2001 From: XiaofeiCao Date: Mon, 6 May 2024 10:27:41 +0800 Subject: [PATCH 5/5] address comments --- eng/mgmt/automation/generation.yml | 6 +++--- eng/mgmt/automation/generation_data.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/mgmt/automation/generation.yml b/eng/mgmt/automation/generation.yml index a134073f6310..ef7306beaa24 100644 --- a/eng/mgmt/automation/generation.yml +++ b/eng/mgmt/automation/generation.yml @@ -12,7 +12,7 @@ variables: - name: MAVEN_OPTS value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - name: NodeVersion - value: '16.x' + value: '18.x' - name: fromTypeSpec value: $[ne(variables['TSP_CONFIG'], '')] @@ -66,7 +66,7 @@ steps: CommitMsg: '[Automation] Generate Fluent Lite from TypeSpec $(README)' PRTitle: '[Automation] Generate Fluent Lite from TypeSpec $(README)' ${{ else }}: - CommitMsg: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' - PRTitle: '[Automation] Generate Fluent Lite from $(README)#$(TAG)' + CommitMsg: '[Automation] Generate Fluent Lite from Swagger $(README)#$(TAG)' + PRTitle: '[Automation] Generate Fluent Lite from Swagger $(README)#$(TAG)' PRLabels: 'Mgmt - Track 2' OpenAsDraft: '$(DRAFT_PULL_REQUEST)' diff --git a/eng/mgmt/automation/generation_data.yml b/eng/mgmt/automation/generation_data.yml index 55378d235324..7cacdc1877c9 100644 --- a/eng/mgmt/automation/generation_data.yml +++ b/eng/mgmt/automation/generation_data.yml @@ -12,7 +12,7 @@ variables: - name: MAVEN_OPTS value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - name: NodeVersion - value: '16.x' + value: '18.x' steps: - bash: |