Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit d2cb853

Browse files
author
phansGithub
committed
Adding libxdp to the ci-cd
Signed-off-by: phansGithub <[email protected]>
1 parent 3872797 commit d2cb853

File tree

3 files changed

+27
-55
lines changed

3 files changed

+27
-55
lines changed

.github/workflows/public-ci.yml

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,11 @@ jobs:
4040

4141
- name: Install libbpf and libxdp
4242
run: |
43-
sudo apt update
44-
sudo apt install -y wget build-essential golang
45-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf1_1.1.0-1_amd64.deb
46-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf-dev_1.1.0-1_amd64.deb
47-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp1_1.3.0-2ubuntu2_amd64.deb
48-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp-dev_1.3.0-2ubuntu2_amd64.deb
49-
sudo apt install -y ./libbpf1_1.1.0-1_amd64.deb
50-
sudo apt install -y ./libbpf-dev_1.1.0-1_amd64.deb
51-
sudo apt install -y ./libxdp1_1.3.0-2ubuntu2_amd64.deb
52-
sudo apt install -y ./libxdp-dev_1.3.0-2ubuntu2_amd64.deb
43+
make install-xdp
5344
sudo apt install -y clang
5445
sudo apt install -y llvm
5546
sudo apt install -y gcc-multilib
56-
57-
58-
47+
5948
- name: Run build
6049
run: make build
6150

@@ -70,17 +59,7 @@ jobs:
7059
go-version: 1.19
7160

7261
- name: Install libbpf and libxdp
73-
run: |
74-
sudo apt update
75-
sudo apt install -y wget build-essential golang
76-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf1_1.1.0-1_amd64.deb
77-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf-dev_1.1.0-1_amd64.deb
78-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp1_1.3.0-2ubuntu2_amd64.deb
79-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp-dev_1.3.0-2ubuntu2_amd64.deb
80-
sudo apt install -y ./libbpf1_1.1.0-1_amd64.deb
81-
sudo apt install -y ./libbpf-dev_1.1.0-1_amd64.deb
82-
sudo apt install -y ./libxdp1_1.3.0-2ubuntu2_amd64.deb
83-
sudo apt install -y ./libxdp-dev_1.3.0-2ubuntu2_amd64.deb
62+
run: make install-xdp
8463

8564
- name: Install staticcheck
8665
run: go install honnef.co/go/tools/cmd/staticcheck@latest
@@ -99,20 +78,7 @@ jobs:
9978
go-version: 1.19
10079

10180
- name: Install libbpf and libxdp
102-
run: |
103-
sudo apt update
104-
sudo apt install -y wget build-essential golang
105-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf1_1.1.0-1_amd64.deb
106-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf-dev_1.1.0-1_amd64.deb
107-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp1_1.3.0-2ubuntu2_amd64.deb
108-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp-dev_1.3.0-2ubuntu2_amd64.deb
109-
sudo apt install -y ./libbpf1_1.1.0-1_amd64.deb
110-
sudo apt install -y ./libbpf-dev_1.1.0-1_amd64.deb
111-
sudo apt install -y ./libxdp1_1.3.0-2ubuntu2_amd64.deb
112-
sudo apt install -y ./libxdp-dev_1.3.0-2ubuntu2_amd64.deb
113-
sudo apt install -y clang
114-
sudo apt install -y llvm
115-
sudo apt install -y gcc-multilib
81+
run: make install-xdp
11682

11783
- name: unit-tests
11884
run: make test

Makefile

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ podman: ## Build podman image
8585
@echo
8686

8787
image:
88-
# if $(MAKE) podman; then \
89-
# echo "Podman build succeeded"; \
90-
# else \
91-
# echo "Podman build failed, trying docker.."; \
88+
if $(MAKE) podman; then \
89+
echo "Podman build succeeded"; \
90+
else \
91+
echo "Podman build failed, trying docker.."; \
9292
$(MAKE) docker; \
93-
# fi
93+
fi
9494

9595
undeploy: ## Undeploy the Deamonset
9696
@echo "****** Stop Daemonset ******"
@@ -138,19 +138,24 @@ install-xdp:
138138
@echo "****** Install libxdp ******"
139139
@echo
140140
sudo apt update && \
141-
sudo apt install -y wget build-essential golang && \
142-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf1_1.1.0-1_amd64.deb && \
143-
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf-dev_1.1.0-1_amd64.deb && \
144-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp1_1.3.0-2ubuntu2_amd64.deb &&\
145-
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp-dev_1.3.0-2ubuntu2_amd64.deb && \
146-
sudo apt install -y ./libbpf1_1.1.0-1_amd64.deb && \
147-
sudo apt install -y ./libbpf-dev_1.1.0-1_amd64.deb && \
148-
sudo apt install -y ./libxdp1_1.3.0-2ubuntu2_amd64.deb && \
149-
sudo apt install -y ./libxdp-dev_1.3.0-2ubuntu2_amd64.deb
141+
sudo apt install -y wget build-essential golang;
142+
@if ! apt list | grep libbpf1; then \
143+
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf1_1.1.0-1_amd64.deb && \
144+
sudo wget http://security.ubuntu.com/ubuntu/pool/main/libb/libbpf/libbpf-dev_1.1.0-1_amd64.deb &&\
145+
sudo apt install -y ./libbpf1_1.1.0-1_amd64.deb && \
146+
sudo apt install -y ./libbpf-dev_1.1.0-1_amd64.deb &&\
147+
rm ./libbpf1_1.1.0-1_amd64.deb && \
148+
rm ./libbpf-dev_1.1.0-1_amd64.deb; \
149+
else \
150+
echo "Libbpf already found, installing libxdp..."; \
151+
fi
152+
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp1_1.3.0-2ubuntu2_amd64.deb &&\
153+
sudo wget https://mirrors.edge.kernel.org/ubuntu/pool/main/x/xdp-tools/libxdp-dev_1.3.0-2ubuntu2_amd64.deb &&\
154+
sudo apt install -y ./libxdp1_1.3.0-2ubuntu2_amd64.deb && \
155+
sudo apt install -y ./libxdp-dev_1.3.0-2ubuntu2_amd64.deb;
150156
@echo
151157
@echo "****** Cleanup ******"
152-
rm ./libbpf1_1.1.0-1_amd64.deb && \
153-
rm ./libbpf-dev_1.1.0-1_amd64.deb && \
158+
154159
rm ./libxdp1_1.3.0-2ubuntu2_amd64.deb && \
155160
rm ./libxdp-dev_1.3.0-2ubuntu2_amd64.deb
156161
@echo

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ The following prerequisites are required to build and deploy the plugins from so
9898
- Compiling the bpf progs for Kind.
9999
- Install on Ubuntu: `apt install llvm`
100100
- **libxdp**
101-
- Same as Libbpf, to load and uload the XDP program onto the network device.
101+
- Same as Libbpf, to load and unload the XDP program onto the network device.
102102
- Installation: `make install-xdp`
103+
- If libbpf is not installed the above command will check for libbpf and install it first.
103104

104105
### Static analysis, linting and formatting
105106

0 commit comments

Comments
 (0)