Skip to content

Commit f3dc5d7

Browse files
authored
Resolve SSL Cert Failures in CI (#26965)
* add optional ca_certs arg to urllib3 connection pool to ensure that ubuntu tests are not broken by the requests -> urllib3 swap
1 parent 687421c commit f3dc5d7

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

scripts/devops_tasks/trust_proxy_cert.py

-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ def combine_cert_file():
3333
print("Set the following certificate paths:")
3434
print("\tSSL_CERT_DIR={}".format(os.path.dirname(COMBINED_LOCATION)))
3535
print("\tREQUESTS_CA_BUNDLE={}".format(COMBINED_LOCATION))
36-
print("\tDEFAULT_CA_BUNDLE_PATH={}".format(COMBINED_LOCATION))
3736

3837
if os.getenv('TF_BUILD', False):
3938
print("##vso[task.setvariable variable=SSL_CERT_DIR]{}".format(os.path.dirname(COMBINED_LOCATION)))
4039
print("##vso[task.setvariable variable=REQUESTS_CA_BUNDLE]{}".format(COMBINED_LOCATION))
41-
print("##vso[task.setvariable variable=DEFAULT_CA_BUNDLE_PATH]{}".format(COMBINED_LOCATION))
4240

tools/azure-sdk-tools/pypi_tools/pypi.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import pdb
44
from urllib3 import Retry, PoolManager
55
import json
6+
import os
7+
68

79
def get_pypi_xmlrpc_client():
810
"""This is actually deprecated client."""
@@ -14,23 +16,24 @@ def get_pypi_xmlrpc_client():
1416
class PyPIClient:
1517
def __init__(self, host="https://pypi.org"):
1618
self._host = host
17-
self._http = PoolManager(retries=Retry(total=3, raise_on_status=True))
19+
self._http = PoolManager(
20+
retries=Retry(total=3, raise_on_status=True), ca_certs=os.getenv("REQUESTS_CA_BUNDLE", None)
21+
)
1822

1923
def project(self, package_name):
2024
response = self._http.request(
21-
'get',
22-
"{host}/pypi/{project_name}/json".format(host=self._host, project_name=package_name)
25+
"get", "{host}/pypi/{project_name}/json".format(host=self._host, project_name=package_name)
2326
)
24-
return json.loads(response.data.decode('utf-8'))
27+
return json.loads(response.data.decode("utf-8"))
2528

2629
def project_release(self, package_name, version):
2730
response = self._http.request(
28-
'get',
31+
"get",
2932
"{host}/pypi/{project_name}/{version}/json".format(
3033
host=self._host, project_name=package_name, version=version
31-
)
34+
),
3235
)
33-
return json.loads(response.data.decode('utf-8'))
36+
return json.loads(response.data.decode("utf-8"))
3437

3538
def filter_packages_for_compatibility(self, package_name, version_set):
3639
# only need the packaging.specifiers import if we're actually executing this filter.

0 commit comments

Comments
 (0)