-
Notifications
You must be signed in to change notification settings - Fork 251
151 lines (133 loc) · 5.77 KB
/
Copy pathon-release.yaml
File metadata and controls
151 lines (133 loc) · 5.77 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
# Copyright 2025 NVIDIA CORPORATION
# SPDX-License-Identifier: Apache-2.0
name: KAI Scheduler - Release
on:
release:
types:
- created
workflow_dispatch:
env:
DOCKER_REGISTRY: "ghcr.io/kai-scheduler/kai-scheduler"
jobs:
build-and-push:
name: Build & Push
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.package_version.outputs.PACKAGE_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Extract package version
id: package_version
run: |
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
GIT_REV=$(git rev-parse --short HEAD | sed 's/^0*//')
PACKAGE_VERSION=0.0.0-$GIT_REV
else
PACKAGE_VERSION=${GITHUB_REF_NAME}
fi
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
echo $PACKAGE_VERSION
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Move Docker Data to /mnt
run: |
sudo systemctl stop docker
sudo mkdir -p /mnt/docker-data
echo '{"data-root": "/mnt/docker-data"}' | sudo tee /etc/docker/daemon.json
sudo systemctl start docker
- name: Create image cache directory
run: |
sudo mkdir -p /mnt/images
sudo chown -R $USER:$USER /mnt/images
- name: Cache for docker images and helm chart
uses: actions/cache@v6
with:
path: /mnt/images
key: images-${{ github.sha }}
- name: Build docker images
run: |
make build DOCKER_BUILDX_ADDITIONAL_ARGS="--load --cache-from type=gha --cache-to type=gha,mode=max" VERSION=$PACKAGE_VERSION
docker save $(docker images --format '{{.Repository}}:{{.Tag}}' | grep $PACKAGE_VERSION) | gzip > /mnt/images/docker_images.tgz
- name: Build helm chart
run: |
sed -i 's#registry/local/kai-scheduler#${{ env.DOCKER_REGISTRY }}#' deployments/kai-scheduler/values.yaml
helm package ./deployments/kai-scheduler -d ./charts --app-version $PACKAGE_VERSION --version $PACKAGE_VERSION
cp charts/kai-scheduler-$PACKAGE_VERSION.tgz /mnt/images/
- name: Upload As Release Asset
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: charts/kai-scheduler-${{ env.PACKAGE_VERSION }}.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
e2e-matrix:
name: E2E (${{ matrix.k8s_version }}, ${{ matrix.feature_config }})
needs: build-and-push
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Update with each release to match the current k8s support window.
# Verify patch versions at https://github.com/kubernetes-sigs/kind/releases
# DRA feature config is only relevant for v1.32 (v1beta1) and v1.33 (v1beta2).
# v1.34+ has DRA GA; v1.31 and earlier predate the DRA beta.
- k8s_version: v1.36.1
feature_config: default
- k8s_version: v1.35.0
feature_config: default
- k8s_version: v1.34.0
feature_config: default
- k8s_version: v1.33.4
feature_config: default
- k8s_version: v1.33.4
feature_config: dra-enabled
- k8s_version: v1.32.3
feature_config: default
- k8s_version: v1.32.3
feature_config: dra-enabled
- k8s_version: v1.31.6
feature_config: default
- k8s_version: v1.30.4
feature_config: default
- k8s_version: v1.29.8
feature_config: default
- k8s_version: v1.28.13
feature_config: default
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup e2e cluster
uses: ./.github/actions/setup-e2e-cluster
with:
package_version: ${{ needs.build-and-push.outputs.package_version }}
k8s_version: ${{ matrix.k8s_version }}
feature_config: ${{ matrix.feature_config }}
- name: Install KAI-scheduler
env:
PACKAGE_VERSION: ${{ needs.build-and-push.outputs.package_version }}
run: |
helm upgrade -i kai-scheduler /mnt/images/kai-scheduler-$PACKAGE_VERSION.tgz -n kai-scheduler --create-namespace \
--set "global.gpuSharing=true" --set "global.registry=localhost:30100" --set "prometheus.enabled=true" --debug --wait
kubectl create clusterrole pods-patcher --verb=patch --resource=pods
kubectl create rolebinding fake-status-updater --clusterrole=pods-patcher --serviceaccount=gpu-operator:status-updater -n kai-resource-reservation
- name: Run e2e tests
run: |
ginkgo -r --keep-going --randomize-all --randomize-suites --trace -vv --label-filter '!autoscale && !scale && !upgrade && !gitops' --output-dir=. --json-report=e2e-report.json ./test/e2e/suites
- name: Print test summary
if: always()
run: |
echo "=== Failed Tests ==="
jq -r '.[].SpecReports[] | select(.State == "failed") | ([.ContainerHierarchyTexts[], .LeafNodeText] | join(" > "))' e2e-report.json 2>/dev/null || echo "No failed tests found"
echo ""
echo "=== Skipped Tests ==="
jq -r '.[].SpecReports[] | select(.State == "skipped") | ([.ContainerHierarchyTexts[], .LeafNodeText] | join(" > "))' e2e-report.json 2>/dev/null || echo "No skipped tests found"
- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-report-${{ matrix.k8s_version }}-${{ matrix.feature_config }}
path: e2e-report.json
if-no-files-found: ignore