diff --git a/gha-script/create_wheel_wrapper.sh b/gha-script/create_wheel_wrapper.sh index b6aa6e7fb5..f9824df24e 100644 --- a/gha-script/create_wheel_wrapper.sh +++ b/gha-script/create_wheel_wrapper.sh @@ -197,7 +197,7 @@ if [ -n "$TEMP_BUILD_SCRIPT_PATH" ]; then package_url=$(grep -oP '(?<=^PACKAGE_URL=).*' "$TEMP_BUILD_SCRIPT_PATH" | tr -d '"') package_name=$(basename "$package_url" .git) - source "$TEMP_BUILD_SCRIPT_PATH" "$EXTRA_ARGS" "$PYTHON_VERSION" + source "$TEMP_BUILD_SCRIPT_PATH" "$EXTRA_ARGS" fi # checking if wheel is generated through script itself @@ -389,31 +389,25 @@ echo echo "=== Post Processing wheel ${wheel_final} with SHA: ${SHA256_VALUE} ===" echo -# In PR builds ENABLE_CVE_SCAN=false and COS credentials are absent. -# Skip post-processing entirely - PRs only verify the wheel builds, not publish them. -if [ "${ENABLE_CVE_SCAN:-true}" = "false" ]; then +# Post-processing: license injection, IBM classifier, version suffix, RECORD update. +# Always runs. When COS credentials are absent (PR builds), post_process_wheel.py +# skips only suffix resolution and uses fallback suffix "ppc64le0" instead. +if python ${POST_PROCESS_SCRIPT_PATH} ${wheel_final} ${SHA256_VALUE}; then echo - echo "===> Skipping post-processing in PR build (ENABLE_CVE_SCAN=false)." + echo "===> SUCCESS: Wheel post-processed successfully." echo else - # post processing of wheels (Suffix addition, license addition, metadata addition) - if python ${POST_PROCESS_SCRIPT_PATH} ${wheel_final} ${SHA256_VALUE}; then - echo - echo "===> SUCCESS: Wheels post process successfully." - echo - else - echo - echo "===> ERROR: Failed to post process wheels." - echo - exit 1 - fi + echo + echo "===> ERROR: Failed to post-process wheel." + echo + exit 1 fi # CVE scan runs after post-processing so the report is named after the final # wheel filename (with +ppc64leN suffix) from the start - no rename needed. +# Controlled by ENABLE_CVE_SCAN (default: true). Set to false in PR builds. wheel_post_processed=(*.whl) -# Call run_cve_scan - comment out this block locally to skip CVE scanning. if [ "${ENABLE_CVE_SCAN:-true}" = "false" ]; then echo echo "===> Skipping CVE scan (ENABLE_CVE_SCAN=false)." diff --git a/gha-script/post_process_wheel.py b/gha-script/post_process_wheel.py index fc7bf1aa56..d78a2d6840 100644 --- a/gha-script/post_process_wheel.py +++ b/gha-script/post_process_wheel.py @@ -43,18 +43,15 @@ logger = logging.getLogger(__name__) -# COS configuration -# These are only available in currency builds (not PR builds). -# If missing, post-processing is skipped gracefully. +# COS configuration — only available in currency builds. +# When absent, suffix resolution is skipped and PR_BUILD_FALLBACK_SUFFIX is used; +# all other post-processing steps (license injection, classifier, RECORD) still run. COS_API_KEY = os.environ.get("GHA_CURRENCY_SERVICE_ID_API_KEY", "") COS_SERVICE_INSTANCE_ID = os.environ.get("GHA_CURRENCY_SERVICE_ID", "") - -if not COS_API_KEY or not COS_SERVICE_INSTANCE_ID: - logger.info("COS credentials not set - skipping post-processing (PR build environment)") - sys.exit(0) COS_ENDPOINT = "https://s3.us.cloud-object-storage.appdomain.cloud" COS_BUCKET = "ose-power-artifacts-production" + # License extraction utilities LICENSE_PATTERN = re.compile(r"^(LICENSE|COPYING)(\..*)?$") LICENSE_SEPARATOR = "----" # Hardcoded separator for both files @@ -407,7 +404,16 @@ def regenerate_record(extract_path, dist_info_dir): logger.exception(f"Failed to regenerate RECORD file → {e}") def resolve_suffix(client, package, version, wheel_name, wheel_sha256): - # Resolve a unique suffix for the wheel based on its name and local hash + # Resolve a unique suffix for the wheel based on its name and local hash. + # When client is None (PR build — no COS credentials), skip COS lookup + # and return None to signal that suffix addition should be skipped entirely. + if client is None: + logger.info( + "COS client not available (PR build) — skipping suffix resolution, " + "no suffix will be added to the wheel." + ) + return None + try: logger.info(f"Resolving suffix for package={package}, version={version}, wheel={wheel_name}") parts = wheel_name[:-4].rsplit("-", 3) @@ -498,7 +504,9 @@ def inject_classifier(dist_info): def process_wheel(wheel_path, suffix): try: logger.info(f"Processing wheel: {wheel_path} with suffix: {suffix}") - wheel_dir = os.path.dirname(wheel_path) + # os.path.dirname of a bare filename returns ""; normalise to "." so + # that "wheel pack -d