Unverified Commit 8fbe7228 authored by Ran Rubin's avatar Ran Rubin Committed by GitHub
Browse files

chore: bake sccache into dynamo base (#6532)

parent e5f97343
...@@ -142,9 +142,10 @@ jobs: ...@@ -142,9 +142,10 @@ jobs:
id: calculate-target-tag id: calculate-target-tag
shell: bash shell: bash
run: | run: |
ECR_IMAGE_BASE="${{ env.ECR_HOSTNAME }}/${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}"
TARGET_TAG="${{ github.sha }}-${{ env.TARGET }}-${{ matrix.arch }}" TARGET_TAG="${{ github.sha }}-${{ env.TARGET }}-${{ matrix.arch }}"
DEFAULT_TARGET_IMAGE_URI="${{ env.ECR_HOSTNAME }}/${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${TARGET_TAG}" echo "ecr_image_base=${ECR_IMAGE_BASE}" >> $GITHUB_OUTPUT
echo "default_target_image_uri=${DEFAULT_TARGET_IMAGE_URI}" >> $GITHUB_OUTPUT echo "default_target_image_uri=${ECR_IMAGE_BASE}:${TARGET_TAG}" >> $GITHUB_OUTPUT
echo "epp_image_uri=${{ env.ECR_HOSTNAME }}/${{ needs.build-epp-image.outputs.epp_image_ref }}" >> $GITHUB_OUTPUT echo "epp_image_uri=${{ env.ECR_HOSTNAME }}/${{ needs.build-epp-image.outputs.epp_image_ref }}" >> $GITHUB_OUTPUT
echo "target_tag=${TARGET_TAG}" >> $GITHUB_OUTPUT echo "target_tag=${TARGET_TAG}" >> $GITHUB_OUTPUT
echo "azure_target_image_uri=${{ secrets.AZURE_ACR_HOSTNAME }}/${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${TARGET_TAG}" >> $GITHUB_OUTPUT echo "azure_target_image_uri=${{ secrets.AZURE_ACR_HOSTNAME }}/${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPOSITORY }}:${TARGET_TAG}" >> $GITHUB_OUTPUT
...@@ -192,9 +193,9 @@ jobs: ...@@ -192,9 +193,9 @@ jobs:
extra_build_args: | extra_build_args: |
EPP_IMAGE=${{ steps.calculate-target-tag.outputs.epp_image_uri }} EPP_IMAGE=${{ steps.calculate-target-tag.outputs.epp_image_uri }}
extra_tags: | extra_tags: |
${{ steps.calculate-target-tag.outputs.azure_target_image_uri }} ${{ matrix.arch == 'amd64' && steps.calculate-target-tag.outputs.azure_target_image_uri || '' }}
${{ github.ref_name == 'main' && format('main-frontend-{0}', matrix.arch) || '' }} ${{ github.ref_name == 'main' && format('{0}:main-frontend-{1}', steps.calculate-target-tag.outputs.ecr_image_base, matrix.arch) || '' }}
${{ github.ref_name == 'main' && format('main-frontend-{0}-{1}', github.sha, matrix.arch) || '' }} ${{ github.ref_name == 'main' && format('{0}:main-frontend-{1}-{2}', steps.calculate-target-tag.outputs.ecr_image_base, github.sha, matrix.arch) || '' }}
- name: Show summary - name: Show summary
shell: bash shell: bash
......
...@@ -15,6 +15,15 @@ ARG ARCH_ALT ...@@ -15,6 +15,15 @@ ARG ARCH_ALT
USER root USER root
WORKDIR /opt/dynamo WORKDIR /opt/dynamo
# Install sccache into the base image so downstream stages can COPY it
# instead of downloading from GitHub (avoids 502 errors under parallel builds)
ARG SCCACHE_VERSION=v0.14.0
RUN wget --tries=3 --waitretry=5 \
"https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl.tar.gz" && \
tar -xzf "sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl.tar.gz" && \
mv "sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl/sccache" /usr/local/bin/ && \
rm -rf sccache*
# Install uv package manager # Install uv package manager
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
......
...@@ -130,7 +130,11 @@ RUN git clone --depth 1 --branch ${NIXL_GDRCOPY_REF} https://github.com/NVIDIA/g ...@@ -130,7 +130,11 @@ RUN git clone --depth 1 --branch ${NIXL_GDRCOPY_REF} https://github.com/NVIDIA/g
rpm -Uvh gdrcopy-*.el8.${ARCH_ALT}.rpm && \ rpm -Uvh gdrcopy-*.el8.${ARCH_ALT}.rpm && \
rpm -Uvh gdrcopy-devel-*.el8.noarch.rpm rpm -Uvh gdrcopy-devel-*.el8.noarch.rpm
# Install SCCACHE if requested # sccache binary is pre-installed in dynamo_base;
# COPY it so the install call below skips the GitHub download.
# Wrapper scripts (sccache-cc, sccache-cxx) are created by use-sccache.sh install.
COPY --from=dynamo_base /usr/local/bin/sccache /usr/local/bin/sccache
ARG USE_SCCACHE ARG USE_SCCACHE
ARG SCCACHE_BUCKET ARG SCCACHE_BUCKET
ARG SCCACHE_REGION ARG SCCACHE_REGION
......
...@@ -44,18 +44,20 @@ EOF ...@@ -44,18 +44,20 @@ EOF
} }
install_sccache() { install_sccache() {
if [ -z "${ARCH_ALT:-}" ]; then if command -v sccache >/dev/null 2>&1; then
echo "Error: ARCH_ALT environment variable is required for sccache installation" echo "sccache already installed at $(command -v sccache), skipping download"
exit 1 else
if [ -z "${ARCH_ALT:-}" ]; then
echo "Error: ARCH_ALT environment variable is required for sccache installation"
exit 1
fi
echo "Installing sccache ${SCCACHE_VERSION} for architecture ${ARCH_ALT}..."
wget --tries=3 --waitretry=5 \
"https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl.tar.gz"
tar -xzf "sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl.tar.gz"
mv "sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl/sccache" /usr/local/bin/
rm -rf sccache*
fi fi
echo "Installing sccache ${SCCACHE_VERSION} for architecture ${ARCH_ALT}..."
# Download and install sccache
wget --tries=3 --waitretry=5 \
"https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl.tar.gz"
tar -xzf "sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl.tar.gz"
mv "sccache-${SCCACHE_VERSION}-${ARCH_ALT}-unknown-linux-musl/sccache" /usr/local/bin/
# Cleanup
rm -rf sccache*
# Create compiler wrapper scripts for autotools/Meson compatibility. # Create compiler wrapper scripts for autotools/Meson compatibility.
# Autoconf breaks with CC="sccache gcc" (multi-word value), so we provide # Autoconf breaks with CC="sccache gcc" (multi-word value), so we provide
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment