Skip to content

Commit fc5ea17

Browse files
ci: update distro container action with smoke test
Assisted-by: coderabbitai Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
1 parent bc39404 commit fc5ea17

File tree

3 files changed

+107
-57
lines changed

3 files changed

+107
-57
lines changed

.github/workflows/redhat-distro-container-build.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Build, test, and publish Red Hat Distribution Containers
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- rhoai-v*
8+
types:
9+
- opened
10+
- synchronize
11+
push:
12+
branches:
13+
- main
14+
- rhoai-v*
15+
16+
env:
17+
REGISTRY: quay.io
18+
# TODO: change the tag to whatever downstream needs
19+
# IMAGE_NAME: quay.io/opendatahub/llama-stack:odh
20+
# For now, use the commit SHA that triggered the workflow.
21+
IMAGE_NAME: quay.io/opendatahub/llama-stack
22+
23+
jobs:
24+
build-test-push:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
platform: [linux/amd64] # TODO: enable other arch once all pip packages are available.
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
33+
34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
39+
40+
- name: Build image
41+
id: build
42+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
43+
with:
44+
context: .
45+
file: distribution/Containerfile
46+
platforms: ${{ matrix.platform }}
47+
push: false
48+
tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}
49+
load: true # needed to load for smoke test
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+
53+
- name: Test image
54+
id: test
55+
run: |
56+
# start llama stack
57+
docker run -d \
58+
--net=host \
59+
--pull=never \
60+
--env INFERENCE_MODEL=dummy \
61+
--name llama-stack \
62+
${{ env.IMAGE_NAME }}:${{ github.sha }}
63+
LLS_PID=$!
64+
echo "Started Llama Stack container with PID: $LLS_PID"
65+
66+
# Wait for llama stack to be ready by doing a health check
67+
echo "Waiting for Llama Stack server..."
68+
for i in {1..60}; do
69+
echo "Attempt $i to connect to Llama Stack..."
70+
resp=$(curl -s http://localhost:8321/v1/health)
71+
if [ "$resp" == '{"status":"OK"}' ]; then
72+
echo "Llama Stack server is up :)"
73+
exit 0
74+
fi
75+
sleep 1
76+
done
77+
echo "Llama Stack server failed to start :("
78+
echo "Container logs:"
79+
docker logs llama-stack
80+
exit 1
81+
82+
- name: Log in to Quay.io
83+
id: login
84+
if: github.event_name == 'push'
85+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
86+
with:
87+
registry: ${{ env.REGISTRY }}
88+
username: ${{ secrets.QUAY_USERNAME }}
89+
password: ${{ secrets.QUAY_PASSWORD }}
90+
91+
- name: Publish image to Quay.io
92+
id: publish
93+
if: github.event_name == 'push'
94+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
95+
with:
96+
context: .
97+
file: distribution/Containerfile
98+
platforms: ${{ matrix.platform }}
99+
push: true
100+
tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}${{ github.ref == 'refs/heads/main' && format(',{0}:latest', env.IMAGE_NAME) || '' }}
101+
cache-from: type=gha
102+
cache-to: type=gha,mode=max

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ repos:
3535
args: [ --fix ]
3636
- id: ruff-format
3737

38+
- repo: https://github.com/rhysd/actionlint
39+
rev: v1.7.7
40+
hooks:
41+
- id: actionlint
42+
3843
- repo: local
3944
hooks:
4045
- id: pkg-gen

0 commit comments

Comments
 (0)