-
Notifications
You must be signed in to change notification settings - Fork 13
254 lines (253 loc) · 10.6 KB
/
Copy pathmain.yaml
File metadata and controls
254 lines (253 loc) · 10.6 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
name: Building and Pushing to MCR
on:
push:
branches:
- main
workflow_dispatch: {}
permissions:
id-token: write
contents: read
jobs:
cuda:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- config_key: cuda
image_repo: aks-gpu-cuda
- config_key: cuda_lts
image_repo: aks-gpu-cuda-lts
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0
- name: Load CUDA config
id: load_config
env:
CONFIG_KEY: ${{ matrix.config_key }}
run: |
cuda_version=$(yq e ".${CONFIG_KEY}.version" driver_config.yml)
if [[ ! "$cuda_version" =~ ^[0-9]+(\.[0-9]+)+$ ]]; then
echo "::error::Refusing unexpected CUDA driver version: $cuda_version"
exit 1
fi
echo "CUDA_VERSION=$cuda_version"
echo "cuda_version=$cuda_version" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Set up Docker to use containerd
uses: docker/setup-docker-action@77e84dbf09b47d1e29270283c22f16145aa85ca1 # v5.4.0
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- name: Cache Docker layers
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.image_repo }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.image_repo }}-
- name: Generate timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
- uses: paulhatch/semantic-version@9f72830310d5ed81233b641ee59253644cd8a8fc # v6.0.2
with:
bump_each_commit: false
version_format: "${{ steps.load_config.outputs.cuda_version }}-${{ steps.timestamp.outputs.timestamp }}"
id: semver
- name: 'Check version'
env:
VERSION: ${{ steps.semver.outputs.version }}
VERSION_TAG: ${{ steps.semver.outputs.version_tag }}
run: |
echo "version is $VERSION"
echo "version is $VERSION_TAG"
- name: 'Azure CLI login'
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Build and Push'
env:
DRIVER_VERSION: ${{ steps.load_config.outputs.cuda_version }}
IMAGE_REPO: ${{ matrix.image_repo }}
REGISTRY_SERVER: ${{ secrets.AZURE_REGISTRY_SERVER }}
VERSION: ${{ steps.semver.outputs.version }}
run: |
set -x
echo "tag is: "
echo "$VERSION"
image_ref="${REGISTRY_SERVER}/public/aks/${IMAGE_REPO}:${VERSION}"
docker buildx build --platform linux/arm64/v8,linux/amd64 --build-arg DRIVER_KIND=cuda --build-arg "DRIVER_VERSION=${DRIVER_VERSION}" --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t "$image_ref" .
docker images
az acr login -n "$REGISTRY_SERVER"
docker push "$image_ref"
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
cuda-arm64:
runs-on: ubuntu-24.04-arm # see https://github.com/actions/partner-runner-images?tab=readme-ov-file#available-images
strategy:
matrix:
include:
- config_key: cuda
image_repo: aks-gpu-cuda-arm64
- config_key: cuda_lts
image_repo: aks-gpu-cuda-lts-arm64
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0
- name: Load CUDA config
id: load_config
env:
CONFIG_KEY: ${{ matrix.config_key }}
run: |
cuda_version=$(yq e ".${CONFIG_KEY}.version" driver_config.yml)
if [[ ! "$cuda_version" =~ ^[0-9]+(\.[0-9]+)+$ ]]; then
echo "::error::Refusing unexpected CUDA driver version: $cuda_version"
exit 1
fi
echo "CUDA_VERSION=$cuda_version"
echo "cuda_version=$cuda_version" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Cache Docker layers
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.image_repo }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.image_repo }}-
- name: Generate timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
- uses: paulhatch/semantic-version@9f72830310d5ed81233b641ee59253644cd8a8fc # v6.0.2
with:
bump_each_commit: false
version_format: "${{ steps.load_config.outputs.cuda_version }}-${{ steps.timestamp.outputs.timestamp }}"
id: semver
- name: 'Check version'
env:
VERSION: ${{ steps.semver.outputs.version }}
VERSION_TAG: ${{ steps.semver.outputs.version_tag }}
run: |
echo "version is $VERSION"
echo "version is $VERSION_TAG"
- name: 'Azure CLI login'
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Build and Push'
env:
DRIVER_VERSION: ${{ steps.load_config.outputs.cuda_version }}
IMAGE_REPO: ${{ matrix.image_repo }}
REGISTRY_SERVER: ${{ secrets.AZURE_REGISTRY_SERVER }}
VERSION: ${{ steps.semver.outputs.version }}
run: |
set -x
echo "tag is: "
echo "$VERSION"
image_ref="${REGISTRY_SERVER}/public/aks/${IMAGE_REPO}:${VERSION}"
docker buildx build --build-arg DRIVER_KIND=cuda --build-arg "DRIVER_VERSION=${DRIVER_VERSION}" --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t "$image_ref" .
docker images
az acr login -n "$REGISTRY_SERVER"
docker push "$image_ref"
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
grid:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- config_key: grid
image_repo: aks-gpu-grid
- config_key: grid_v20
image_repo: aks-gpu-grid-v20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
fetch-depth: 0
- name: Load GRID config
id: load_config
env:
CONFIG_KEY: ${{ matrix.config_key }}
run: |
grid_version=$(yq e ".${CONFIG_KEY}.version" driver_config.yml)
grid_url=$(yq e ".${CONFIG_KEY}.url" driver_config.yml)
if [[ ! "$grid_version" =~ ^[0-9]+(\.[0-9]+)+$ ]]; then
echo "::error::Refusing unexpected GRID driver version: $grid_version"
exit 1
fi
if [[ ! "$grid_url" =~ ^https://[A-Za-z0-9._~:/?#@%+=-]+$ ]]; then
echo "::error::Refusing unexpected GRID driver URL: $grid_url"
exit 1
fi
echo "GRID_VERSION=$grid_version"
echo "GRID_URL=$grid_url"
echo "grid_version=$grid_version" >> "$GITHUB_OUTPUT"
echo "grid_url=$grid_url" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Generate timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
- uses: paulhatch/semantic-version@9f72830310d5ed81233b641ee59253644cd8a8fc # v6.0.2
- name: Cache Docker layers
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.image_repo }}-${{ steps.load_config.outputs.grid_version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.image_repo }}-${{ steps.load_config.outputs.grid_version }}
- uses: paulhatch/semantic-version@9f72830310d5ed81233b641ee59253644cd8a8fc # v6.0.2
with:
bump_each_commit: false
version_format: "${{ steps.load_config.outputs.grid_version }}-${{ steps.timestamp.outputs.timestamp }}"
id: semver
- name: 'Check version'
env:
VERSION: ${{ steps.semver.outputs.version }}
VERSION_TAG: ${{ steps.semver.outputs.version_tag }}
run: |
echo "version is $VERSION"
echo "version is $VERSION_TAG"
- name: 'Azure CLI login'
uses: azure/login@7ddb5af1ef8758cf1353cf3b42f940aee27ba21c # v3.0.2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Build and Push'
env:
DRIVER_URL: ${{ steps.load_config.outputs.grid_url }}
DRIVER_VERSION: ${{ steps.load_config.outputs.grid_version }}
IMAGE_REPO: ${{ matrix.image_repo }}
REGISTRY_SERVER: ${{ secrets.AZURE_REGISTRY_SERVER }}
VERSION: ${{ steps.semver.outputs.version }}
run: |
set -x
echo "tag is: "
echo "$VERSION"
image_ref="${REGISTRY_SERVER}/public/aks/${IMAGE_REPO}:${VERSION}"
docker buildx build --build-arg "DRIVER_URL=${DRIVER_URL}" --build-arg DRIVER_KIND=grid --build-arg "DRIVER_VERSION=${DRIVER_VERSION}" --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t "$image_ref" .
docker images
az acr login -n "$REGISTRY_SERVER"
docker push "$image_ref"
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache