-
Notifications
You must be signed in to change notification settings - Fork 9
194 lines (193 loc) · 8.02 KB
/
main.yaml
File metadata and controls
194 lines (193 loc) · 8.02 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
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:
driver_kind: ["cuda"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Load CUDA config
id: load_config
run: |
cuda_version=$(yq e '.cuda.version' driver_config.yml)
echo "CUDA_VERSION=$cuda_version"
echo "cuda_version=$cuda_version" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Docker to use containerd
uses: docker/setup-docker-action@v4
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- name: Cache Docker layers
uses: actions/cache@v5
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Generate timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- uses: paulhatch/semantic-version@v5.0.0-alpha2
with:
bump_each_commit: false
version_format: "${{ steps.load_config.outputs.cuda_version }}-${{ steps.timestamp.outputs.timestamp }}"
id: semver
- name: 'Check version'
run: |
echo "version is ${{ steps.semver.outputs.version }}"
echo "version is ${{ steps.semver.outputs.version_tag }}"
- name: 'Azure CLI login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Build and Push'
run: |
set -x
echo "tag is: "
echo ${{ steps.semver.outputs.version }}
docker buildx build --platform linux/arm64/v8,linux/amd64 --build-arg DRIVER_KIND=${{ matrix.driver_kind }} --build-arg DRIVER_VERSION=${{ steps.load_config.outputs.cuda_version }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu-cuda:${{ steps.semver.outputs.version }} .
docker images
az acr login -n ${{ secrets.AZURE_REGISTRY_SERVER }}
docker push ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu-cuda:${{ steps.semver.outputs.version }}
- 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:
driver_kind: ["cuda"]
platform:
- linux/arm64
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Load CUDA config
id: load_config
run: |
cuda_version=$(yq e '.cuda.version' driver_config.yml)
echo "CUDA_VERSION=$cuda_version"
echo "cuda_version=$cuda_version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v5
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Generate timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- uses: paulhatch/semantic-version@v5.0.0-alpha2
with:
bump_each_commit: false
version_format: "${{ steps.load_config.outputs.cuda_version }}-${{ steps.timestamp.outputs.timestamp }}"
id: semver
- name: 'Check version'
run: |
echo "version is ${{ steps.semver.outputs.version }}"
echo "version is ${{ steps.semver.outputs.version_tag }}"
- name: 'Azure CLI login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Build and Push'
run: |
set -x
echo "tag is: "
echo ${{ steps.semver.outputs.version }}
docker buildx build --build-arg DRIVER_KIND=${{ matrix.driver_kind }} --build-arg DRIVER_VERSION=${{ steps.load_config.outputs.cuda_version }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu-cuda-arm64:${{ steps.semver.outputs.version }} .
docker images
az acr login -n ${{ secrets.AZURE_REGISTRY_SERVER }}
docker push ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu-cuda-arm64:${{ steps.semver.outputs.version }}
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
grid:
runs-on: ubuntu-latest
strategy:
matrix:
driver_kind: ["grid"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Load GRID config
id: load_config
run: |
grid_version=$(yq e '.grid.version' driver_config.yml)
grid_url=$(yq e '.grid.url' driver_config.yml)
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@v3
- name: Generate timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- uses: paulhatch/semantic-version@v5.0.0-alpha2
- name: Cache Docker layers
uses: actions/cache@v5
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.driver_kind}}-${{ steps.load_config.outputs.grid_version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.driver_kind}}-${{ steps.load_config.outputs.grid_version }}
- uses: paulhatch/semantic-version@v5.0.0-alpha2
with:
bump_each_commit: false
version_format: "${{ steps.load_config.outputs.grid_version }}-${{ steps.timestamp.outputs.timestamp }}"
id: semver
- name: 'Check version'
run: |
echo "version is ${{ steps.semver.outputs.version }}"
echo "version is ${{ steps.semver.outputs.version_tag }}"
- name: 'Azure CLI login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Build and Push'
run: |
set -x
echo "tag is: "
echo ${{ steps.semver.outputs.version }}
docker buildx build --build-arg DRIVER_URL=${{ steps.load_config.outputs.grid_url }} --build-arg DRIVER_KIND=${{ matrix.driver_kind }} --build-arg DRIVER_VERSION=${{ steps.load_config.outputs.grid_version }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new --output=type=docker -t ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu-grid:${{ steps.semver.outputs.version }} .
docker images
az acr login -n ${{ secrets.AZURE_REGISTRY_SERVER }}
docker push ${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks/aks-gpu-grid:${{ steps.semver.outputs.version }}
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache