Skip to content

Containerize standalone tarball build - #2595

Open
jameslamb wants to merge 5 commits into
release/26.10from
standalone-tarball-build
Open

Containerize standalone tarball build#2595
jameslamb wants to merge 5 commits into
release/26.10from
standalone-tarball-build

Conversation

@jameslamb

@jameslamb jameslamb commented Sep 11, 2026

Copy link
Copy Markdown
Member

Replaces #2443

Containerizes the process of building the standalone C library tarballs

The starting point for this PR is @cjnolet 's work in #2443, where he wrote this description:

This PR is based on @msarahan's original POC, with the logic of the ci sript moved into build.sh and invoked through the CI script. The readme is also moved into the build and install guide in the docs.

Changes relative to that PR:

  • threads PARALLEL_LEVEL throught so builds are parallelized
  • enables the build cluster (sccache-dist) in CI
  • simplifies configuration flow (e.g. reduced duplication of default values, removal of unnecessary flexibility)
  • makes flow of AWS creds for sccache more secure
  • removes unnecessary configuration
  • removes unnecessary package installs, consolidates package installs
  • removes an unnecessary git clone of https://github.com/rapidsai/spdx-license-builder
  • enables sccache in CI and with a pattern that could work locally (will share details privately)
  • updates GitHub Actions third-party actions to their latest versions

Notes for Reviewers

How I tested this

Locally tried each of the new commands added to build.md, with sccache enabled.

Tried just build.sh without sccache enabled (that takes a lot longer to run).

code for flipping between those (click me)
# enabling sccache
export CI=true
# (private steps setting up 'sccache' profile)
AWS_ACCESS_KEY_ID=$(
  aws configure get aws_access_key_id \
    --profile sccache
)
AWS_SECRET_ACCESS_KEY=$(
  aws configure get aws_secret_access_key \
    --profile sccache
)
AWS_SESSION_TOKEN=$(
  aws configure get aws_session_token \
    --profile sccache
)
export AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN

# testing without 'sccache'
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN CI
clean() {
    sudo rm -rf ./{build,c/build/,cpp/build,libcuvs_c.tar.gz}
}

# all defaults
clean
./build.sh tarball

# customizing base image
clean
CUVS_TARBALL_CUDA_VERSION=12.9.2 \
CUVS_TARBALL_PYTHON_VERSION=3.11 \
  ./build.sh tarball

# customizing output directory, building tests 
clean
CUVS_TARBALL_BUILD_OUTPUT_DIR="${PWD}/dist" ./build.sh tarball --tarball-build-tests

# manual run (no build.sh)
clean

docker build \
  -f Dockerfile.standalone \
  --build-arg CUDA_VERSION="13.3.0" \
  --build-arg PYTHON_VERSION="3.14" \
  --build-arg RAPIDS_VERSION="$(head -1 ./VERSION | cut -d. -f1,2 )" \
  -t cuvs-standalone-c:local \
  .

mkdir -p "${PWD}/dist"
docker run --rm \
  -v "${PWD}:/workspace" \
  -v "${PWD}/dist:/build" \
  cuvs-standalone-c:local --tarball-build-tests

Saw high cache hit rates from sccache and everything working as expected.

Also looked at CI logs and saw that fully-cached jobs take around 30 minutes, pretty similar to the timings in CI today.

@jameslamb jameslamb added breaking Introduces a breaking change improvement Improves an existing functionality labels Sep 11, 2026
@copy-pr-bot

copy-pr-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@codecov-commenter

codecov-commenter commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.93%. Comparing base (8c3cac9) to head (1b46d1d).

Additional details and impacted files
@@              Coverage Diff               @@
##           release/26.10    #2595   +/-   ##
==============================================
  Coverage          86.93%   86.93%           
==============================================
  Files                 33       33           
  Lines                176      176           
==============================================
  Hits                 153      153           
  Misses                23       23           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jameslamb

Copy link
Copy Markdown
Member Author

/ok to test

uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@release/26.10
with:
build_type: pull-request
build_type: ${{ inputs.build_type || 'branch' }}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This looks like a copy-past mistake. Not a big deal since this is based on conda-cpp-build and those are the same for PRs and branch/nightly builds, but should fix this anyway for consistency.

artifact-name: "libcuvs_c_${{ matrix.CUDA_VER }}_${{ matrix.ARCH }}.tar.gz"
file_to_upload: "libcuvs_c.tar.gz"
sha: ${{ inputs.sha }}
steps:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think @cjnolet originally pulled all these steps from custom-job.yaml out here individually because this script ends up running a docker run and custom-job.yaml requires running in a container.

Maybe this could be made to work with a docker-in-docker approach or making the container image optional for custom-job.yaml but IMO that doesn't need to become part of the scope here. I think this inlining is ok for right now.

date: ${{ inputs.date }}
container_image: "rapidsai/ci-wheel:26.10-cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"
node_type: "cpu16"
requires_license_builder: true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Notice that this PR doesn't have a git clone of spdx-license-builder like custom-job.yaml does when this input is provided.

Instead, build_standalone_c.sh now does this:

pip install 'git+https://github.com/rapidsai/spdx-license-builder.git'

I like that, it keeps things self-contained in the container (ha!). It'd be annoying to do an outside clone and thread it through to the container in a way that's also easy to replicate locally.

Comment thread ci/build_standalone_c.sh
Comment on lines -58 to -64
RAPIDS_PACKAGE_VERSION=$(rapids-generate-version)
export RAPIDS_PACKAGE_VERSION

RAPIDS_ARTIFACTS_DIR=${RAPIDS_ARTIFACTS_DIR:-"${PWD}/artifacts"}
mkdir -p "${RAPIDS_ARTIFACTS_DIR}"
export RAPIDS_ARTIFACTS_DIR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This looks copied over from conda build scripts. None of this stuff is needed for building the tarball.

Comment thread fern/pages/build.md

```bash
# (optional) clean old build directories
rm -rf ./{build,c/build/,cpp/build}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I hit enough weird errors in repeated testing that I think this is worth calling out specifically.

If you think it's excessive and just a standard thing people should know, fine to remove it.

Comment thread build.sh
Comment on lines +653 to +654
--env-file <(env | grep -E '^AWS_(ACCESS_KEY_ID|SECRET_ACCESS_KEY|SESSION_TOKEN)=') \
--env-file <(env | grep -E '^SCCACHE_.*=') \

@jameslamb jameslamb Sep 11, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As the comment I wrote a few lines up here say... this --env-file trick keeps these sensitive values out of command history and ps types of output.

These lines are primarily here for CI.

  • AWS_* for sccache
  • SCCACHE_* for sccache-dist (the build cluster)

I confirmed in the logs that sccache is working well, haven't confirmed that the build cluster's being used. Might not be because I'd already done some runs and we might get 100% cache hit rates until something changes and requires a recompile.

right now I see:

...
Cache hits rate                           100.00 %
Cache hits rate (c [gcc])                 100.00 %
Cache hits rate (c++ [gcc])               100.00 %
Cache hits rate (cuda [nvcc])             100.00 %
...

(build link)

@jameslamb
jameslamb requested review from cjnolet, msarahan and robertmaynard and removed request for cjnolet and robertmaynard September 11, 2026 19:31
@jameslamb jameslamb changed the title WIP: Portable standalone tarball build with Docker Containerize standalone tarball build Sep 11, 2026
@jameslamb
jameslamb marked this pull request as ready for review September 11, 2026 19:38
@jameslamb
jameslamb requested review from a team as code owners September 11, 2026 19:38
@jameslamb
jameslamb requested a review from a team as a code owner September 11, 2026 19:38

@msarahan msarahan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good improvements. Thanks for the work here, James.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces a breaking change improvement Improves an existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants