Skip to content

Commit

Permalink
Separate building RAPIDS & cuVS images
Browse files Browse the repository at this point in the history
  • Loading branch information
raydouglass committed Jan 14, 2025
1 parent 4f0424d commit f6161ea
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ on:
RAPIDS_VER:
required: true
type: string
BASE_TAG:
required: true
type: string
NOTEBOOKS_TAG:
required: true
type: string
CUVS_BENCH_TAG:
required: true
type: string
Expand Down Expand Up @@ -88,38 +82,6 @@ jobs:
with:
driver: docker
endpoint: builders
- name: Build base image
uses: docker/build-push-action@v6
with:
context: context
file: Dockerfile
target: base
push: true
pull: true
build-args: |
CUDA_VER=${{ inputs.CUDA_VER }}
LINUX_DISTRO=${{ inputs.LINUX_DISTRO }}
LINUX_DISTRO_VER=${{ inputs.LINUX_DISTRO_VER }}
LINUX_VER=${{ inputs.LINUX_VER }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
RAPIDS_VER=${{ inputs.RAPIDS_VER }}
tags: ${{ inputs.BASE_TAG }}-${{ matrix.ARCH }}
- name: Build notebooks image
uses: docker/build-push-action@v6
with:
context: context
file: Dockerfile
target: notebooks
push: true
pull: true
build-args: |
CUDA_VER=${{ inputs.CUDA_VER }}
LINUX_DISTRO=${{ inputs.LINUX_DISTRO }}
LINUX_DISTRO_VER=${{ inputs.LINUX_DISTRO_VER }}
LINUX_VER=${{ inputs.LINUX_VER }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
RAPIDS_VER=${{ inputs.RAPIDS_VER }}
tags: ${{ inputs.NOTEBOOKS_TAG }}-${{ matrix.ARCH }}
- name: Build cuVS Benchmarks GPU image
uses: docker/build-push-action@v6
with:
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/build-rapids-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Build and push image variant

on:
workflow_call:
inputs:
ARCHES:
required: true
type: string
CUDA_VER:
required: true
type: string
LINUX_DISTRO:
required: true
type: string
LINUX_DISTRO_VER:
required: true
type: string
LINUX_VER:
required: true
type: string
PYTHON_VER:
required: true
type: string
RAPIDS_VER:
required: true
type: string
BASE_TAG:
required: true
type: string
NOTEBOOKS_TAG:
required: true
type: string

jobs:
build:
strategy:
matrix:
ARCH: ${{ fromJSON(inputs.ARCHES) }}
CUDA_VER: ["${{ inputs.CUDA_VER }}"]
LINUX_VER: ["${{ inputs.LINUX_VER }}"]
PYTHON_VER: ["${{ inputs.PYTHON_VER }}"]
RAPIDS_VER: ["${{ inputs.RAPIDS_VER }}"]
fail-fast: false
runs-on: "linux-${{ matrix.ARCH }}-cpu4"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gha-tools
run: |
mkdir -p /tmp/gha-tools
curl -s -L 'https://github.com/rapidsai/gha-tools/releases/latest/download/tools.tar.gz' | tar -xz -C /tmp/gha-tools
echo "/tmp/gha-tools" >> "${GITHUB_PATH}"
- name: Clean up condarc for release builds
run: |
GIT_DESCRIBE_TAG="$(git describe --tags --abbrev=0)"
GIT_DESCRIBE_TAG="${GIT_DESCRIBE_TAG:1}" # remove leading 'v'
if [[ ! $GIT_DESCRIBE_TAG =~ [a-z] ]]; then
rapids-logger "Most recent tag is for release, adding `rapidsai` channel and removing `rapidsai-nightly` and `dask/label/dev` channels."
sed -i 's|rapidsai-nightly|rapidsai|;\|dask/label/dev|d' context/condarc
else
rapids-logger "Most recent tag is an alpha. Build will use nightly channels."
fi
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
password: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
- name: Set up Docker Context for Buildx
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
endpoint: builders
- name: Build base image
uses: docker/build-push-action@v6
with:
context: context
file: Dockerfile
target: base
push: true
pull: true
build-args: |
CUDA_VER=${{ inputs.CUDA_VER }}
LINUX_DISTRO=${{ inputs.LINUX_DISTRO }}
LINUX_DISTRO_VER=${{ inputs.LINUX_DISTRO_VER }}
LINUX_VER=${{ inputs.LINUX_VER }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
RAPIDS_VER=${{ inputs.RAPIDS_VER }}
tags: ${{ inputs.BASE_TAG }}-${{ matrix.ARCH }}
- name: Build notebooks image
uses: docker/build-push-action@v6
with:
context: context
file: Dockerfile
target: notebooks
push: true
pull: true
build-args: |
CUDA_VER=${{ inputs.CUDA_VER }}
LINUX_DISTRO=${{ inputs.LINUX_DISTRO }}
LINUX_DISTRO_VER=${{ inputs.LINUX_DISTRO_VER }}
LINUX_VER=${{ inputs.LINUX_VER }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
RAPIDS_VER=${{ inputs.RAPIDS_VER }}
tags: ${{ inputs.NOTEBOOKS_TAG }}-${{ matrix.ARCH }}
62 changes: 53 additions & 9 deletions .github/workflows/build-test-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ jobs:
needs:
- checks
- compute-matrix
- build
- build-multiarch-manifest
- build-rapids
- build-rapids-multiarch-manifest
- build-cuvs
- build-cuvs-multiarch-manifest
- test
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
Expand Down Expand Up @@ -137,13 +139,13 @@ jobs:
export TEST_MATRIX
echo "TEST_MATRIX=$(yq -n -o json 'env(TEST_MATRIX)' | jq -c '{include: .}')" | tee --append "${GITHUB_OUTPUT}"
build:
build-rapids:
needs: [checks, compute-matrix]
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
fail-fast: false
secrets: inherit
uses: ./.github/workflows/build-image.yml
uses: ./.github/workflows/build-rapids-image.yml
with:
ARCHES: ${{ toJSON(matrix.ARCHES) }}
CUDA_VER: ${{ matrix.CUDA_VER }}
Expand All @@ -152,7 +154,6 @@ jobs:
LINUX_VER: ${{ matrix.LINUX_VER }}
PYTHON_VER: ${{ matrix.PYTHON_VER }}
RAPIDS_VER: ${{ needs.compute-matrix.outputs.RAPIDS_VER }}
BUILD_CUVS_BENCH_CPU_IMAGE: ${{ matrix.BUILD_CUVS_BENCH_CPU_IMAGE }}
BASE_TAG:
"rapidsai/${{ needs.compute-matrix.outputs.BASE_IMAGE_REPO }}:\
${{ needs.compute-matrix.outputs.BASE_TAG_PREFIX }}\
Expand All @@ -167,6 +168,22 @@ jobs:
${{ needs.compute-matrix.outputs.ALPHA_TAG }}-\
cuda${{ matrix.CUDA_TAG }}-\
py${{ matrix.PYTHON_VER }}"
build-cuvs:
needs: [checks, compute-matrix]
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
fail-fast: false
secrets: inherit
uses: ./.github/workflows/build-cuvs-image.yml
with:
ARCHES: ${{ toJSON(matrix.ARCHES) }}
CUDA_VER: ${{ matrix.CUDA_VER }}
LINUX_DISTRO: ${{ matrix.LINUX_DISTRO }}
LINUX_DISTRO_VER: ${{ matrix.LINUX_DISTRO_VER }}
LINUX_VER: ${{ matrix.LINUX_VER }}
PYTHON_VER: ${{ matrix.PYTHON_VER }}
RAPIDS_VER: ${{ needs.compute-matrix.outputs.RAPIDS_VER }}
BUILD_CUVS_BENCH_CPU_IMAGE: ${{ matrix.BUILD_CUVS_BENCH_CPU_IMAGE }}
CUVS_BENCH_TAG:
"rapidsai/${{ needs.compute-matrix.outputs.CUVS_BENCH_IMAGE_REPO }}:\
${{ needs.compute-matrix.outputs.CUVS_BENCH_TAG_PREFIX }}\
Expand All @@ -187,8 +204,8 @@ jobs:
${{ needs.compute-matrix.outputs.RAPIDS_VER }}\
${{ needs.compute-matrix.outputs.ALPHA_TAG }}-\
py${{ matrix.PYTHON_VER }}"
build-multiarch-manifest:
needs: [build, compute-matrix]
build-rapids-multiarch-manifest:
needs: [build-rapids, compute-matrix]
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
fail-fast: false
Expand All @@ -206,7 +223,6 @@ jobs:
- name: Create multiarch manifest
shell: bash
env:
CUVS_BENCH_CPU_IMAGE_BUILT: ${{ matrix.BUILD_CUVS_BENCH_CPU_IMAGE }}
BASE_IMAGE_REPO: ${{ needs.compute-matrix.outputs.BASE_IMAGE_REPO }}
BASE_TAG_PREFIX: ${{ needs.compute-matrix.outputs.BASE_TAG_PREFIX }}
RAPIDS_VER: ${{ needs.compute-matrix.outputs.RAPIDS_VER }}
Expand All @@ -215,6 +231,34 @@ jobs:
PYTHON_VER: ${{ matrix.PYTHON_VER }}
NOTEBOOKS_IMAGE_REPO: ${{ needs.compute-matrix.outputs.NOTEBOOKS_IMAGE_REPO }}
NOTEBOOKS_TAG_PREFIX: ${{ needs.compute-matrix.outputs.NOTEBOOKS_TAG_PREFIX }}
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
ARCHES: ${{ toJSON(matrix.ARCHES) }}
run: ci/create-multiarch-manifest.sh
build-cuvs-multiarch-manifest:
needs: [build-cuvs, compute-matrix]
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
password: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
- name: Create multiarch manifest
shell: bash
env:
RAPIDS_VER: ${{ needs.compute-matrix.outputs.RAPIDS_VER }}
ALPHA_TAG: ${{ needs.compute-matrix.outputs.ALPHA_TAG }}
CUDA_TAG: ${{ matrix.CUDA_TAG }}
PYTHON_VER: ${{ matrix.PYTHON_VER }}
CUVS_BENCH_CPU_IMAGE_BUILT: ${{ matrix.BUILD_CUVS_BENCH_CPU_IMAGE }}
CUVS_BENCH_IMAGE_REPO: ${{ needs.compute-matrix.outputs.CUVS_BENCH_IMAGE_REPO }}
CUVS_BENCH_TAG_PREFIX: ${{ needs.compute-matrix.outputs.CUVS_BENCH_TAG_PREFIX }}
CUVS_BENCH_DATASETS_IMAGE_REPO: ${{ needs.compute-matrix.outputs.CUVS_BENCH_DATASETS_IMAGE_REPO }}
Expand All @@ -226,7 +270,7 @@ jobs:
ARCHES: ${{ toJSON(matrix.ARCHES) }}
run: ci/create-multiarch-manifest.sh
test:
needs: [compute-matrix, build]
needs: [compute-matrix, build-rapids]
if: inputs.run_tests
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.TEST_MATRIX) }}
Expand Down
59 changes: 37 additions & 22 deletions ci/create-multiarch-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

set -eEuo pipefail

if [ -n "$BASE_IMAGE_REPO" ] || [ -n "$NOTEBOOKS_IMAGE_REPO" ]; then
RAPIDS_MANIFEST=true
fi
if [ -n "$CUVS_BENCH_IMAGE_REPO" ] || [ -n "$CUVS_BENCH_DATASETS_IMAGE_REPO" ] || [ -n "$CUVS_BENCH_CPU_IMAGE_REPO" ]; then
CUVS_MANIFEST=true
fi

# Authenticate and retrieve DockerHub token
HUB_TOKEN=$(
curl -s -H "Content-Type: application/json" \
Expand Down Expand Up @@ -49,38 +56,46 @@ for arch in $(echo "${ARCHES}" | jq .[] -r); do
full_cuvs_bench_datasets_tag="${cuvs_bench_datasets_tag}-${arch}"
full_cuvs_bench_cpu_tag="${cuvs_bench_cpu_tag}-${arch}"

check_tag_exists "$BASE_IMAGE_REPO" "$full_base_tag"
base_source_tags+=("${org}/${BASE_IMAGE_REPO}:$full_base_tag")
if [ "$RAPIDS_MANIFEST" == "true" ]; then
check_tag_exists "$BASE_IMAGE_REPO" "$full_base_tag"
base_source_tags+=("${org}/${BASE_IMAGE_REPO}:$full_base_tag")

check_tag_exists "$NOTEBOOKS_IMAGE_REPO" "$full_notebooks_tag"
notebooks_source_tags+=("${org}/${NOTEBOOKS_IMAGE_REPO}:$full_notebooks_tag")
check_tag_exists "$NOTEBOOKS_IMAGE_REPO" "$full_notebooks_tag"
notebooks_source_tags+=("${org}/${NOTEBOOKS_IMAGE_REPO}:$full_notebooks_tag")
fi

check_tag_exists "$CUVS_BENCH_IMAGE_REPO" "$full_cuvs_bench_tag"
cuvs_bench_source_tags+=("${org}/${CUVS_BENCH_IMAGE_REPO}:$full_cuvs_bench_tag")
if [ "$CUVS_MANIFEST" == "true" ]; then
check_tag_exists "$CUVS_BENCH_IMAGE_REPO" "$full_cuvs_bench_tag"
cuvs_bench_source_tags+=("${org}/${CUVS_BENCH_IMAGE_REPO}:$full_cuvs_bench_tag")

check_tag_exists "$CUVS_BENCH_DATASETS_IMAGE_REPO" "$full_cuvs_bench_datasets_tag"
cuvs_bench_datasets_source_tags+=("${org}/${CUVS_BENCH_DATASETS_IMAGE_REPO}:$full_cuvs_bench_datasets_tag")
check_tag_exists "$CUVS_BENCH_DATASETS_IMAGE_REPO" "$full_cuvs_bench_datasets_tag"
cuvs_bench_datasets_source_tags+=("${org}/${CUVS_BENCH_DATASETS_IMAGE_REPO}:$full_cuvs_bench_datasets_tag")

if [ "$CUVS_BENCH_CPU_IMAGE_BUILT" = "true" ]; then
check_tag_exists "$CUVS_BENCH_CPU_IMAGE_REPO" "$full_cuvs_bench_cpu_tag"
cuvs_bench_cpu_source_tags+=("${org}/${CUVS_BENCH_CPU_IMAGE_REPO}:$full_cuvs_bench_cpu_tag")
if [ "$CUVS_BENCH_CPU_IMAGE_BUILT" = "true" ]; then
check_tag_exists "$CUVS_BENCH_CPU_IMAGE_REPO" "$full_cuvs_bench_cpu_tag"
cuvs_bench_cpu_source_tags+=("${org}/${CUVS_BENCH_CPU_IMAGE_REPO}:$full_cuvs_bench_cpu_tag")
fi
fi
done

# Create and push Docker multi-arch manifests
docker manifest create "${org}/${BASE_IMAGE_REPO}:${base_tag}" "${base_source_tags[@]}"
docker manifest push "${org}/${BASE_IMAGE_REPO}:${base_tag}"
if [ "$RAPIDS_MANIFEST" == "true" ]; then
docker manifest create "${org}/${BASE_IMAGE_REPO}:${base_tag}" "${base_source_tags[@]}"
docker manifest push "${org}/${BASE_IMAGE_REPO}:${base_tag}"

docker manifest create "${org}/${NOTEBOOKS_IMAGE_REPO}:${notebooks_tag}" "${notebooks_source_tags[@]}"
docker manifest push "${org}/${NOTEBOOKS_IMAGE_REPO}:${notebooks_tag}"
docker manifest create "${org}/${NOTEBOOKS_IMAGE_REPO}:${notebooks_tag}" "${notebooks_source_tags[@]}"
docker manifest push "${org}/${NOTEBOOKS_IMAGE_REPO}:${notebooks_tag}"
fi

docker manifest create "${org}/${CUVS_BENCH_IMAGE_REPO}:${cuvs_bench_tag}" "${cuvs_bench_source_tags[@]}"
docker manifest push "${org}/${CUVS_BENCH_IMAGE_REPO}:${cuvs_bench_tag}"
if [ "$CUVS_MANIFEST" == "true" ]; then
docker manifest create "${org}/${CUVS_BENCH_IMAGE_REPO}:${cuvs_bench_tag}" "${cuvs_bench_source_tags[@]}"
docker manifest push "${org}/${CUVS_BENCH_IMAGE_REPO}:${cuvs_bench_tag}"

docker manifest create "${org}/${CUVS_BENCH_DATASETS_IMAGE_REPO}:${cuvs_bench_datasets_tag}" "${cuvs_bench_datasets_source_tags[@]}"
docker manifest push "${org}/${CUVS_BENCH_DATASETS_IMAGE_REPO}:${cuvs_bench_datasets_tag}"
docker manifest create "${org}/${CUVS_BENCH_DATASETS_IMAGE_REPO}:${cuvs_bench_datasets_tag}" "${cuvs_bench_datasets_source_tags[@]}"
docker manifest push "${org}/${CUVS_BENCH_DATASETS_IMAGE_REPO}:${cuvs_bench_datasets_tag}"

if [ "$CUVS_BENCH_CPU_IMAGE_BUILT" = "true" ]; then
docker manifest create "${org}/${CUVS_BENCH_CPU_IMAGE_REPO}:${cuvs_bench_cpu_tag}" "${cuvs_bench_cpu_source_tags[@]}"
docker manifest push "${org}/${CUVS_BENCH_CPU_IMAGE_REPO}:${cuvs_bench_cpu_tag}"
if [ "$CUVS_BENCH_CPU_IMAGE_BUILT" = "true" ]; then
docker manifest create "${org}/${CUVS_BENCH_CPU_IMAGE_REPO}:${cuvs_bench_cpu_tag}" "${cuvs_bench_cpu_source_tags[@]}"
docker manifest push "${org}/${CUVS_BENCH_CPU_IMAGE_REPO}:${cuvs_bench_cpu_tag}"
fi
fi

0 comments on commit f6161ea

Please sign in to comment.