Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
One python version per container (#22)
Browse files Browse the repository at this point in the history
* make python version part of container build

* correct default

* trying to refactor to follow mambaforge-cuda repo

* get args from action

* remove image repo step

* define image repo in build-image.yml

* fix py ver

* add missing $ sign

* set CPU_ARCH as build arg

* remove comments

* address review comments

* add empty line at EOF

* combine build dockerfile

* correct typo

* fix another typo

* fix switch case

* set real arch

* ubuntu20 only arm images

* add ubuntu20.04 to citestwheel, update README, and delete unused files/folders

* temporarily try to build images from pr

* fix IMAGE_REPO access

* Revert "temporarily try to build images from pr"

This reverts commit e433ea0.

* remove 'base' from tags

* make sure RAPIDS_CUDA_VERSION is available in the env

* Revert "Revert "temporarily try to build images from pr""

This reverts commit a0fed82.

* pass manylinux arg

* Apply suggestions from code review

Co-authored-by: AJ Schmidt <[email protected]>

* simplify citestwheel

* add awscli in citestwheel

* pip install awscli

* stop pushing images

* rename merge to push for better diff

* Update .github/workflows/push.yml

Co-authored-by: AJ Schmidt <[email protected]>

---------

Co-authored-by: AJ Schmidt <[email protected]>
  • Loading branch information
divyegala and ajschmidt8 authored Jun 1, 2023
1 parent 83a4264 commit 83e3cbe
Show file tree
Hide file tree
Showing 17 changed files with 464 additions and 558 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/build-and-publish-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: build and publish imgs workflow

on:
workflow_call:
inputs:
build_type:
required: true
type: string

defaults:
run:
shell: bash

jobs:
compute-matrix:
runs-on: ubuntu-latest
outputs:
MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Compute matrix
id: compute-matrix
run: |
MATRIX=$(ci/compute-mx.sh)
echo "MATRIX=${MATRIX}" | tee -a ${GITHUB_OUTPUT}
docker:
needs: compute-matrix
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
fail-fast: false
secrets: inherit
uses: ./.github/workflows/build-image.yml
with:
ARCHES: ${{ toJSON(matrix.ARCHES) }}
CUDA_VER: ${{ matrix.CUDA_VER }}
LINUX_VER: ${{ matrix.LINUX_VER }}
PYTHON_VER: ${{ matrix.PYTHON_VER }}
IMAGE_REPO: ${{ matrix.IMAGE_REPO }}
TAG: rapidsai/${{ matrix.IMAGE_REPO }}:cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PYTHON_VER }}
BUILD_TYPE: ${{ inputs.build_type }}
build-multiarch-manifest:
if: inputs.build_type == 'branch'
needs: [docker, compute-matrix]
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
password: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
- name: Create multiarch manifest
run: |
LATEST_CUDA_VER=$(yq '.CUDA_VER | sort | .[-1]' axis.yaml)
LATEST_PYTHON_VER=$(yq -o json '.PYTHON_VER' axis.yaml | jq -r 'max_by(split(".") | map(tonumber))')
LATEST_UBUNTU_VER=$(yq '.LINUX_VER | map(select(. == "*ubuntu*")) | sort | .[-1]' axis.yaml)
source_tags=()
tag="rapidsai/${{ matrix.IMAGE_REPO }}:cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PYTHON_VER }}"
for arch in $(echo '${{ toJSON(matrix.ARCHES) }}' | jq .[] -r); do
source_tags+=("${tag}-${arch}")
done
docker manifest create ${tag} ${source_tags[@]}
docker manifest push ${tag}
if [[
"${LATEST_UBUNTU_VER}" == "${{ matrix.LINUX_VER }}" &&
"${LATEST_CUDA_VER}" == "${{ matrix.CUDA_VER }}" &&
"${LATEST_PYTHON_VER}" == "${{ matrix.PYTHON_VER }}"
]]; then
docker manifest create rapidsai/${{ matrix.IMAGE_REPO }}:latest ${source_tags[@]}
docker manifest push rapidsai/${{ matrix.IMAGE_REPO }}:latest
fi
delete-temp-images:
if: inputs.build_type == 'branch'
needs: [compute-matrix, build-multiarch-manifest]
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
runs-on: ubuntu-latest
steps:
- name: Remove temporary images
run: |
HUB_TOKEN=$(
curl -s -H "Content-Type: application/json" \
-X POST \
-d "{\"username\": \"${{ secrets.GPUCIBOT_DOCKERHUB_USER }}\", \"password\": \"${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}\"}" \
https://hub.docker.com/v2/users/login/ | jq -r .token \
)
org="rapidsai"
repo="${{ matrix.IMAGE_REPO }}"
tag="cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PYTHON_VER }}"
for arch in $(echo '${{ toJSON(matrix.ARCHES) }}' | jq .[] -r); do
curl -i -X DELETE \
-H "Accept: application/json" \
-H "Authorization: JWT $HUB_TOKEN" \
"https://hub.docker.com/v2/repositories/$org/$repo/tags/$tag-$arch/"
done
80 changes: 80 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and push image variant

on:
workflow_call:
inputs:
ARCHES:
required: true
type: string
CUDA_VER:
required: true
type: string
LINUX_VER:
required: true
type: string
PYTHON_VER:
required: true
type: string
IMAGE_REPO:
required: true
type: string
TAG:
required: true
type: string
BUILD_TYPE:
required: true
type: string

jobs:
docker-build:
strategy:
matrix:
ARCH: ${{ fromJSON(inputs.ARCHES) }}
CUDA_VER: ["${{ inputs.CUDA_VER }}"]
LINUX_VER: ["${{ inputs.LINUX_VER }}"]
PYTHON_VER: ["${{ inputs.PYTHON_VER }}"]
fail-fast: false
runs-on: "linux-${{ matrix.ARCH }}-cpu4"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
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@v2
with:
driver: docker
endpoint: builders
- name: Get Real Arch and Manylinux Version
id: get-real-arch
run: |
REAL_ARCH=$(arch)
echo "REAL_ARCH=${REAL_ARCH}" >> $GITHUB_OUTPUT
if [[ "${{ inputs.LINUX_VER }}" == "ubuntu20.04" || "${{ inputs.LINUX_VER }}" == "ubuntu18.04" ]]; then
echo "MANYLINUX_VER=manylinux_2_31" >> $GITHUB_OUTPUT
else
echo "MANYLINUX_VER=manylinux_2_17" >> $GITHUB_OUTPUT
fi
- name: Build image
if:
uses: docker/build-push-action@v4
with:
context: ./${{ inputs.IMAGE_REPO }}
file: ./${{ inputs.IMAGE_REPO }}/Dockerfile
push: ${{ inputs.BUILD_TYPE == 'branch' }}
pull: true
build-args: |
CUDA_VER=${{ inputs.CUDA_VER }}
LINUX_VER=${{ inputs.LINUX_VER }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
CPU_ARCH=${{ matrix.ARCH }}
REAL_ARCH=${{ steps.get-real-arch.outputs.REAL_ARCH }}
MANYLINUX_VER=${{ steps.get-real-arch.outputs.MANYLINUX_VER }}
tags: ${{ inputs.TAG }}-${{ matrix.ARCH }}
160 changes: 0 additions & 160 deletions .github/workflows/docker-multiarch-native.yml

This file was deleted.

14 changes: 6 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
name: PR build of RAPIDS pip wheel CI images
name: ci

on:
push:
branches:
- "pull-request/[0-9]+"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cibw-containers:
uses: ./.github/workflows/docker-multiarch-native.yml
secrets: inherit
build-images:
uses: ./.github/workflows/build-and-publish-images.yml
with:
matrix_script: "./ci/compute-matrix.sh"
push: false
build_type: branch
build_type: pull-request
secrets: inherit
15 changes: 6 additions & 9 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
name: Build and push RAPIDS pip wheel CI images
name: publish

on:
push:
branches:
- "main"
workflow_dispatch:
- "imgs-v2"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cibw-containers:
uses: ./.github/workflows/docker-multiarch-native.yml
secrets: inherit
build-images:
uses: ./.github/workflows/build-and-publish-images.yml
with:
matrix_script: "./ci/compute-matrix.sh"
push: true
build_type: branch
secrets: inherit
Loading

0 comments on commit 83e3cbe

Please sign in to comment.