Skip to content

Commit bcb0acc

Browse files
committed
A little tidy up
1 parent 710073f commit bcb0acc

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,28 @@ jobs:
9090

9191
- run: docker push "$(make image-name)"
9292

93-
tag:
93+
vars:
9494
runs-on: ubuntu-24.04
9595
outputs:
96-
tag: ${{ steps.tag.outputs.tag }}
97-
image-name: ${{ steps.image-name.outputs.image-name }}
96+
tag: ${{ steps.vars.outputs.tag }}
97+
image-name: ${{ steps.vars.outputs.image-name }}
9898
steps:
9999
- uses: actions/checkout@v4
100100
with:
101101
submodules: true
102-
- id: tag
103-
run: echo "tag=$(make tag)" >> "$GITHUB_OUTPUT"
104102

105-
- id: image-name
106-
run: echo "image-name=$(make image-name)" >> "$GITHUB_OUTPUT"
103+
- id: vars
104+
run: |
105+
{
106+
echo "tag=$(make tag)"
107+
echo "image-name=$(make image-name)"
108+
} >> "$GITHUB_OUTPUT"
107109
108110
manifest:
109111
runs-on: ubuntu-24.04
110112
needs:
111113
- container
112-
- tag
114+
- vars
113115
env:
114116
ARCHS: amd64 arm64
115117
steps:
@@ -127,15 +129,14 @@ jobs:
127129

128130
- uses: ./collector/.github/actions/create-multiarch-manifest
129131
with:
130-
base-image: ${{ needs.tag.outputs.image-name }}
132+
base-image: ${{ needs.vars.outputs.image-name }}
131133
archs: ${{ env.ARCHS }}
132134

133135
integration-tests:
134136
needs:
135-
- container
136-
- tag
137+
- vars
137138
- manifest
138139
uses: ./.github/workflows/integration-tests.yml
139140
with:
140-
tag: ${{ needs.tag.outputs.tag }}
141+
tag: ${{ needs.vars.outputs.tag }}
141142
secrets: inherit

fact/build.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ use std::{
55
process::Command,
66
};
77

8-
fn compile_bpf(out_dir: &Path) -> anyhow::Result<()> {
8+
fn compile_bpf(out_dir: &Path, arch: &str) -> anyhow::Result<()> {
99
let obj = match out_dir.join("main.o").into_os_string().into_string() {
1010
Ok(s) => s,
1111
Err(os_string) => anyhow::bail!("Failed to convert path to string {:?}", os_string),
1212
};
13+
14+
let target_arch = format!("-D__TARGET_ARCH_{}", arch);
15+
1316
match Command::new("clang")
1417
.args([
1518
"-target",
@@ -19,7 +22,7 @@ fn compile_bpf(out_dir: &Path) -> anyhow::Result<()> {
1922
"-c",
2023
"-Wall",
2124
"-Werror",
22-
&format!("-D__TARGET_ARCH_{}", env::var("CARGO_CFG_TARGET_ARCH")?),
25+
&target_arch,
2326
"../fact-ebpf/main.c",
2427
"-o",
2528
&obj,
@@ -52,6 +55,7 @@ fn main() -> anyhow::Result<()> {
5255
let out_dir: PathBuf = env::var("OUT_DIR")
5356
.context("Failed to interpret OUT_DIR environment variable")?
5457
.into();
55-
compile_bpf(&out_dir).context("Failed to compile eBPF")?;
58+
let arch = env::var("CARGO_CFG_TARGET_ARCH")?;
59+
compile_bpf(&out_dir, &arch).context("Failed to compile eBPF")?;
5660
generate_bindings(&out_dir)
5761
}

fact/src/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{
22
ffi::CStr,
3+
os::raw::c_char,
34
path::PathBuf,
45
time::{SystemTime, UNIX_EPOCH},
56
};
@@ -12,7 +13,7 @@ use crate::{
1213
host_info,
1314
};
1415

15-
fn slice_to_string(s: &[std::os::raw::c_char]) -> anyhow::Result<String> {
16+
fn slice_to_string(s: &[c_char]) -> anyhow::Result<String> {
1617
Ok(unsafe { CStr::from_ptr(s.as_ptr()) }.to_str()?.to_owned())
1718
}
1819

0 commit comments

Comments
 (0)