This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new aade25537b2 Fix registry build failure when logos directory is empty 
(#63767)
aade25537b2 is described below

commit aade25537b2431ce2dffb7f72d65ad9acd161595
Author: Kaxil Naik <[email protected]>
AuthorDate: Tue Mar 17 00:31:01 2026 +0000

    Fix registry build failure when logos directory is empty (#63767)
    
    extract_metadata.py unconditionally creates dev/registry/logos/ even
    when no logos are found (e.g. incremental build for a provider without
    logos). The workflow's `if [ -d ... ]` check passes for the empty
    directory, then `cp -r logos/*` fails because the glob doesn't expand.
    
    Fix both sides:
    - Workflow: check directory is non-empty before glob-based cp
    - extract_metadata.py: create logo directories lazily, only when a
      logo is actually found
---
 .github/workflows/registry-build.yml | 14 +++++++++-----
 dev/registry/extract_metadata.py     |  7 +++++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/registry-build.yml 
b/.github/workflows/registry-build.yml
index 15e844faab8..09b1a9b8dc6 100644
--- a/.github/workflows/registry-build.yml
+++ b/.github/workflows/registry-build.yml
@@ -195,13 +195,17 @@ jobs:
           cp \
             "${REGISTRY_DATA_DIR}/${REGISTRY_MODULES_JSON}" \
             "${REGISTRY_SITE_DATA_DIR}/${REGISTRY_MODULES_JSON}"
-          if [ -d "${REGISTRY_DATA_DIR}/output/versions" ]; then
-            cp -r "${REGISTRY_DATA_DIR}/output/versions/"* 
"${REGISTRY_SITE_VERSIONS_DIR}/"
+          VERSIONS_SRC="${REGISTRY_DATA_DIR}/output/versions"
+          if [ -d "${VERSIONS_SRC}" ] && ls "${VERSIONS_SRC}/"* &>/dev/null; 
then
+            cp -r "${VERSIONS_SRC}/"* "${REGISTRY_SITE_VERSIONS_DIR}/"
           fi
-          # Copy provider logos extracted from 
providers/*/docs/integration-logos/
-          if [ -d "${REGISTRY_DATA_DIR}/logos" ]; then
+          # Copy provider logos extracted by extract_metadata.py.
+          # The directory may exist but be empty (incremental build for
+          # a provider without logos), so check for files before copying.
+          LOGOS_SRC="${REGISTRY_DATA_DIR}/logos"
+          if [ -d "${LOGOS_SRC}" ] && ls "${LOGOS_SRC}/"* &>/dev/null; then
             mkdir -p "${REGISTRY_SITE_LOGOS_DIR}"
-            cp -r "${REGISTRY_DATA_DIR}/logos/"* "${REGISTRY_SITE_LOGOS_DIR}/"
+            cp -r "${LOGOS_SRC}/"* "${REGISTRY_SITE_LOGOS_DIR}/"
           fi
 
       - name: "Setup pnpm"
diff --git a/dev/registry/extract_metadata.py b/dev/registry/extract_metadata.py
index 6676d85c414..2f7ba8afeb0 100644
--- a/dev/registry/extract_metadata.py
+++ b/dev/registry/extract_metadata.py
@@ -484,12 +484,14 @@ def main():
         # Write logos to dev/registry/logos/ — this directory is mounted in
         # breeze (unlike registry/public/) so copies survive the container.
         # Also copy to registry/public/logos/ for local dev convenience.
+        # Directories are created lazily (only when a logo is found) to avoid
+        # empty dirs that trip up glob-based cp in the CI workflow.
         logos_dest_dir = SCRIPT_DIR / "logos"
-        logos_dest_dir.mkdir(parents=True, exist_ok=True)
         registry_logos_dir = SCRIPT_DIR.parent.parent / "registry" / "public" 
/ "logos"
-        registry_logos_dir.mkdir(parents=True, exist_ok=True)
 
         if integration_logos_dir.exists():
+            logos_dest_dir.mkdir(parents=True, exist_ok=True)
+
             # First, check for priority logos for known providers
             if provider_id in logo_priority_map:
                 for priority_logo in logo_priority_map[provider_id]:
@@ -538,6 +540,7 @@ def main():
             logo_filename = logo.split("/")[-1]
             src = logos_dest_dir / logo_filename
             if src.exists():
+                registry_logos_dir.mkdir(parents=True, exist_ok=True)
                 shutil.copy2(src, registry_logos_dir / logo_filename)
 
         # Extract connection types from provider.yaml

Reply via email to