Skip to content

fix(function-autoscaler): restore multi-arch OpenSSL paths - #674

Open
borao wants to merge 3 commits into
mainfrom
fix/function-autoscaler/restore-multi-arch-build
Open

fix(function-autoscaler): restore multi-arch OpenSSL paths#674
borao wants to merge 3 commits into
mainfrom
fix/function-autoscaler/restore-multi-arch-build

Conversation

@borao

@borao borao commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Restore the target-specific OpenSSL paths dropped during the root Bazel module
consolidation, unblocking the function-autoscaler ARM64 image build.

Additional Details

#533 configured openssl-sys for both AMD64 and ARM64. When #593 moved the
autoscaler into the root Bazel module, that crate.annotation was not
transferred.

The omission caused the manual image push to fail because
AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR was unset:

https://github.com/NVIDIA/nvcf/actions/runs/30954727158

This restores the previous configuration without changing service code,
dependencies, or lockfiles.

For the Reviewer

Please verify the restored annotation in MODULE.bazel matches the Bazel CI
image’s AMD64 and ARM64 OpenSSL paths.

For QA

  • git diff --check passed.
  • The image build was not run locally because this host lacks Bazel and the
    ARM64 OpenSSL sysroot.
  • Validate with the manual image-push workflow against this branch.

Issues

Relates to #527

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • Chores
    • Improved build configuration for autoscaler components across supported architectures.
    • Standardized OpenSSL integration to use architecture-specific system libraries and headers.

Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
@borao
borao requested a review from a team as a code owner August 4, 2026 22:27
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5e13a589-00f6-4ddd-90f1-82b9fa2d5589

📥 Commits

Reviewing files that changed from the base of the PR and between ce5b7cf and 640525d.

📒 Files selected for processing (1)
  • MODULE.bazel
🚧 Files skipped from review as they are similar to previous changes (1)
  • MODULE.bazel

📝 Walkthrough

Walkthrough

The Bazel module adds an openssl-sys crate annotation. The annotation configures native OpenSSL paths, aarch64 compiler include flags, and disables vendored OpenSSL builds.

Changes

OpenSSL crate configuration

Layer / File(s) Summary
Native OpenSSL annotation
MODULE.bazel
Adds architecture-specific OpenSSL include and library paths, aarch64 compiler flags, and OPENSSL_NO_VENDOR for openssl-sys.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: sparve-nv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the required Conventional Commits format and accurately describes the OpenSSL path restoration that fixes multi-architecture autoscaler builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/function-autoscaler/restore-multi-arch-build

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@MODULE.bazel`:
- Around line 232-239: Update the OpenSSL environment configuration in the
supported-targets section to define target-specific include and library
directory variables for both x86_64-apple-darwin and aarch64-apple-darwin,
rather than allowing them to inherit Linux paths; alternatively remove those
macOS triples from SUPPORTED_TRIPLES if they are not supported.
- Around line 232-239: The OpenSSL configuration in the Bazel environment uses
the x86_64 library path for aarch64 builds, making openssl-sys non-hermetic.
Update the aarch64-specific settings in MODULE.bazel to reference Bazel-managed
arm64 OpenSSL headers and libraries, including the required per-platform inputs;
alternatively remove aarch64-unknown-linux-gnu from SUPPORTED_TRIPLES until that
toolchain support exists.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dcb43f31-9d69-4bad-8f1a-43e8ac6a5138

📥 Commits

Reviewing files that changed from the base of the PR and between 7918da8 and a0b0407.

📒 Files selected for processing (1)
  • MODULE.bazel

Comment thread MODULE.bazel
Comment on lines +232 to +239
"AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR": "/usr/include",
"AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR": "/usr/lib/aarch64-linux-gnu",
"CFLAGS_aarch64_unknown_linux_gnu": "-I/usr/include/aarch64-linux-gnu",
"OPENSSL_INCLUDE_DIR": "/usr/include",
"OPENSSL_LIB_DIR": "/usr/lib/x86_64-linux-gnu",
"OPENSSL_NO_VENDOR": "1",
"X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR": "/usr/include",
"X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR": "/usr/lib/x86_64-linux-gnu",

@coderabbitai coderabbitai Bot Aug 4, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Expect every supported target to have matching OpenSSL configuration.
rg -n -C 8 \
  'SUPPORTED_TRIPLES|supported_platform_triples|unknown-linux|OPENSSL_(INCLUDE|LIB)_DIR|CFLAGS_' \
  MODULE.bazel

Repository: NVIDIA/nvcf

Length of output: 3455


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- guidance files ---'
find .. -name AGENTS.md -o -name .oss-allowlist

printf '%s\n' '--- relevant MODULE.bazel section ---'
sed -n '200,245p' MODULE.bazel

printf '%s\n' '--- openssl-sys declarations and lock versions ---'
rg -n -C 3 'openssl-sys|openssl' \
  src/control-plane-services/function-autoscaler/Cargo.lock \
  src/control-plane-services/function-autoscaler/Cargo.toml \
  MODULE.bazel 2>/dev/null || true

printf '%s\n' '--- target/environment coverage check ---'
python3 - <<'PY'
import re
from pathlib import Path

text = Path("MODULE.bazel").read_text()
triples = re.search(r"SUPPORTED_TRIPLES\s*=\s*\[(.*?)\]", text, re.S).group(1)
targets = re.findall(r'"([^"]+)"', triples)
env_block = re.search(r'build_script_env\s*=\s*\{(.*?)\n\s*\}', text, re.S).group(1)
keys = set(re.findall(r'"([^"]+)"\s*:', env_block))

def target_key(triple, suffix):
    return triple.replace("-", "_").upper() + suffix

for triple in targets:
    target = triple.replace("-", "_").upper()
    matches = sorted(k for k in keys if k.startswith(target + "_OPENSSL_") or k.startswith("CFLAGS_" + triple))
    print(f"{triple}: {matches}")
print("generic:", sorted(k for k in keys if k in {"OPENSSL_INCLUDE_DIR", "OPENSSL_LIB_DIR", "OPENSSL_NO_VENDOR"}))
PY

Repository: NVIDIA/nvcf

Length of output: 12099


🌐 Web query:

openssl-sys build main.rs target-specific OPENSSL_LIB_DIR environment variable precedence generic OPENSSL_LIB_DIR

💡 Result:

In the openssl-sys build process, environment variables are used to point the build script toward an OpenSSL installation, overriding automatic detection mechanisms like pkg-config, Homebrew, or vcpkg [1][2][3]. Precedence and Behavior When configuring paths, the build script prioritizes specific manual overrides. If both OPENSSL_LIB_DIR and OPENSSL_INCLUDE_DIR are provided, they take precedence and are used directly to locate the libraries and headers [4][5]. If these specific variables are not provided, the build script looks for OPENSSL_DIR [4][5]. If OPENSSL_DIR is set, the build script assumes a standard layout, looking for headers in the include subdirectory and libraries in either the lib or lib64 subdirectories of the specified path [4][5]. Target-Specific Precedence Environment variables for openssl-sys can be prefixed with an upper-cased target architecture (e.g., X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR) [1][2][3]. These target-specific variables take precedence over the generic, non-prefixed versions of the same variable [2]. For example, if both X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR and OPENSSL_DIR are defined, the build script will prefer the target-specific version for that specific build target [2]. Summary of Variable Roles - OPENSSL_LIB_DIR: Specifies the exact directory containing OpenSSL library files (e.g.,.so,.a,.lib). - OPENSSL_INCLUDE_DIR: Specifies the exact directory containing OpenSSL header files. - OPENSSL_DIR: Specifies the root directory of an OpenSSL installation, expecting standard lib/lib64 and include subdirectories. - Target-Prefixed Variables: (e.g., [TARGET]_OPENSSL_DIR) Overrides generic versions to allow for precise cross-compilation configuration [2].

Citations:


Define OpenSSL variables for the supported macOS targets.

x86_64-apple-darwin and aarch64-apple-darwin have no target-specific variables and can inherit the Linux OPENSSL_LIB_DIR. Add matching macOS configuration or remove those targets from SUPPORTED_TRIPLES.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@MODULE.bazel` around lines 232 - 239, Update the OpenSSL environment
configuration in the supported-targets section to define target-specific include
and library directory variables for both x86_64-apple-darwin and
aarch64-apple-darwin, rather than allowing them to inherit Linux paths;
alternatively remove those macOS triples from SUPPORTED_TRIPLES if they are not
supported.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

fd -HI -t f \
  'Dockerfile.*|.*\.bazelrc|.*\.bzl|BUILD.*|.*\.ya?ml|.*\.sh' . -0 |
  xargs -0 -r rg -n -C 3 \
    'aarch64-linux-gnu|x86_64-linux-gnu|libssl|libcrypto|openssl|remote|sandbox'

Repository: NVIDIA/nvcf

Length of output: 50368


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- guidance files ---'
fd -HI -t f 'AGENTS.md|.oss-allowlist' . -0 | xargs -0 -r -n1 printf '%s\n'

printf '%s\n' '--- MODULE.bazel context ---'
cat -n MODULE.bazel | sed -n '190,255p'

printf '%s\n' '--- relevant declarations and uses ---'
rg -n -C 8 \
  'build_script_env|build_script_data|OPENSSL|openssl|aarch64-linux-gnu|x86_64-linux-gnu|rules_rust' \
  MODULE.bazel MODULE.bazel.lock .bazelrc .github tools rules src \
  -g 'MODULE.bazel' -g '*.bzl' -g '*.bazel' -g '.bazelrc' -g '*.yml' -g '*.yaml' -g '*.sh' \
  | head -n 1200

printf '%s\n' '--- repository layout relevant to Bazel ---'
git ls-files '*MODULE.bazel' '*BUILD.bazel' '*BUILD' '*WORKSPACE*' '.bazelrc' | head -n 300

Repository: NVIDIA/nvcf

Length of output: 217


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- guidance files ---'
while IFS= read -r -d '' f; do
  printf '%s\n' "$f"
done < <(fd -HI -t f 'AGENTS.md|.oss-allowlist' . -0)

printf '%s\n' '--- MODULE.bazel context ---'
cat -n MODULE.bazel | sed -n '190,255p'

printf '%s\n' '--- relevant declarations and uses ---'
rg -n -C 8 \
  'build_script_env|build_script_data|OPENSSL|openssl|aarch64-linux-gnu|x86_64-linux-gnu|rules_rust' \
  MODULE.bazel MODULE.bazel.lock .bazelrc .github tools rules src \
  -g 'MODULE.bazel' -g '*.bzl' -g '*.bazel' -g '.bazelrc' -g '*.yml' -g '*.yaml' -g '*.sh' \
  | head -n 1200

printf '%s\n' '--- repository layout relevant to Bazel ---'
git ls-files '*MODULE.bazel' '*BUILD.bazel' '*BUILD' '*WORKSPACE*' '.bazelrc' | head -n 300

Repository: NVIDIA/nvcf

Length of output: 224


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- guidance files ---'
fd -HI -t f 'AGENTS.md|.oss-allowlist' . || true

printf '%s\n' '--- MODULE.bazel context ---'
cat -n MODULE.bazel | sed -n '190,255p'

printf '%s\n' '--- relevant declarations and uses ---'
rg -n -C 8 \
  'build_script_env|build_script_data|OPENSSL|openssl|aarch64-linux-gnu|x86_64-linux-gnu|rules_rust' \
  MODULE.bazel MODULE.bazel.lock .bazelrc .github tools rules src \
  -g 'MODULE.bazel' -g '*.bzl' -g '*.bazel' -g '.bazelrc' -g '*.yml' -g '*.yaml' -g '*.sh' \
  | head -n 1200 || true

printf '%s\n' '--- repository layout relevant to Bazel ---'
git ls-files '*MODULE.bazel' '*BUILD.bazel' '*BUILD' '*WORKSPACE*' '.bazelrc' | head -n 300

Repository: NVIDIA/nvcf

Length of output: 50368


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- guidance files ---'
fd -HI -t f 'AGENTS.md|.oss-allowlist' . || true

printf '%s\n' '--- MODULE.bazel lines 210-250 ---'
cat -n MODULE.bazel | sed -n '210,250p'

printf '%s\n' '--- MODULE.bazel relevant identifiers ---'
rg -n -C 12 \
  'build_script_env|build_script_data|OPENSSL|openssl|aarch64-linux-gnu|x86_64-linux-gnu|crate_universe|rules_rust' \
  MODULE.bazel || true

printf '%s\n' '--- relevant source files outside generated lock data ---'
rg -l \
  'build_script_env|build_script_data|OPENSSL|openssl|aarch64-linux-gnu|x86_64-linux-gnu' \
  --glob '!MODULE.bazel.lock' \
  --glob '!**/bazel-*' \
  --glob '!**/external/**' \
  . | head -n 200 || true

printf '%s\n' '--- Bazel configuration and CI references ---'
rg -n -C 5 \
  'remote_cache|sandbox|build_script_env|OPENSSL|openssl|aarch64-linux-gnu|x86_64-linux-gnu' \
  .bazelrc .github tools \
  --glob '!**/bazel-*' | head -n 800 || true

Repository: NVIDIA/nvcf

Length of output: 46599


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- root guidance ---'
cat -n AGENTS.md | sed -n '1,240p'

printf '%s\n' '--- generated openssl-sys rule from MODULE.bazel.lock ---'
python3 - <<'PY'
import json
from pathlib import Path

lock = json.loads(Path("MODULE.bazel.lock").read_text())
found = 0

def walk(value):
    global found
    if isinstance(value, dict):
        text = value.get("build_file_content")
        if isinstance(text, str) and "crate_name = \"openssl-sys\"" in text:
            found += 1
            lines = text.splitlines()
            for i, line in enumerate(lines):
                if (
                    "crate_name = \"openssl-sys\"" in line
                    or "cargo_build_script(" in line
                    or "build_script_env" in line
                    or "data =" in line
                    or "compile_data =" in line
                    or "openssl" in line.lower()
                ):
                    lo = max(0, i - 8)
                    hi = min(len(lines), i + 25)
                    print(f"--- match {found}, lines {lo + 1}-{hi} ---")
                    print("\n".join(f"{j + 1:4}: {lines[j]}" for j in range(lo, hi)))
                    print()
        for child in value.values():
            walk(child)
    elif isinstance(value, list):
        for child in value:
            walk(child)

walk(lock)
print(f"matches={found}")
PY

printf '%s\n' '--- server BUILD and build script references ---'
cat -n src/control-plane-services/function-autoscaler/crates/server/BUILD.bazel | sed -n '1,240p'
rg -n -C 8 'openssl|openssl-sys|cargo_build_script|build_script_env|build_script_data' \
  src/control-plane-services/function-autoscaler \
  --glob '!Cargo.lock' --glob '!**/target/**' | head -n 800 || true

printf '%s\n' '--- CI image and host OpenSSL setup references ---'
fd -HI -t f 'Dockerfile|Dockerfile.*|.*\.yml|.*\.yaml|.*\.sh' .github tools . \
  | rg 'bazel|ci|runner|Dockerfile' \
  | head -n 300
rg -n -C 8 'bazel-ci|apt-get.*openssl|libssl-dev|aarch64.*libssl|x86_64.*libssl|/usr/lib/aarch64-linux-gnu|/usr/include/aarch64-linux-gnu' \
  .github tools . \
  --glob '!MODULE.bazel.lock' \
  --glob '!**/vendor/**' | head -n 1000 || true

Repository: NVIDIA/nvcf

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- openssl-sys generated metadata ---'
rg -n -m 40 -C 8 'openssl_sys|openssl-sys|OPENSSL_LIB_DIR|AARCH64_UNKNOWN_LINUX_GNU' \
  MODULE.bazel.lock \
  --glob 'MODULE.bazel.lock' || true

printf '%s\n' '--- function-autoscaler Bazel documentation and targets ---'
cat -n src/control-plane-services/function-autoscaler/README.md | sed -n '1,75p'
rg -n -C 10 \
  'function-autoscaler|autoscaler|aarch64|arm64|linux/amd64|linux/arm64|bazel build|bazel test' \
  .github tools src/control-plane-services/function-autoscaler \
  --glob '!Cargo.lock' --glob '!MODULE.bazel.lock' --glob '!**/vendor/**' \
  | head -n 1000 || true

printf '%s\n' '--- all root-level Rust build configuration ---'
rg -n -C 8 \
  'rust.toolchain|crate.annotation|supported_platform_triples|build_script_env|OPENSSL' \
  MODULE.bazel .bazelrc BAZEL.md \
  --glob '!MODULE.bazel.lock' || true

printf '%s\n' '--- current host paths, if present ---'
for p in \
  /usr/include \
  /usr/include/aarch64-linux-gnu \
  /usr/lib/x86_64-linux-gnu \
  /usr/lib/aarch64-linux-gnu \
  /usr/lib/x86_64-linux-gnu/libssl.so \
  /usr/lib/aarch64-linux-gnu/libssl.so
do
  if [ -e "$p" ]; then
    printf 'present  %s\n' "$p"
  else
    printf 'missing  %s\n' "$p"
  fi
done

Repository: NVIDIA/nvcf

Length of output: 50368


Make the openssl-sys dependency hermetic for aarch64-unknown-linux-gnu. The repository documents that the arm64 cross-compile fails because the annotation uses the amd64 OpenSSL path. Add Bazel-managed per-platform OpenSSL inputs, or remove aarch64 from SUPPORTED_TRIPLES until the toolchain provides the required sysroot.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@MODULE.bazel` around lines 232 - 239, The OpenSSL configuration in the Bazel
environment uses the x86_64 library path for aarch64 builds, making openssl-sys
non-hermetic. Update the aarch64-specific settings in MODULE.bazel to reference
Bazel-managed arm64 OpenSSL headers and libraries, including the required
per-platform inputs; alternatively remove aarch64-unknown-linux-gnu from
SUPPORTED_TRIPLES until that toolchain support exists.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First: Resolved by removing "OPENSSL_LIB_DIR": "/usr/lib/x86_64-linux-gnu".

Second: We’ve broadened the compatibility to the practical point without overcomplicating.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borao, confirmed. Removing the generic OPENSSL_LIB_DIR prevents macOS targets from inheriting the x86_64 Linux library path.

I acknowledge the practical compatibility scope for the second finding.

You are interacting with an AI system.

borao added 2 commits August 4, 2026 22:34
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Signed-off-by: Bora Oztekin <boztekin@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant