Skip to content

Commit

Permalink
add linux Header and libbpf prequest
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Yuan <[email protected]>
  • Loading branch information
SamYuan1990 committed Apr 3, 2024
1 parent b1506af commit 4c53768
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
export GRAFANA_ENABLE=${{matrix.GRAFANA_ENABLE}}
export CLUSTER_PROVIDER=${{matrix.cluster_provider}}
export TEKTON_ENABLE=${{matrix.TEKTON_ENABLE}}
./main.sh prerequisites
./main.sh up
- name: verify
run: |
Expand Down
24 changes: 24 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ declare -r REGISTRY_PORT=${REGISTRY_PORT:-5001}
declare -r PROMETHEUS_ENABLE=${PROMETHEUS_ENABLE:-false}
declare -r GRAFANA_ENABLE=${GRAFANA_ENABLE:-false}
declare -r TEKTON_ENABLE=${TEKTON_ENABLE:-false}
declare -r LIBBPF_VERSION=${LIBBPF_VERSION:-v1.2.0}

source "$PROJECT_ROOT/lib/utils.sh"

Expand Down Expand Up @@ -122,6 +123,24 @@ print_config() {
EOF
}

linuxHeader() {
sudo apt-get install -y linux-headers-"$(uname -r)"
sudo apt-get install -y linux-modules-"$(uname -r)"
sudo apt-get install -y linux-modules-extra-"$(uname -r)"
}

ebpf() {
sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
mkdir -p temp-libbpf
cd temp-libbpf
git clone -b "$LIBBPF_VERSION" https://github.com/libbpf/libbpf
cd libbpf/src
sudo BUILD_STATIC_ONLY=y make install
sudo make install_uapi_headers
cd ../../..
sudo rm -rf temp-libbpf
}

main() {
# ensure that all relative file refs are relative to the project root
cd "$PROJECT_ROOT"
Expand All @@ -143,6 +162,11 @@ main() {
print_config

case "$1" in
prerequisites)
linuxHeader
ebpf
return $?
;;
up)
cluster_up
return $?
Expand Down

0 comments on commit 4c53768

Please sign in to comment.