Skip to content
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

Rust: add binary blobs #415

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/unit-test-on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,30 @@ jobs:
exit 1
fi

check-rust-blobs:
name: Check for differences in the Rust binary blobs
runs-on: ubuntu-24.04
container: otel/opentelemetry-ebpf-profiler-dev:latest
defaults:
run:
shell: bash --login {0}
steps:
- name: Clone code
uses: actions/checkout@v4
- name: Hash Rust blobs
run: |
sha256sum target/*-unknown-linux-musl/release/libsymblib_capi.a > rust-blobs.hash
- name: Rebuild Rust blobs
run: |
rm -rf target/
make rust-components TARGET_ARCH=amd64
make rust-components TARGET_ARCH=arm64
- name: Check for differences
run: |
if ! sha256sum --check rust-blobs.hash; then
echo "Please rebuild and commit the updated Rust binary blobs."
exit 1
fi
Comment on lines +109 to +122
Copy link
Member

@christos68k christos68k Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified and sped up, as we don't need the extra step to hash and verify the hashes. We can also let the user know exactly which blob(s) actually changed, instead of printing a generic message:

Suggested change
- name: Hash Rust blobs
run: |
sha256sum target/*-unknown-linux-musl/release/libsymblib_capi.a > rust-blobs.hash
- name: Rebuild Rust blobs
run: |
rm -rf target/
make rust-components TARGET_ARCH=amd64
make rust-components TARGET_ARCH=arm64
- name: Check for differences
run: |
if ! sha256sum --check rust-blobs.hash; then
echo "Please rebuild and commit the updated Rust binary blobs."
exit 1
fi
- name: Rebuild Rust blobs
run: |
rm -rf target/
make rust-components TARGET_ARCH=amd64
make rust-components TARGET_ARCH=arm64
- name: Check for differences
run: |
if ! git diff --exit-code --name-only; then
echo "Binary blob(s) changed, please rebuild and commit the updated blobs."
exit 1
fi

We should do the same for the tracers.


build-integration-test-binaries:
name: Build integration test binaries (${{ matrix.target_arch }})
Expand Down
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@
/go
ebpf-profiler
ci-kernels
/target
# Ignore target directory
target/*
# But not these specific paths
!target/x86_64-unknown-linux-musl/
target/x86_64-unknown-linux-musl/*
!target/x86_64-unknown-linux-musl/release/
target/x86_64-unknown-linux-musl/release/*
!target/x86_64-unknown-linux-musl/release/libsymblib_capi.a
!target/aarch64-unknown-linux-musl/
target/aarch64-unknown-linux-musl/*
!target/aarch64-unknown-linux-musl/release/
target/aarch64-unknown-linux-musl/release/*
!target/aarch64-unknown-linux-musl/release/libsymblib_capi.a
Comment on lines +8 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required (maybe i don't understand the exact purpose here)? Once you git add -f the *.a files, git status they are excluded from target/ (yes, /target should indeed be target/.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, these shouldn't be needed. Our current .gitignore works.

5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ FROM debian:testing-20241223-slim

WORKDIR /agent

RUN dpkg --add-architecture amd64 && dpkg --add-architecture arm64

# cross_debian_arch: amd64 or arm64
# cross_pkg_arch: x86-64 or aarch64
RUN cross_debian_arch=$(uname -m | sed -e 's/aarch64/amd64/' -e 's/x86_64/arm64/'); \
cross_pkg_arch=$(uname -m | sed -e 's/aarch64/x86-64/' -e 's/x86_64/aarch64/'); \
apt-get update -y && \
apt-get dist-upgrade -y && \
apt-get install -y curl wget make git cmake clang-17 unzip libc6-dev g++ gcc pkgconf \
gcc-${cross_pkg_arch}-linux-gnu libc6-${cross_debian_arch}-cross musl-dev && \
gcc-${cross_pkg_arch}-linux-gnu libc6-${cross_debian_arch}-cross \
musl-dev:amd64 musl-dev:arm64 && \
apt-get clean autoclean && \
apt-get autoremove --yes

Expand Down
Binary file not shown.
Binary file not shown.
Loading