Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda runner image for T4s #46

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
push:
branches:
- 'main'
workflow_dispatch:

env:
DOCKERHUB_USERNAME: voltrondatabot
DOCKERHUB_ORGANIZATION: voltrondata
CUDA_BASE_IMAGE: nvidia/cuda:11.4.2-devel-ubuntu
DOCKER_IMAGE_NAME: cuda-actions-runner

Expand Down Expand Up @@ -67,8 +69,7 @@ jobs:
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
RUNNER_CONTAINER_HOOKS_VERSION=${{ env.RUNNER_CONTAINER_HOOKS_VERSION }}
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }}:v${{ env.RUNNER_VERSION }}-${{ env.OS_NAME }}-${{ env.OS_VERSION }}
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }}:v${{ env.RUNNER_VERSION }}-${{ env.OS_NAME }}-${{ env.OS_VERSION }}-${{ env.sha_short }}
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }}:latest
${{ env.DOCKERHUB_ORGANIZATION }}/${{ env.DOCKER_IMAGE_NAME }}:dind-v${{ env.RUNNER_VERSION }}-${{ env.OS_NAME }}-${{ env.OS_VERSION }}
${{ env.DOCKERHUB_ORGANIZATION }}/${{ env.DOCKER_IMAGE_NAME }}:dind-v${{ env.RUNNER_VERSION }}-${{ env.OS_NAME }}-${{ env.OS_VERSION }}-${{ env.sha_short }}
cache-from: type=gha,scope=build-${{ env.DOCKER_IMAGE_NAME }}
cache-to: type=gha,mode=max,scope=build-${{ env.DOCKER_IMAGE_NAME }}
76 changes: 76 additions & 0 deletions .github/workflows/cuda-runners.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Runners

on:
# We must do a trigger on a push: instead of a types: closed so GitHub Secrets
# are available to the workflow run
push:
branches:
- 'main'
workflow_dispatch:

env:
DOCKERHUB_USERNAME: voltrondatabot
DOCKERHUB_ORGANIZATION: voltrondata
CUDA_BASE_IMAGE: nvidia/cuda:11.4.2-devel-ubuntu
DOCKER_IMAGE_NAME: cuda-actions-runner

jobs:
build-runners:
name: Build cuda-actions-runner-ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Get env vars from upstream action-runner-controller
run: |
runner_version=$(grep -R "RUNNER_VERSION:" actions-runner-controller/.github/workflows/runners.yaml | tr -d " " | cut -d ":" -f 2)
docker_version=$(grep -R "DOCKER_VERSION:" actions-runner-controller/.github/workflows/runners.yaml | tr -d " " | cut -d ":" -f 2)
runner_container_hooks_version=$(grep -R "RUNNER_CONTAINER_HOOKS_VERSION:" actions-runner-controller/.github/workflows/runners.yaml | tr -d " " | cut -d ":" -f 2)
#os_name=$(grep -R "os-name:" actions-runner-controller/.github/workflows/runners.yaml | head -1 | tr -d " " | cut -d ":" -f 2)
#os_version=$(grep -R "os-version:" actions-runner-controller/.github/workflows/runners.yaml | head -1 | tr -d " " | cut -d ":" -f 2)
os_name=ubuntu
os_version=20.04
echo "RUNNER_VERSION=$runner_version" >> $GITHUB_ENV
echo "DOCKER_VERSION=$docker_version" >> $GITHUB_ENV
echo "RUNNER_CONTAINER_HOOKS_VERSION=$runner_container_hooks_version" >> $GITHUB_ENV
echo "OS_NAME=$os_name" >> $GITHUB_ENV
echo "OS_VERSION=$os_version" >> $GITHUB_ENV
- name: Patch Dockerfile
run: |
sed -i "s@FROM ubuntu:\([0-9]\{2\}\.[0-9]\{2\}\)@FROM ${CUDA_BASE_IMAGE}\1@" actions-runner-controller/runner/actions-runner.${OS_NAME}-${OS_VERSION}.dockerfile
cat actions-runner-controller/runner/actions-runner.${OS_NAME}-${OS_VERSION}.dockerfile

- name: Setup Docker Environment
id: vars
uses: ./actions-runner-controller/.github/actions/setup-docker-environment
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build and Push Versioned Tags
uses: docker/build-push-action@v3
with:
context: ./actions-runner-controller/runner
file: ./actions-runner-controller/runner/actions-runner.${{ env.OS_NAME }}-${{ env.OS_VERSION }}.dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
build-args: |
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
RUNNER_CONTAINER_HOOKS_VERSION=${{ env.RUNNER_CONTAINER_HOOKS_VERSION }}
tags: |
${{ env.DOCKERHUB_ORGANIZATION }}/${{ env.DOCKER_IMAGE_NAME }}:v${{ env.RUNNER_VERSION }}-${{ env.OS_NAME }}-${{ env.OS_VERSION }}
${{ env.DOCKERHUB_ORGANIZATION }}/${{ env.DOCKER_IMAGE_NAME }}:v${{ env.RUNNER_VERSION }}-${{ env.OS_NAME }}-${{ env.OS_VERSION }}-${{ env.sha_short }}
${{ env.DOCKERHUB_ORGANIZATION }}/${{ env.DOCKER_IMAGE_NAME }}:latest
cache-from: type=gha,scope=build-${{ env.DOCKER_IMAGE_NAME }}
cache-to: type=gha,mode=max,scope=build-${{ env.DOCKER_IMAGE_NAME }}