Skip to content

Commit 1035c56

Browse files
committed
ci: add validation for compose setup
This commit updates the PR check workflow to now also run the compose setup and validate if all the services come up and are healthy. Signed-off-by: vprashar2929 <[email protected]>
1 parent 67f5a3f commit 1035c56

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/compose/action.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build and Deploy using Docker Compose
2+
description: Builds and deploys Kepler using Docker Compose
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install Docker
8+
shell: bash
9+
run: |
10+
sudo apt-get update
11+
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
12+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
13+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
14+
sudo apt-get update
15+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
16+
sudo usermod -aG docker $USER
17+
18+
- name: Verify Docker installation
19+
shell: bash
20+
run: |
21+
docker ps
22+
docker --version
23+
24+
- name: Checkout source
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Enable fake cpu meter
30+
shell: bash
31+
run: |
32+
sed -i '/fake-cpu-meter:/{n;s/enabled: false/enabled: true/}' \
33+
compose/dev/kepler-dev/etc/kepler/config.yaml \
34+
compose/dev/kepler-latest/etc/kepler/config.yaml
35+
36+
- name: Run Docker Compose services
37+
shell: bash
38+
working-directory: compose/dev
39+
run: |
40+
# Build and start containers for services defined in compose.yaml in detach mode
41+
# NOTE: Disabling scapahndre service as it requires RAPL to be available on host
42+
docker compose up --build -d --wait --wait-timeout 300 --scale scaphandre=0
43+
44+
- name: Run must gather
45+
if: always()
46+
shell: bash
47+
working-directory: compose/dev
48+
run: |
49+
echo "::group::Get Docker ps output"
50+
docker ps || true
51+
echo "::endgroup::"
52+
53+
echo "::group::Get Docker compose ps output"
54+
docker compose ps || true
55+
echo "::endgroup::"
56+
57+
services=$(docker compose config --services)
58+
for service in $services; do
59+
echo "::group::Get logs for $service service"
60+
docker compose logs $service || true
61+
echo "::endgroup::"
62+
done
63+
64+
echo "::group::Fetch metrics from kepler-dev service"
65+
curl -s http://localhost:28283/metrics || true
66+
echo "::endgroup::"
67+
68+
echo "::group::Fetch metrics from kepler-latest service"
69+
curl -s http://localhost:28284/metrics || true
70+
echo "::endgroup::"

.github/workflows/pr-checks.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,12 @@ jobs:
158158

159159
- name: Build and Deploy Kepler on K8s
160160
uses: ./.github/k8s
161+
162+
compose-deploy:
163+
runs-on: ubuntu-latest
164+
steps:
165+
- name: Checkout source
166+
uses: actions/checkout@v4
167+
168+
- name: Build and Deploy Kepler using Docker Compose
169+
uses: ./.github/compose

0 commit comments

Comments
 (0)