Skip to content

Commit

Permalink
why are we using our old methodology of globally set variables when o…
Browse files Browse the repository at this point in the history
…ur proxy_startup.py HANDLES THIS FOR US
  • Loading branch information
scbedd committed Sep 27, 2024
1 parent 6be5091 commit 4ea32d9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 33 deletions.
7 changes: 2 additions & 5 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,8 @@ function Get-python-DocsMsMetadataForPackage($PackageInfo) {

function Import-Dev-Cert-python
{
Write-Host "Python Trust Methodology"

$pathToScript = Resolve-Path (Join-Path -Path $PSScriptRoot -ChildPath "../../scripts/devops_tasks/trust_proxy_cert.py")
python -m pip install requests
python $pathToScript
Write-Host "Python no longer requires an out of proc trust methodology." `
"The variables SSL_CERT_DIR, SSL_CERT_FILE, and REQUESTS_CA_BUNDLE are now dynamically set in proxy_startup.py"
}

# Defined in common.ps1 as:
Expand Down
45 changes: 19 additions & 26 deletions scripts/devops_tasks/tox_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ def handle_proxy_presence(package_path: str) -> None:
def execute_tox_serial(tox_command_tuples):
return_code = 0

original_env = os.environ.copy()

for index, cmd_tuple in enumerate(tox_command_tuples):
tox_dir = os.path.abspath(os.path.join(cmd_tuple[1], "./.tox/"))
clone_dir = os.path.abspath(os.path.join(cmd_tuple[1], "..", "..", "..", "l"))
Expand All @@ -219,30 +217,25 @@ def execute_tox_serial(tox_command_tuples):
"Running tox for {}. {} of {}.".format(os.path.basename(cmd_tuple[1]), index + 1, len(tox_command_tuples))
)

handle_proxy_presence(cmd_tuple[1])
try:
result = run_check_call(cmd_tuple[0], cmd_tuple[1], always_exit=False)

if result is not None and result != 0:
return_code = result

if in_ci():
collect_log_files(cmd_tuple[1])

cleanup_tox_environments(tox_dir, cmd_tuple[0])

if os.path.exists(clone_dir):
try:
cleanup_directory(clone_dir)
except Exception as e:
# git has a permissions problem. one of the files it drops
# cannot be removed as no one has the permission to do so.
# lets log just in case, but this should really only affect windows machines.
logging.info(e)
pass
finally:
os.environ.clear()
os.environ.update(original_env)
result = run_check_call(cmd_tuple[0], cmd_tuple[1], always_exit=False)

if result is not None and result != 0:
return_code = result

if in_ci():
collect_log_files(cmd_tuple[1])

cleanup_tox_environments(tox_dir, cmd_tuple[0])

if os.path.exists(clone_dir):
try:
cleanup_directory(clone_dir)
except Exception as e:
# git has a permissions problem. one of the files it drops
# cannot be removed as no one has the permission to do so.
# lets log just in case, but this should really only affect windows machines.
logging.info(e)
pass

return return_code

Expand Down
3 changes: 1 addition & 2 deletions tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# otherwise fall back to pypi package tomli
import tomli as toml

import yaml

from typing import Dict, List, Tuple, Any, Optional

# Assumes the presence of setuptools
Expand Down Expand Up @@ -201,6 +199,7 @@ def get_ci_config(package_path: str) -> Optional[Dict[str, Any]]:
ci_file = os.path.join(os.path.dirname(package_path), "ci.yml")

if os.path.exists(ci_file):
import yaml
try:
with open(ci_file, "r") as f:
return yaml.safe_load(f)
Expand Down

0 comments on commit 4ea32d9

Please sign in to comment.