Skip to content

Commit

Permalink
workflow: build eBPF optimizer in container
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Tang <[email protected]>
  • Loading branch information
sctb512 committed Aug 24, 2023
1 parent 4d2ba87 commit f790285
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 37 deletions.
31 changes: 8 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
jobs:
build:
name: Build and Lint
timeout-minutes: 10
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Set up Go
Expand All @@ -33,17 +33,13 @@ jobs:
go install github.com/golangci/golangci-lint/cmd/[email protected]
export PATH=$PATH:$(go env GOPATH)/bin
make
make test
make check
make container-test
make container-check
build-optimizer:
name: Build optimizer
timeout-minutes: 10
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20.1"
- name: Check out code
uses: actions/checkout@v3
- name: cache go mod
Expand All @@ -55,19 +51,12 @@ jobs:
${{ runner.os }}-go
- name: Build
run: |
go install github.com/golangci/golangci-lint/cmd/[email protected]
export PATH=$PATH:$(go env GOPATH)/bin
rustup component add rustfmt clippy
make build-optimizer
make container-build-optimizer
smoke:
name: Smoke
timeout-minutes: 10
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
- name: Check out code
uses: actions/checkout@v3
- name: cache go mod
Expand Down Expand Up @@ -118,14 +107,10 @@ jobs:
coverage:
name: Code coverage
timeout-minutes: 10
timeout-minutes: 20
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
- name: Checkout code
uses: actions/checkout@v3
- name: cache go mod
Expand All @@ -136,7 +121,7 @@ jobs:
restore-keys: |
${{ runner.os }}-go
- name: Run unit tests.
run: make cover
run: make container-cover
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/optimizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ jobs:
run_optimizer:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.19.6"
- name: Checkout repository
uses: actions/checkout@v3
- name: cache go mod
Expand Down Expand Up @@ -56,6 +52,9 @@ jobs:
sudo tar -zxf ./containerd-static-1.7.0-linux-amd64.tar.gz -C /usr/
sudo install -D -m 755 misc/optimizer/containerd-config.toml /etc/containerd/config.toml
sudo systemctl restart containerd
systemctl status containerd --no-pager -l
sudo systemctl restart docker
systemctl status docker --no-pager -l
sudo wget https://github.com/opencontainers/runc/releases/download/v1.1.5/runc.amd64 -O /usr/bin/runc
sudo chmod +x /usr/bin/runc
- name: Setup CNI
Expand All @@ -66,15 +65,18 @@ jobs:
sudo install -D -m 755 misc/example/10-containerd-net.conflist /etc/cni/net.d/10-containerd-net.conflist
- name: Build and install optimizer
run: |
rustup component add rustfmt clippy
make optimizer
sudo chown -R $(id -un):$(id -gn) . ~/.cargo/
make container-optimizer
pwd
ldd bin/*optimizer*
ls -lh bin/*optimizer*
./bin/optimizer-nri-plugin
echo "ok"
sudo make install-optimizer
sudo install -D -m 755 misc/example/optimizer-nri-plugin.conf /etc/nri/conf.d/02-optimizer-nri-plugin.conf
sudo systemctl restart containerd
systemctl status containerd --no-pager -l
sudo systemctl restart docker
systemctl status docker --no-pager -l
- name: Generate accessed files list
run: |
sed -i "s|host_path: script|host_path: $(pwd)/misc/optimizer/script|g" misc/optimizer/nginx.yaml
Expand All @@ -87,7 +89,7 @@ jobs:
echo "count: $count expected minimum value: $expected"
if [ $count -lt $expected ]; then
echo "failed to generate accessed files list for nginx:1.23.3"
cat misc/optimizer/script/file_list.txt
cat /opt/nri/optimizer/results/library/nginx:1.23.3
exit 1
fi
cat /opt/nri/optimizer/results/library/nginx:1.23.3.csv
Expand All @@ -97,4 +99,6 @@ jobs:
run: |
systemctl status containerd --no-pager -l
journalctl -xeu containerd --no-pager
journalctl -xeu docker --no-pager
journalctl -t "optimizer-nri-plugin" -f
7 changes: 1 addition & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.19.6"
- name: cache go mod
uses: actions/cache@v3
with:
Expand All @@ -39,9 +36,7 @@ jobs:
${{ runner.os }}-cargo
- name: build nydus-snapshotter and optimizer
run: |
go install github.com/golangci/golangci-lint/cmd/[email protected]
export PATH=$PATH:$(go env GOPATH)/bin
make static-release
make container-static-release
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit f790285

Please sign in to comment.