-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving build time and size of cilium-agent rock #7
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,17 @@ package-repositories: | |
suites: ["llvm-toolchain-jammy-15"] | ||
components: ["main"] | ||
key-id: 6084F3CF814B57C1CF12EFD515CF4D18AF4F7421 | ||
- type: apt | ||
url: http://apt.llvm.org/focal/ | ||
suites: ["llvm-toolchain-focal-10"] | ||
components: ["main"] | ||
key-id: 6084F3CF814B57C1CF12EFD515CF4D18AF4F7421 | ||
|
||
parts: | ||
bazelisk: | ||
plugin: nil | ||
build-packages: | ||
- wget | ||
overlay-script: | | ||
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-$CRAFT_ARCH_BUILD_FOR | ||
mv bazelisk-linux-$CRAFT_ARCH_BUILD_FOR /usr/bin/bazelisk | ||
|
@@ -41,6 +48,7 @@ parts: | |
source-type: git | ||
source: https://github.com/cilium/proxy.git | ||
source-tag: v1.27 | ||
source-depth: 1 | ||
build-packages: | ||
- autoconf | ||
- automake | ||
|
@@ -81,6 +89,7 @@ parts: | |
git rev-parse HEAD >SOURCE_VERSION | ||
make bazel-bin/cilium-envoy | ||
make install | ||
rm -rf /root/.cache/bazel | ||
|
||
builder-img-deps: | ||
plugin: nil | ||
|
@@ -112,6 +121,7 @@ parts: | |
source-type: git | ||
source: https://github.com/cilium/cilium.git | ||
source-tag: v1.15.2 | ||
source-depth: 1 | ||
source-subdir: images/builder | ||
build-environment: | ||
- CGO_ENABLED: 0 | ||
|
@@ -125,6 +135,7 @@ parts: | |
source-type: git | ||
source: https://github.com/protocolbuffers/protobuf.git | ||
source-tag: v24.0 | ||
source-depth: 1 | ||
source-submodules: | ||
- third_party/googletest | ||
- third_party/abseil-cpp | ||
|
@@ -215,6 +226,7 @@ parts: | |
source-type: git | ||
source: https://github.com/kubernetes-sigs/iptables-wrappers.git | ||
source-commit: "e139a115350974aac8a82ec4b815d2845f86997e" | ||
source-depth: 1 | ||
override-build: | | ||
mv /usr/sbin /usr/sbin-tmp | ||
ln -sf $CRAFT_STAGE/usr/sbin /usr/sbin | ||
|
@@ -227,54 +239,36 @@ parts: | |
bpftool: | ||
plugin: make | ||
source-type: git | ||
source: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git | ||
source-commit: "93270357daa949e4bed375b40d0a100ce04f3399" | ||
source: https://github.com/libbpf/bpftool.git | ||
source-tag: v7.0.0 | ||
Comment on lines
+242
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We used to pull So instead we are switching to use the official This saves ~ |
||
source-depth: 1 | ||
source-subdir: "tools/bpf/bpftool" | ||
source-subdir: src | ||
source-submodules: | ||
- "libbpf" | ||
build-packages: | ||
- zlib1g-dev | ||
- libelf-dev | ||
stage-packages: | ||
- libelf1 | ||
organize: | ||
usr/local/sbin/bpftool: usr/sbin/bpftool | ||
|
||
llvm-10-bpf: | ||
plugin: cmake | ||
source-type: git | ||
source: https://github.com/llvm/llvm-project.git | ||
source-branch: "llvmorg-10.0.0" | ||
source-subdir: "llvm" | ||
cmake-generator: Ninja | ||
override-pull: | | ||
craftctl default | ||
git cherry-pick 29bc5dd19407c4d7cad1c059dea26ee216ddc7ca | ||
git cherry-pick 13f6c81c5d9a7a34a684363bcaad8eb7c65356fd | ||
git cherry-pick ea72b0319d7b0f0c2fcf41d121afa5d031b319d5 | ||
override-build: | | ||
cmake $CRAFT_PART_SRC_WORK -G "Ninja" \ | ||
-DLLVM_TARGETS_TO_BUILD="BPF" \ | ||
-DLLVM_ENABLE_PROJECTS="clang" \ | ||
-DBUILD_SHARED_LIBS="OFF" \ | ||
-DCMAKE_BUILD_TYPE="Release" \ | ||
-DLLVM_BUILD_RUNTIME="OFF" \ | ||
-DCMAKE_INSTALL_PREFIX="/usr/local" | ||
|
||
ninja clang llc llvm-objcopy | ||
|
||
cp -r $CRAFT_PART_BUILD/bin $CRAFT_PART_INSTALL | ||
stage: | ||
- -bin | ||
organize: | ||
bin/clang-10: usr/bin/clang | ||
bin/llc: usr/bin/llc | ||
bin/llvm-objcopy: usr/bin/llvm-objcopy | ||
Comment on lines
-241
to
-270
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are dropping |
||
- libiberty-dev | ||
- llvm-15 | ||
- clang-15 | ||
- clang-tools-15 | ||
- lldb-15 | ||
- lld-15 | ||
- clang-format-15 | ||
- libc++-15-dev | ||
- libc++abi-15-dev | ||
build-environment: | ||
- EXTRA_CFLAGS: --static | ||
- LLVM_CONFIG: "/usr/bin/llvm-config-15" | ||
- LLVM_STRIP: "/usr/bin/llvm-strip-15" | ||
Comment on lines
+251
to
+263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are related to |
||
|
||
gops: | ||
after: [build-deps] | ||
plugin: go | ||
source-type: git | ||
source: https://github.com/google/gops.git | ||
source-tag: v0.3.27 | ||
source-depth: 1 | ||
build-environment: | ||
- CGO_ENABLED: 0 | ||
override-build: | | ||
|
@@ -286,6 +280,7 @@ parts: | |
source-type: git | ||
source: https://github.com/containernetworking/plugins.git | ||
source-tag: v1.4.0 | ||
source-depth: 1 | ||
override-build: | | ||
./build_linux.sh | ||
cp -r $CRAFT_PART_BUILD/bin $CRAFT_PART_INSTALL | ||
|
@@ -300,17 +295,25 @@ parts: | |
source-type: git | ||
source: "https://github.com/cilium/hubble.git" | ||
source-tag: v0.13.2 | ||
source-depth: 1 | ||
override-build: | | ||
craftctl default | ||
mkdir -p $CRAFT_PART_INSTALL/etc/bash_completion.d | ||
$CRAFT_PART_INSTALL/usr/local/bin/hubble completion bash > $CRAFT_PART_INSTALL/etc/bash_completion.d/hubble | ||
|
||
cilium: | ||
after: [build-deps, builder-img-deps, llvm-10-bpf] | ||
after: [build-deps, builder-img-deps] | ||
plugin: make | ||
source-type: git | ||
source: https://github.com/cilium/cilium.git | ||
source-tag: v1.15.2 | ||
source-depth: 1 | ||
build-packages: | ||
- clang-10 | ||
- llvm-10 | ||
stage-packages: | ||
- clang-10 | ||
- llvm-10 | ||
build-environment: | ||
- DISABLE_ENVOY_INSTALLATION: 1 | ||
override-build: | | ||
|
@@ -324,3 +327,10 @@ parts: | |
cp $CRAFT_PART_SRC/images/cilium/init-container.sh $CRAFT_PART_INSTALL/ | ||
cp $CRAFT_PART_SRC/plugins/cilium-cni/install-plugin.sh $CRAFT_PART_INSTALL/ | ||
cp $CRAFT_PART_SRC/plugins/cilium-cni/cni-uninstall.sh $CRAFT_PART_INSTALL/ | ||
|
||
cp -a $CRAFT_PART_INSTALL/usr/bin/clang-10 $CRAFT_PART_INSTALL/usr/bin/clang | ||
cp -a $CRAFT_PART_INSTALL/usr/bin/llc-10 $CRAFT_PART_INSTALL/usr/bin/llc | ||
cp -a $CRAFT_PART_INSTALL/usr/bin/llvm-objcopy-10 $CRAFT_PART_INSTALL/usr/bin/llvm-objcopy | ||
Comment on lines
+331
to
+333
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just duplicating symlinks for |
||
override-prime: | | ||
craftctl default | ||
rm -rf /root/.cache/go-build | ||
Comment on lines
+334
to
+336
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again some compile caches for go which doesn't help us very much, so removing this saves ~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all around the PR so we don't fetch the entire history of a git repo, saves us some disk space and clone time.