Skip to content

Commit 6e9bb2f

Browse files
committed
ci: run profiling workflow on self-hosted runner
This commit runs the profiling workflow on self-hosted runner instead of running it on the GitHub-hosted runner(VM) Signed-off-by: vprashar2929 <[email protected]>
1 parent a78590c commit 6e9bb2f

File tree

4 files changed

+23
-31
lines changed

4 files changed

+23
-31
lines changed

.github/workflows/k8s-bm.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Build and Deploy K8s on Self Hosted BM
22

3-
on: #yamllint disable-line rule:truthy
3+
on: # yamllint disable-line rule:truthy
44
pull_request:
55

66
permissions:
@@ -30,12 +30,12 @@ jobs:
3030
- '.github/workflows/k8s-bm.yaml'
3131
3232
build-and-deploy:
33-
# NOTE: In case of self-hosted runners, tools like docker, make, kubectl etc. are installed at the time of setting up the runner.
34-
# Hence, we don't need to install them as part of the job.
3533
needs: [check-changes]
3634
if: needs.check-changes.outputs.changes == 'true'
3735
runs-on: self-hosted
3836
steps:
37+
# NOTE: In case of self-hosted runners, tools like docker, make, kubectl etc. are installed at the time of setting up the runner.
38+
# Hence, we don't need to install them as part of the job.
3939
- name: Checkout source
4040
uses: actions/checkout@v5
4141
with:

.github/workflows/profiling.yaml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Profiling Report
2-
on:
2+
on: # yamllint disable-line rule:truthy
33
pull_request:
44

55
jobs:
@@ -26,25 +26,10 @@ jobs:
2626
profiling:
2727
needs: check-changes
2828
if: needs.check-changes.outputs.changes == 'true'
29-
runs-on: ubuntu-latest
29+
runs-on: self-hosted
3030
steps:
31-
- name: Install Docker
32-
shell: bash
33-
run: |
34-
sudo apt-get update
35-
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
36-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
37-
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
38-
sudo apt-get update
39-
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
40-
sudo usermod -aG docker $USER
41-
42-
- name: Verify Docker installation
43-
shell: bash
44-
run: |
45-
docker ps
46-
docker --version
47-
31+
# NOTE: In case of self-hosted runners, tools like docker, make, kubectl etc. are installed at the time of setting up the runner.
32+
# Hence, we don't need to install them as part of the job.
4833
- name: Checkout source
4934
uses: actions/checkout@v4
5035
with:
@@ -59,13 +44,6 @@ jobs:
5944
- name: Install pprof
6045
run: go install github.com/google/pprof@latest
6146

62-
- name: Enable fake cpu meter
63-
shell: bash
64-
run: |
65-
sed -i '/fake-cpu-meter:/{n;s/enabled: false/enabled: true/}' \
66-
compose/dev/kepler-dev/etc/kepler/config.yaml \
67-
compose/dev/kepler-latest/etc/kepler/config.yaml
68-
6947
- name: Run Docker Compose services
7048
shell: bash
7149
working-directory: compose/dev
@@ -122,6 +100,22 @@ jobs:
122100
path: ./tmp/*
123101
retention-days: 5 # Keep artifact for 5 days
124102

103+
# NOTE: Ensure that all deployments, built images and cluster are properly cleaned up
104+
# to prevent residual resources
105+
- name: Shutdown Docker Compose services
106+
if: always()
107+
shell: bash
108+
working-directory: compose/dev
109+
run: |
110+
# Stop kepler-dev and kepler-latest services
111+
docker compose down kepler-dev kepler-latest --volumes
112+
113+
- name: Cleanup Docker images
114+
if: always()
115+
shell: bash
116+
run: |
117+
docker image prune -af
118+
125119
generate-comment-message:
126120
needs: profiling
127121
if: needs.profiling.result == 'success'
-8.12 KB
Loading

docs/developer/assets/profiling.uml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ end
2525
== Job: profiling ==
2626
note right of Runner: Needs check-changes;\nRuns if changes == 'true'
2727
group Environment Setup
28-
Runner -> Runner: Install and Verify Docker
2928
Runner -> Runner: Checkout source code
3029
Runner -> Runner: Setup Go environment
3130
Runner -> Runner: Install pprof
3231
end
3332
group Profiling Execution
34-
Runner -> Runner: Enable fake CPU meter in configs
3533
Runner -> Runner: Run Docker Compose services\n(build and start kepler-dev/latest in detach mode)
3634
Runner -> Runner: Run must-gather (always)\n(collect logs, metrics, etc.)
3735
Runner -> Runner: Sleep for 10 seconds

0 commit comments

Comments
 (0)