diff --git a/.github/workflows/runners.yaml b/.github/workflows/cuda-dind-runners.yaml similarity index 89% rename from .github/workflows/runners.yaml rename to .github/workflows/cuda-dind-runners.yaml index 9468d2c..021a1bc 100644 --- a/.github/workflows/runners.yaml +++ b/.github/workflows/cuda-dind-runners.yaml @@ -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 @@ -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 }} diff --git a/.github/workflows/cuda-runners.yaml b/.github/workflows/cuda-runners.yaml new file mode 100644 index 0000000..f3e7ba7 --- /dev/null +++ b/.github/workflows/cuda-runners.yaml @@ -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 }}