From 032bc0c5ef8df21a41a34aef5b7f0a73b4479634 Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Wed, 21 May 2025 00:33:10 +0000 Subject: [PATCH 1/4] 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/4] 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, From 5c02230ad628ad8501c0fdf77d8dd48e55e3c539 Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Sat, 24 May 2025 17:38:48 +0000 Subject: [PATCH 3/4] Simplify redundant expression --- monitoring/uss_qualifier/fileio.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/monitoring/uss_qualifier/fileio.py b/monitoring/uss_qualifier/fileio.py index 56b12ab875..8119f78b9b 100644 --- a/monitoring/uss_qualifier/fileio.py +++ b/monitoring/uss_qualifier/fileio.py @@ -80,9 +80,7 @@ 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 and os.environ.get( - github_private_repos_key - ): + if 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, From 6881f4955f71a007fe584166b2bd57463505f88a Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Sat, 24 May 2025 17:57:09 +0000 Subject: [PATCH 4/4] Add docker and compose version info to workflow definitions --- .github/workflows/ci.yml | 2 ++ .github/workflows/monitoring-test.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b14789778..20427cfa37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,8 @@ jobs: echo "Repository: ${{ github.repository }}" echo "Branch: ${{ github.ref }}" docker images + docker version + docker compose version - name: Checkout uses: actions/checkout@v4 with: diff --git a/.github/workflows/monitoring-test.yml b/.github/workflows/monitoring-test.yml index 8fd8c2d065..10647f1f9f 100644 --- a/.github/workflows/monitoring-test.yml +++ b/.github/workflows/monitoring-test.yml @@ -27,6 +27,8 @@ jobs: echo "Repository: ${{ github.repository }}" echo "Branch: ${{ github.ref }}" docker images + docker version + docker compose version - name: Checkout uses: actions/checkout@v4 with: