Skip to content

Commit b670acf

Browse files
authored
[SDK generation pipeline] install tsp-client locally (#43109)
* install tsp-client locally * update for auto_release
1 parent 48d4e43 commit b670acf

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

eng/tools/azure-sdk-tools/packaging_tools/generate_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ def gen_typespec(
516516
typespec_python = "@azure-tools/typespec-python"
517517
# call scirpt to generate sdk
518518
try:
519+
tsp_client = "npx --prefix eng/common/tsp-client tsp-client"
519520
if spec_folder:
520521
tsp_dir = (Path(spec_folder) / typespec_relative_path).resolve()
521522
repo_url = rest_repo_url.replace("https://github.com/", "")
@@ -527,15 +528,15 @@ def gen_typespec(
527528
content["options"]["@azure-tools/typespec-python"]["api-version"] = api_version
528529
with open(tspconfig, "w") as file_out:
529530
yaml.dump(content, file_out)
530-
cmd = f"tsp-client init --tsp-config {tsp_dir} --local-spec-repo {tsp_dir} --commit {head_sha} --repo {repo_url}"
531+
cmd = f"{tsp_client} init --tsp-config {tsp_dir} --local-spec-repo {tsp_dir} --commit {head_sha} --repo {repo_url}"
531532
else:
532533
tsp_config_url = f"{rest_repo_url}/blob/{head_sha}/{typespec_relative_path}/tspconfig.yaml"
533-
cmd = f"tsp-client init -c {tsp_config_url}"
534+
cmd = f"{tsp_client} init -c {tsp_config_url}"
534535
if run_in_pipeline:
535536
emitter_name = "@azure-tools/typespec-python"
536537
if not os.path.exists(f"node_modules/{emitter_name}"):
537538
_LOGGER.info("install dependencies only for the first run")
538-
check_output("tsp-client install-dependencies", stderr=STDOUT, shell=True)
539+
check_output(f"{tsp_client} install-dependencies", stderr=STDOUT, shell=True)
539540
else:
540541
_LOGGER.info(f"skip install since {emitter_name} is already installed")
541542
cmd += " --skip-install --debug"

scripts/auto_release/PythonSdkLiveTest.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ jobs:
6969
# install autorest
7070
sudo npm init -f
7171
sudo npm install -g autorest --save
72-
sudo npm install -g @azure-tools/typespec-client-generator-cli
7372
7473
mkdir temp_folder
7574
@@ -100,6 +99,10 @@ jobs:
10099
export TEST_FOLDER=$(TEST_FOLDER)
101100
export ISSUE_OWNER=$(ISSUE_OWNER)
102101
102+
# install tsp-client
103+
cd azure-sdk-for-python/eng/common/tsp-client
104+
npm ci
105+
cd ../../..
106+
103107
# run
104-
cd azure-sdk-for-python
105108
python $script_path/main.py

scripts/automation_init.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ pip install setuptools==78.1.0 > /dev/null
99
pip install setuptools-scm==8.3.0 > /dev/null
1010
pip install build==1.3.0 > /dev/null
1111

12-
# install tsp-client globally (local install may interfere with tooling)
12+
# install tsp-client
1313
echo Install tsp-client
14-
npm install -g @azure-tools/typespec-client-generator-cli > /dev/null
14+
cd eng/common/tsp-client
15+
npm ci > /dev/null
16+
cd ../../..
1517

1618
echo "{}" >> $2
1719
echo "[Generate] init success!!!"

0 commit comments

Comments
 (0)