Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
scripts: images containers manifest: Update cafile setting via contex…
Browse files Browse the repository at this point in the history
…t to avoid deperication warning for cafile usage

Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
pdxjohnny committed Jun 6, 2023
1 parent 2d8ed4b commit 7d381bf
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def path_to_image_name(path, root_path):


def main():
# For weird cases when system CAs are not being respected
# For example on Ubuntu run with REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
ssl_context = None
if "REQUESTS_CA_BUNDLE" in os.environ:
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ssl_context.load_verify_locations(os.environ["REQUESTS_CA_BUNDLE"])

# For running under GitHub actions within a container
if "GITHUB_WORKSPACE" in os.environ:
subprocess.check_call(["git", "config", "--global", "--add", "safe.directory", os.environ["GITHUB_WORKSPACE"]])
Expand Down Expand Up @@ -96,7 +103,7 @@ def main():
"Authorization": "bearer " + os.environ["GH_ACCESS_TOKEN"],
},
),
cafile=os.environ.get("REQUESTS_CA_BUNDLE", None),
context=ssl_context,
) as response:
response_json = json.load(response)
# Print for debug
Expand Down

0 comments on commit 7d381bf

Please sign in to comment.