Skip to content

Commit 9d7a1fa

Browse files
authored
new debug function (Azure#25853)
1 parent 8552ac7 commit 9d7a1fa

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

scripts/auto_release/PythonSdkLiveTest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
export SPEC_README=$(SPEC_README)
6666
export SPEC_REPO=$(pwd)/azure-rest-api-specs
6767
export TEMP_FOLDER=$(pwd)/temp_folder
68+
export DEBUG_REST_BRANCH=$(DEBUG_REST_BRANCH)
6869
fi
6970
7071
# create virtual env
@@ -89,6 +90,7 @@ jobs:
8990
export STORAGE_CONN_STR=$(storage-conn-str)
9091
export STORAGE_ENDPOINT=$(storage-endpoint)
9192
export PYTHON_TAG=$(PYTHON_TAG)
93+
export DEBUG_SDK_BRANCH=$(DEBUG_SDK_BRANCH)
9294
9395
# run
9496
cd azure-sdk-for-python

scripts/auto_release/main.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@ def all_files(path: str, files: List[str]):
8080
files.append(folder)
8181

8282

83-
def checkout_azure_default_branch():
84-
usr = 'Azure'
85-
branch = 'main'
86-
print_exec(f'git remote add {usr} https://github.com/{usr}/azure-sdk-for-python.git')
87-
print_check(f'git fetch {usr} {branch}')
88-
print_check(f'git checkout {usr}/{branch}')
89-
90-
9183
def modify_file(file_path: str, func: Any):
9284
with open(file_path, 'r') as file_in:
9385
content = file_in.readlines()
@@ -168,8 +160,27 @@ def get_sdk_folder_with_autorest_result(self):
168160
generate_result = self.get_autorest_result()
169161
self.sdk_folder = generate_result["packages"][0]["path"][0].split('/')[-1]
170162

163+
@staticmethod
164+
def checkout_branch(env_key: str, repo: str):
165+
env_var = os.getenv(env_key, "")
166+
usr = env_var.split(":")[0] or "Azure"
167+
branch = env_var.split(":")[-1] or "main"
168+
print_exec(f'git remote add {usr} https://github.com/{usr}/{repo}.git')
169+
print_check(f'git fetch {usr} {branch}')
170+
print_check(f'git checkout {usr}/{branch}')
171+
172+
@return_origin_path
173+
def checkout_azure_default_branch(self):
174+
# checkout branch in sdk repo
175+
self.checkout_branch("DEBUG_SDK_BRANCH", "azure-sdk-for-python")
176+
177+
# checkout branch in rest repo
178+
if self.spec_repo:
179+
os.chdir(Path(self.spec_repo))
180+
self.checkout_branch("DEBUG_REST_BRANCH", "azure-rest-api-specs")
181+
171182
def generate_code(self):
172-
checkout_azure_default_branch()
183+
self.checkout_azure_default_branch()
173184

174185
# prepare input data
175186
input_data = {

0 commit comments

Comments
 (0)