From 032bc0c5ef8df21a41a34aef5b7f0a73b4479634 Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Wed, 21 May 2025 00:33:10 +0000 Subject: [PATCH 1/2] Fix run_locally.sh when GITHUB_PRIVATE_REPOS is empty --- monitoring/uss_qualifier/run_locally.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/monitoring/uss_qualifier/run_locally.sh b/monitoring/uss_qualifier/run_locally.sh index 26fe1389f9..6e6c3e93bb 100755 --- a/monitoring/uss_qualifier/run_locally.sh +++ b/monitoring/uss_qualifier/run_locally.sh @@ -60,6 +60,14 @@ else docker_args="-it" fi +# Initialize an empty string for additional Docker options +PRIVATE_REPOS_ENV_FLAG="" + +# Check if GITHUB_PRIVATE_REPOS is set and not empty +if [ -n "${GITHUB_PRIVATE_REPOS}" ]; then + PRIVATE_REPOS_ENV_FLAG="-e GITHUB_PRIVATE_REPOS=${GITHUB_PRIVATE_REPOS}" +fi + # shellcheck disable=SC2086 docker run ${docker_args} --name uss_qualifier \ --rm \ @@ -69,7 +77,7 @@ docker run ${docker_args} --name uss_qualifier \ -e PYTHONBUFFERED=1 \ -e AUTH_SPEC=${AUTH_SPEC} \ -e AUTH_SPEC_2=${AUTH_SPEC_2} \ - -e GITHUB_PRIVATE_REPOS=${GITHUB_PRIVATE_REPOS:-} \ + ${PRIVATE_REPOS_ENV_FLAG} \ -e MONITORING_GITHUB_ROOT=${MONITORING_GITHUB_ROOT:-} \ -v "$(pwd)/$OUTPUT_DIR:/app/$OUTPUT_DIR" \ -v "$(pwd)/$CACHE_DIR:/app/$CACHE_DIR" \ From a3906649edceab3c6c8a460a4f7ef9c5d03fcf78 Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Wed, 21 May 2025 00:34:25 +0000 Subject: [PATCH 2/2] Ignore empty GITHUB_PRIVATE_REPOS --- monitoring/uss_qualifier/fileio.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitoring/uss_qualifier/fileio.py b/monitoring/uss_qualifier/fileio.py index d349c29fbb..56b12ab875 100644 --- a/monitoring/uss_qualifier/fileio.py +++ b/monitoring/uss_qualifier/fileio.py @@ -80,7 +80,9 @@ def _get_web_content(url: str) -> str: # Check if this is a request to a private GitHub repo github_private_repos_key = "GITHUB_PRIVATE_REPOS" - if github_private_repos_key in os.environ: + if github_private_repos_key in os.environ and os.environ.get( + github_private_repos_key + ): github_match = re.match( r"^https://(?Pgithub\.com|raw\.githubusercontent\.com|api\.github\.com)/(?P[^/]*)/(?P[^/?#]*)(?P.*)$", url,