-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (129 loc) · 5.63 KB
/
build-external.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
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
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 }}"