Skip to content

Commit 0495d22

Browse files
ShohamBitgeyslan
andauthored
Update Contributing docs (aquasecurity#4424)
* add first changes to guidelines * improve docs of guidelines and overview in contributing * combine documentation and code guidelines * improve docs for setup development machine * improve building tracee docs * improve environment building docs * change console to bash * add Kubernetes, Performance and Man docs to tracee * add checkers docsto guidelines * fix minor issues * resolve most changes * improve metrics=1 docs * improve guidelines to use makefiles mostly * update make help * add help text * enhance Issues docs part, added candidate labe docs * Update docs/contributing/overview.md Co-authored-by: Gregório G. <[email protected]> * enhance backported and cherry-picked labels docs * add candidate label docs * added backport and cherry-pick labels * fix nit issues un the docs - remove "." in building.md - change "DWARF generation by setting" to "DWARF debug symbols by setting" - combine docs about `alphine` and `ubuntu` - make sense of enviornmet help arg - fix grammer issues - enhance vargant docs - added default comment for the dev vagrant vm - remove 12 and 13 version for clang llvm - fix dockerfile links * fix dockerfile path and name * fix nit issues remove tracee-gptdocs remove Alpine linux require to build statisc binary remove which includes that refare to nothing --------- Co-authored-by: Gregório G. <[email protected]>
1 parent c97369d commit 0495d22

File tree

10 files changed

+410
-581
lines changed

10 files changed

+410
-581
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ help:
320320
@echo " $$ STATIC=1 make ... # build static binaries"
321321
@echo " $$ BTFHUB=1 STATIC=1 make ... # build static binaries, embed BTF"
322322
@echo " $$ DEBUG=1 make ... # build binaries with debug symbols"
323+
@echo " $$ METRICS=1 make ... # build enabling BPF metrics"
323324
@echo ""
324325

325326
#

docs/contributing/building/building.md

Lines changed: 27 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,33 @@
1212

1313
2. Building **dependencies**
1414

15-
1. **clang** && **llvm** (12, 13 or 14)
16-
1. **golang** (1.22.3 toolchain)
17-
1. **libelf** and **libelf-dev**
15+
1. `clang` && `llvm` (14)
16+
2. `golang` (1.22.3 toolchain)
17+
3. `libelf` and `libelf-dev`
1818
(or elfutils-libelf and elfutils-libelf-devel)
19-
1. **zlib1g** and **zlib1g-dev**
19+
4. `zlib1g` and `zlib1g-dev`
2020
(or zlib and zlib-devel)
21-
1. **libzstd-dev** for static build (libelf linkage)
22-
1. **clang-format-12** (specific version) for `fix-fmt`
21+
5. `libzstd-dev` for static build (libelf linkage)
22+
6. `clang-format-12` (specific version) for `fix-fmt`
2323

2424
> You might take a look at the following files to understand how to have a
2525
> building environment:
2626
>
2727
> 1. [.github/actions/build-dependencies/action.yaml](https://github.com/aquasecurity/tracee/blob/main/.github/actions/build-dependencies/action.yaml)
28-
> 1. [packaging/Dockerfile.ubuntu-packaging](https://github.com/aquasecurity/tracee/blob/main/packaging/Dockerfile.ubuntu-packaging)
29-
> 1. [packaging/Dockerfile.fedora-packaging](https://github.com/aquasecurity/tracee/blob/main/packaging/Dockerfile.fedora-packaging)
28+
> 1. [builder/Dockerfile.ubuntu-tracee-make](https://github.com/aquasecurity/tracee/blob/main/builder/Dockerfile.ubuntu-tracee-make)
29+
> 1. [builder/Dockerfile.alpine-tracee-make](https://github.com/aquasecurity/tracee/blob/main/builder/Dockerfile.alpine-tracee-make)
3030
>
3131
> Those are very good examples for you to replicate a working environment.
3232
3333
3. **Clone** [tracee repository](https://github.com/aquasecurity/tracee/)
3434

35-
```console
36-
git clone [email protected]:aquasecurity/tracee
37-
```
38-
39-
```text
40-
Cloning into 'tracee'...
41-
remote: Enumerating objects: 13251, done.
42-
remote: Counting objects: 100% (555/555), done.
43-
remote: Compressing objects: 100% (240/240), done.
44-
remote: Total 13251 (delta 343), reused 369 (delta 280), pack-reused 12696
45-
Receiving objects: 100% (13251/13251), 11.75 MiB | 8.62 MiB/s, done.
46-
Resolving deltas: 100% (8105/8105), done.
35+
```bash
36+
git clone [https://github.com/aquasecurity/tracee/](https://github.com/aquasecurity/tracee/)
4737
```
4838

4939
4. All makefiles have a **help** target to give you needed instructions
5040

51-
```console
41+
```bash
5242
make help
5343
```
5444

@@ -68,6 +58,7 @@
6858
$ make e2e-net-signatures # build ./dist/e2e-net-signatures
6959
$ make e2e-inst-signatures # build ./dist/e2e-inst-signatures
7060
$ make tracee # build ./dist/tracee
61+
$ make tracee-operator # build ./dist/tracee-operator
7162
7263
# clean
7364
@@ -78,6 +69,7 @@
7869
$ make clean-tracee-bench # wipe ./dist/tracee-bench
7970
$ make clean-signatures # wipe ./dist/signatures
8071
$ make clean-tracee # wipe ./dist/tracee
72+
$ make clean-tracee-operator # wipe ./dist/tracee-operator
8173
8274
# test
8375
@@ -90,65 +82,28 @@
9082
$ STATIC=1 make ... # build static binaries
9183
$ BTFHUB=1 STATIC=1 make ... # build static binaries, embed BTF
9284
$ DEBUG=1 make ... # build binaries with debug symbols
85+
$ METRICS=1 make ... # build enabling BPF metrics
86+
9387
```
9488

9589
5. Build **all** targets at once
9690

97-
```console
91+
```bash
9892
make all
9993
```
10094

101-
```text
102-
Submodule 'libbpf' (https://github.com/libbpf/libbpf.git) registered for path '3rdparty/libbpf'
103-
Cloning into '/home/rafaeldtinoco/tracee/3rdparty/libbpf'...
104-
mkdir -p dist/signatures
105-
GOOS=linux CC=clang GOARCH=amd64 CGO_CFLAGS= CGO_LDFLAGS= go build \
106-
--buildmode=plugin \
107-
-o dist/signatures/builtin.so \
108-
signatures/golang/export.go signatures/golang/kubernetes_api_connection.go signatures/golang/stdio_over_socket.go
109-
```
110-
11195
6. Build a **static binary** by setting `STATIC=1`
11296

113-
```console
97+
```bash
11498
STATIC=1 make all
11599
```
116100

117-
```text
118-
CC="clang" \
119-
CFLAGS=""-fPIC"" \
120-
LD_FLAGS="" \
121-
make \
122-
-C ./3rdparty/libbpf/src \
123-
BUILD_STATIC_ONLY=1 \
124-
DESTDIR=/home/rafaeldtinoco/tracee/dist/libbpf \
125-
OBJDIR=/home/rafaeldtinoco/tracee/dist/libbpf/obj \
126-
INCLUDEDIR= LIBDIR= UAPIDIR= prefix= libdir= \
127-
install install_uapi_headers
128-
...
129-
```
130-
131101
7. Build a **static binary** with [BTFHUB Support](https://github.com/aquasecurity/btfhub)
132102

133-
```console
103+
```bash
134104
BTFHUB=1 STATIC=1 make all
135105
```
136106

137-
```text
138-
Cloning into '/home/rafaeldtinoco/tracee/3rdparty/btfhub'...
139-
remote: Enumerating objects: 205, done.
140-
remote: Counting objects: 100% (16/16), done.
141-
remote: Compressing objects: 100% (12/12), done.
142-
remote: Total 205 (delta 4), reused 10 (delta 3), pack-reused 189
143-
Receiving objects: 100% (205/205), 10.59 MiB | 7.56 MiB/s, done.
144-
Resolving deltas: 100% (73/73), done.
145-
Cloning into '/home/rafaeldtinoco/tracee/3rdparty/btfhub-archive'...
146-
remote: Enumerating objects: 1993, done.
147-
remote: Counting objects: 100% (28/28), done.
148-
remote: Compressing objects: 100% (23/23), done.
149-
Receiving objects: 15% (301/1993), 154.97 MiB | 15.72 MiB/s
150-
```
151-
152107
!!! Note
153108
BTFHUB support will embed several very small files (BTF files) into your
154109
final binary. Those files will allow **tracee** binary to be executed
@@ -163,19 +118,16 @@
163118
>plugin.Open("/tracee/dist/signatures/builtin.so"): Dynamic loading not supported
164119
>```
165120

166-
8. Build a **debugable binary** with DWARF generation by setting `DEBUG=1`
121+
8. Build a **debuggable binary** with DWARF debug symbols by setting `DEBUG=1`
167122

168-
```console
123+
```bash
169124
DEBUG=1 make
170125
```
171-
172-
```text
173-
GOOS=linux CC=clang GOARCH=amd64 CGO_CFLAGS="-I/home/gg/code/tracee/dist/libbpf" CGO_LDFLAGS="-lelf -lz /home/gg/code/tracee/dist/libbpf/libbpf.a" go build \
174-
-tags core,ebpf \
175-
-ldflags=" \
176-
-extldflags \"\" \
177-
-X main.version=\"v0.8.0-107-g121efeb\" \
178-
" \
179-
-v -o dist/tracee \
180-
./cmd/tracee
126+
127+
9. Build enabling BPF metrics by setting `METRICS=1`
128+
129+
BPF metrics are only available if the BPF object is built with `METRICS` debug flag defined.
130+
131+
```bash
132+
METRICS=1 make
181133
```

0 commit comments

Comments
 (0)