Skip to content

Commit e0acd87

Browse files
committed
feat: optimize CI pipeline with disk cleanup steps and improved build process
Signed-off-by: liuhy <[email protected]>
1 parent 76e71d9 commit e0acd87

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

.github/workflows/k8s-integration-test.yml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,32 @@ jobs:
8888
- name: Checkout code
8989
uses: actions/checkout@v4
9090

91+
- name: Free up disk space before build
92+
run: |
93+
echo "=== Initial disk usage ==="
94+
df -h
95+
echo ""
96+
echo "=== Cleaning up system ==="
97+
# Remove unnecessary packages and caches
98+
sudo apt-get clean
99+
sudo apt-get autoremove -y
100+
sudo rm -rf /var/lib/apt/lists/*
101+
sudo rm -rf /tmp/*
102+
sudo rm -rf /var/tmp/*
103+
104+
# Clean Docker system
105+
docker system prune -af --volumes
106+
107+
# Remove large unnecessary files/directories
108+
sudo rm -rf /usr/share/dotnet
109+
sudo rm -rf /usr/local/lib/android
110+
sudo rm -rf /opt/ghc
111+
sudo rm -rf /opt/hostedtoolcache/CodeQL
112+
113+
echo ""
114+
echo "=== Disk usage after cleanup ==="
115+
df -h
116+
91117
- name: Set up Docker Buildx
92118
uses: docker/setup-buildx-action@v3
93119

@@ -115,6 +141,20 @@ jobs:
115141
kind load docker-image ghcr.io/vllm-project/semantic-router/extproc:test --name semantic-router-test
116142
echo "Image loaded successfully!"
117143
144+
- name: Clean up after image build
145+
run: |
146+
echo "=== Cleaning up Docker build artifacts ==="
147+
# Remove build cache and unused images
148+
docker builder prune -af
149+
docker image prune -af
150+
151+
# Keep only the images we need
152+
docker images
153+
154+
echo ""
155+
echo "=== Disk usage after build cleanup ==="
156+
df -h
157+
118158
- name: Verify cluster
119159
run: |
120160
kubectl cluster-info
@@ -181,7 +221,7 @@ jobs:
181221
182222
# Reduce resource requirements for CI testing and set imagePullPolicy
183223
patches:
184-
# Patch for main container
224+
# Patch for main container - reduced resources for CI
185225
- patch: |-
186226
- op: replace
187227
path: /spec/template/spec/containers/0/resources/requests/memory
@@ -239,6 +279,22 @@ jobs:
239279
240280
echo "✓ Connectivity check completed"
241281
282+
- name: Final disk cleanup before deployment
283+
run: |
284+
echo "=== Final cleanup before deployment ==="
285+
# Clean up any remaining build artifacts
286+
docker system prune -f
287+
288+
# Clear system caches
289+
sudo sync
290+
echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null || true
291+
292+
echo "=== Final disk usage ==="
293+
df -h
294+
295+
echo "=== Available memory ==="
296+
free -h
297+
242298
- name: Deploy to kind cluster
243299
run: |
244300
echo "Deploying semantic-router to kind cluster..."

Dockerfile.extproc.cross

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,21 @@ RUN echo "Building Rust library with actual source code..." && \
7979
echo "Current directory: $(pwd)" && \
8080
echo "TARGETARCH: $TARGETARCH" && \
8181
ls -la candle-binding/src/ && \
82+
echo "Forcing clean rebuild..." && \
83+
cd candle-binding && \
84+
cargo clean && \
8285
# Set up environment for cross-compilation
8386
if [ "$TARGETARCH" = "arm64" ]; then \
8487
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc; \
8588
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc; \
8689
export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++; \
8790
export AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar; \
91+
cargo build --release --target aarch64-unknown-linux-gnu; \
92+
else \
93+
cargo build --release --target x86_64-unknown-linux-gnu; \
8894
fi && \
89-
make rust && \
9095
echo "Checking built library..." && \
91-
find candle-binding/target -name "*.so" -type f
96+
find target -name "*.so" -type f
9297

9398
# Build the Go application
9499
FROM --platform=linux/amd64 golang:1.24 as go-builder

0 commit comments

Comments
 (0)