Skip to content
Merged
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
7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,14 @@ jobs:
TARGET: ${{ matrix.arch }}-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
with:
# package_deb.sh versions the package from the release tag.
fetch-depth: 0
- run: >
sudo apt-get update &&
sudo apt-get install -y clang-15 libelf-dev m4 pkg-config zlib1g-dev
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo install --locked cargo-deb
- run: cargo install --locked cargo-deb@3.8.0
- run: cargo build --release --locked --package below --target "$TARGET"
# Skip tests that require host to have cgroup2
- run: >
Expand All @@ -64,7 +61,7 @@ jobs:
id: package
run: |
scripts/package_deb.sh "$TARGET"
package=$(ls target/$TARGET/debian/below_*.deb)
package=$(ls "target/$TARGET"/debian/below_*.deb)
test "$(dpkg-deb --field "$package" Architecture)" = "${{ matrix.debarch }}"
echo "path=$package" >> "$GITHUB_OUTPUT"
- run: scripts/test_deb.sh "${{ steps.package.outputs.path }}" ubuntu:22.04
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: release

on:
push:
tags: ["v*"]
tags: ["v[0-9]+.[0-9]+.[0-9]+"]

permissions:
contents: read
Expand All @@ -12,7 +12,15 @@ concurrency:
cancel-in-progress: false

jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check the tag matches the Cargo.toml version
run: grep -qx "version = \"${GITHUB_REF_NAME#v}\"" below/Cargo.toml

build:
needs: version
uses: ./.github/workflows/build.yml
with:
upload: true
Expand Down
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions below/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "below"
version = "0.11.0"
version = "0.12.0"
authors = ["Meta Platforms, Inc. and affiliates"]
edition = "2024"
description = "An interactive tool to view and record historical system data"
Expand All @@ -22,21 +22,21 @@ unit-scripts = "../etc"

[dependencies]
anyhow = "1.0.104"
below-vmlinux = { version = "0.11.0", path = "vmlinux" }
cgroupfs = { version = "0.11.0", path = "cgroupfs" }
below-vmlinux = { version = "0.12.0", path = "vmlinux" }
cgroupfs = { version = "0.12.0", path = "cgroupfs" }
clap = { version = "4.6.2", features = ["derive", "env", "string", "unicode", "wrap_help"] }
clap_complete = { version = "4.6.11", features = ["unstable-dynamic"] }
common = { package = "below-common", version = "0.11.0", path = "common" }
config = { package = "below-config", version = "0.11.0", path = "config" }
common = { package = "below-common", version = "0.12.0", path = "common" }
config = { package = "below-config", version = "0.12.0", path = "config" }
cursive = { version = "0.21.1", features = ["crossterm-backend"], default-features = false }
dump = { package = "below-dump", version = "0.11.0", path = "dump" }
dump = { package = "below-dump", version = "0.12.0", path = "dump" }
indicatif = { version = "0.18.6", features = ["futures", "improved_unicode", "rayon", "tokio"] }
libbpf-rs = { version = "0.27.2", default-features = false }
libc = "0.2.186"
model = { package = "below-model", version = "0.11.0", path = "model" }
model = { package = "below-model", version = "0.12.0", path = "model" }
nix = { version = "0.31.3", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] }
plain = "0.2"
procfs = { package = "fb_procfs", version = "0.11.0", path = "procfs" }
procfs = { package = "fb_procfs", version = "0.12.0", path = "procfs" }
regex = "1.13.1"
scopeguard = "1.2.0"
sd-notify = "0.4.5"
Expand All @@ -45,18 +45,18 @@ serde_json = { version = "1.0.154", features = ["alloc", "float_roundtrip", "raw
signal-hook = "0.3.18"
slog = { version = "2.8.2", features = ["max_level_trace", "nested-values"] }
slog-term = "2.9.2"
store = { package = "below-store", version = "0.11.0", path = "store" }
store = { package = "below-store", version = "0.12.0", path = "store" }
tar = "0.4.46"
tempfile = "3.27.0"
tokio = { version = "1.53.2", features = ["full", "test-util", "tracing"] }
view = { package = "below-view", version = "0.11.0", path = "view" }
view = { package = "below-view", version = "0.12.0", path = "view" }

[dev-dependencies]
maplit = "1.0"
portpicker = "0.1.1"

[build-dependencies]
below-vmlinux = { version = "0.11.0", path = "vmlinux" }
below-vmlinux = { version = "0.12.0", path = "vmlinux" }
libbpf-cargo = { version = "0.27.2", default-features = false }

[features]
Expand Down
2 changes: 1 addition & 1 deletion below/below_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "below_derive"
version = "0.11.0"
version = "0.12.0"
authors = ["Meta Platforms, Inc. and affiliates"]
edition = "2024"
description = "Proc macros for below"
Expand Down
4 changes: 2 additions & 2 deletions below/btrfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "below-btrfs"
version = "0.11.0"
version = "0.12.0"
authors = ["Meta Platforms, Inc. and affiliates"]
edition = "2024"
description = "A crate for reading btrfs"
Expand All @@ -11,7 +11,7 @@ repository = "https://github.com/facebookincubator/below"
license = "Apache-2.0"

[dependencies]
common = { package = "below-common", version = "0.11.0", path = "../common" }
common = { package = "below-common", version = "0.12.0", path = "../common" }
libc = "0.2.186"
nix = { version = "0.31.3", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] }
openat = "0.1.21"
Expand Down
29 changes: 29 additions & 0 deletions below/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
use std::env;
use std::ffi::OsString;
use std::path::PathBuf;
use std::process::Command;

use libbpf_cargo::SkeletonBuilder;

const SRC: &str = "./src/bpf/exitstat.bpf.c";

fn main() {
set_git_revision_hash();

let mut out =
PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR must be set in build script"));
out.push("exitstat.skel.rs");
Expand All @@ -45,3 +48,29 @@ fn main() {
"In order to build without vendored dependencies please disable default features"
);
}

/// Make the commit available to the build as `BELOW_BUILD_GIT_HASH`, unless
/// HEAD is the `v<version>` release tag.
fn set_git_revision_hash() {
let Some(rev) = git(&["rev-parse", "--short=10", "HEAD"]) else {
return;
};
let branch = git(&["symbolic-ref", "-q", "HEAD"]);
for git_ref in std::iter::once("HEAD").chain(branch.as_deref()) {
if let Some(path) = git(&["rev-parse", "--git-path", git_ref]) {
println!("cargo:rerun-if-changed={path}");
}
}
let tag = format!("v{}", env::var("CARGO_PKG_VERSION").unwrap());
let tags = git(&["tag", "--points-at", "HEAD"]).unwrap_or_default();
if !tags.lines().any(|t| t == tag) {
println!("cargo:rustc-env=BELOW_BUILD_GIT_HASH={rev}");
}
}

fn git(args: &[&str]) -> Option<String> {
let output = Command::new("git").args(args).output().ok()?;
let stdout = String::from_utf8(output.stdout).ok()?;
let stdout = stdout.trim();
(output.status.success() && !stdout.is_empty()).then(|| stdout.to_string())
}
8 changes: 4 additions & 4 deletions below/cgroupfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "cgroupfs"
version = "0.11.0"
version = "0.12.0"
authors = ["Meta Platforms, Inc. and affiliates"]
edition = "2024"
description = "A crate for reading cgroupv2 data"
Expand All @@ -12,8 +12,8 @@ license = "Apache-2.0"

[dependencies]
anyhow = "1.0.104"
below-vmlinux = { version = "0.11.0", path = "../vmlinux" }
common = { package = "below-common", version = "0.11.0", path = "../common" }
below-vmlinux = { version = "0.12.0", path = "../vmlinux" }
common = { package = "below-common", version = "0.12.0", path = "../common" }
libbpf-rs = { version = "0.27.2", default-features = false }
libc = "0.2.186"
nix = { version = "0.31.3", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] }
Expand All @@ -27,7 +27,7 @@ paste = "1.0.14"
tempfile = "3.27.0"

[build-dependencies]
below-vmlinux = { version = "0.11.0", path = "../vmlinux" }
below-vmlinux = { version = "0.12.0", path = "../vmlinux" }
bindgen = { version = "0.72.1", features = ["logging", "prettyplease", "runtime"], default-features = false }
libbpf-cargo = { version = "0.27.2", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion below/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "below-common"
version = "0.11.0"
version = "0.12.0"
authors = ["Meta Platforms, Inc. and affiliates"]
edition = "2024"
description = "Common below code"
Expand Down
8 changes: 4 additions & 4 deletions below/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "below-config"
version = "0.11.0"
version = "0.12.0"
authors = ["Meta Platforms, Inc. and affiliates"]
edition = "2024"
description = "Configurations for below"
Expand All @@ -11,9 +11,9 @@ license = "Apache-2.0"

[dependencies]
anyhow = "1.0.104"
btrfs = { package = "below-btrfs", version = "0.11.0", path = "../btrfs" }
cgroupfs = { version = "0.11.0", path = "../cgroupfs" }
procfs = { package = "fb_procfs", version = "0.11.0", path = "../procfs" }
btrfs = { package = "below-btrfs", version = "0.12.0", path = "../btrfs" }
cgroupfs = { version = "0.12.0", path = "../cgroupfs" }
procfs = { package = "fb_procfs", version = "0.12.0", path = "../procfs" }
serde = { version = "1.0.229", features = ["derive", "rc"] }
toml = { version = "1.1.8", features = ["preserve_order"] }

Expand Down
Loading
Loading