Skip to content

Build => Test => Deploy External Projects #731

Build => Test => Deploy External Projects

Build => Test => Deploy External Projects #731

---
name: Build => Test => Deploy External Projects
on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 0 * * *" # run at 0 AM UTC
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
DEBIAN_FRONTEND: noninteractive
RUST_MIN_STACK: "2097152"
REGISTRY: quay.io
REGISTRY_USER: kerryeon
REGISTRY_REPOSITORY: ulagbulag
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
REPOSITORY_NAME: openark
IMAGE_NAME: openark
PACKAGE_YQ_URL: https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
# Common variables
OS_FLATCAR_NAME: flatcar
OS_FLATCAR_RELEASE_CHANNEL: stable
OS_FLATCAR_RELEASE_URL: https://flatcar-linux.org/releases-json/releases.json
OS_ROCKYLINUX_NAME: rocky
OS_ROCKYLINUX_VERSION: "9.1"
UBUNTU_VERSION: "22.04"
# GPU => NVIDIA => Driver
GIT_GPU_NVIDIA_DRIVER_REPO: https://github.com/ulagbulag/openark-gpu-nvidia-driver-container-images.git
HELM_GPU_NVIDIA_OPERATOR_VALUE_URL: https://raw.githubusercontent.com/NVIDIA/gpu-operator/master/deployments/gpu-operator/values.yaml
jobs:
build-and-push-image-gpu-nvidia-driver:
if: ${{ github.repository }} == 'ulagbulag/OpenARK'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Install dependencies
run: >
sudo apt-get update
&& sudo apt-get install -y curl git jq podman wget
&& mkdir -p /home/runner/.docker/
&& echo '{"auths":{"quay.io":{}}}' >/home/runner/.docker/config.json
- name: Install package - yq
run: |
wget -qO /usr/local/bin/yq '${{ env.PACKAGE_YQ_URL }}' \
&& chmod a+x /usr/local/bin/yq
- name: Checkout repository
run: |
git clone '${{ env.GIT_GPU_NVIDIA_DRIVER_REPO }}' \
--branch master \
--single-branch \
driver
- name: Get the target cuda version
run: |
echo NVIDIA_CUDA_VERSION=$(
curl -s '${{ env.HELM_GPU_NVIDIA_OPERATOR_VALUE_URL }}' |
yq -r '.operator.initContainer.version' |
egrep -o '^[0-9\.]*'
) >> $GITHUB_ENV
- name: Get the target driver version
run: |
echo NVIDIA_DRIVER_VERSION=$(
curl -s '${{ env.HELM_GPU_NVIDIA_OPERATOR_VALUE_URL }}' |
yq -r '.driver.version'
) >> $GITHUB_ENV
- name: Get the latest OS version
run: |
echo OS_FLATCAR_VERSION=$(
curl -s '${{ env.OS_FLATCAR_RELEASE_URL }}' |
jq -r '[ to_entries[] | select(.value.channel == "stable") | select(.key > "0") | select(.key <= "9") | .key ] | max'
) >> $GITHUB_ENV
- name: Get the latest OS kernel version
run: |
echo OS_FLATCAR_RELEASE_KERNEL_VERSION=$(
curl -s '${{ env.OS_FLATCAR_RELEASE_URL }}' |
jq -r '."${{ env.OS_FLATCAR_VERSION }}".major_software.kernel[0]'
) >> $GITHUB_ENV
- name: Log in to ${{ env.REGISTRY }}
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Build Image | Flatcar Container Linux
id: build-and-push-image-flatcar
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}-gpu-nvidia-driver
tags: ${{ env.NVIDIA_DRIVER_VERSION }}-${{ env.OS_FLATCAR_NAME }}${{ env.OS_FLATCAR_VERSION }}
context: "./driver/flatcar"
containerfiles: |
./driver/flatcar/Dockerfile
build-args: |
CUDA_VERSION=${{ env.NVIDIA_CUDA_VERSION }}
DRIVER_VERSION=${{ env.NVIDIA_DRIVER_VERSION }}
FLATCAR_RELEASE_BOARD=amd64-usr
FLATCAR_RELEASE_CHANNEL=${{ env.OS_FLATCAR_RELEASE_CHANNEL }}
FLATCAR_VERSION=${{ env.OS_FLATCAR_VERSION }}
UBUNTU_VERSION=${{ env.UBUNTU_VERSION }}
- name: Push To ${{ env.REGISTRY }} | Flatcar Container Linux
id: push-to-quay-flatcar
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-and-push-image-flatcar.outputs.image }}
tags: ${{ steps.build-and-push-image-flatcar.outputs.tags }}
registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_REPOSITORY }}
- name: Print image url | Flatcar Container Linux
run: echo "Image pushed to ${{ steps.push-to-quay-flatcar.outputs.registry-paths }}"
# - name: Build Image | RockyLinux
# id: build-and-push-image-rockylinux
# uses: redhat-actions/buildah-build@v2
# with:
# image: ${{ env.IMAGE_NAME }}-gpu-nvidia-driver
# tags: ${{ env.NVIDIA_DRIVER_VERSION }}-${{ env.OS_ROCKYLINUX_NAME }}${{ env.OS_ROCKYLINUX_VERSION }}
# context: "./driver/flatcar"
# containerfiles: |
# ./driver/rocky/Dockerfile
# build-args: |
# CUDA_VERSION=${{ env.NVIDIA_CUDA_VERSION }}
# DRIVER_VERSION=${{ env.NVIDIA_DRIVER_VERSION }}
# ROCKYLINUX_VERSION=${{ env.OS_ROCKYLINUX_VERSION }}
# - name: Push To ${{ env.REGISTRY }} | RockyLinux
# id: push-to-quay-rockylinux
# uses: redhat-actions/push-to-registry@v2
# with:
# image: ${{ steps.build-and-push-image-rockylinux.outputs.image }}
# tags: ${{ steps.build-and-push-image-rockylinux.outputs.tags }}
# registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_REPOSITORY }}
# - name: Print image url | RockyLinux
# run: echo "Image pushed to ${{ steps.push-to-quay-rockylinux.outputs.registry-paths }}"