Skip to content

Commit bb2db49

Browse files
committed
test
Signed-off-by: Roberto Scolaro <[email protected]>
1 parent fbfecbb commit bb2db49

File tree

4 files changed

+115
-47
lines changed

4 files changed

+115
-47
lines changed

Diff for: .github/workflows/ci.yaml

+64-18
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,72 @@ on:
88

99

1010
jobs:
11+
builder:
12+
env:
13+
REGISTRY: ghcr.io
14+
BUILDER_IMAGE_BASE: ghcr.io/draios/sysdig-builder-pr
15+
SKEL_BUILDER_IMAGE_BASE: ghcr.io/draios/sysdig-skel-builder-pr
16+
BUILDER_DEV: ghcr.io/draios/sysdig-builder:dev
17+
SKEL_BUILDER_DEV: ghcr.io/draios/sysdig-skel-builder:dev
18+
permissions: read-all|write-all
19+
permissions:
20+
packages: write
21+
contents: read
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout Sysdig
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Check if builder is modified
30+
id: builder-files
31+
uses: tj-actions/changed-files@v34
32+
with:
33+
files: |
34+
docker/builder/**
35+
36+
- name: Set up QEMU
37+
if: steps.builder-files.outputs.any_changed == 'true'
38+
uses: docker/setup-qemu-action@v3
39+
with:
40+
platforms: 'amd64,arm64'
41+
42+
- name: Set up Docker Buildx
43+
if: steps.builder-files.outputs.any_changed == 'true'
44+
uses: docker/setup-buildx-action@v2
45+
46+
- name: Login to Github Packages
47+
if: steps.builder-files.outputs.any_changed == 'true'
48+
uses: docker/login-action@v3
49+
with:
50+
registry: ${{ env.REGISTRY }}
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Get new builder image tag
55+
id: get-new-builder
56+
if: steps.builder-files.outputs.any_changed == 'true'
57+
run: |
58+
echo "builder_image=${{ (github.event.pull_request.number != '') && format('{0}:{1}', env.BUILDER_IMAGE_BASE, github.event.pull_request.number) || env.BUILDER_DEV }}" >> $GITHUB_OUTPUT
59+
60+
- name: Build new builder
61+
id: build-builder
62+
if: steps.builder-files.outputs.any_changed == 'true'
63+
uses: docker/build-push-action@v6
64+
with:
65+
context: docker/builder
66+
platforms: linux/amd64,linux/arm64
67+
tags: ${{ steps.get-new-builder.outputs.builder_image }}
68+
push: true
69+
outputs:
70+
builder_image: ${{ (steps.builder-files.outputs.any_changed == 'true') && steps.get-new-builder.outputs.builder_image || env.BUILDER_DEV }}
71+
1172
build-sysdig-linux:
73+
needs: [builder]
1274
runs-on: ubuntu-latest
1375
container:
14-
image: ubuntu:22.04
15-
options: --platform ${{ matrix.platform }}
76+
image: ${{ needs.builder.outputs.builder_image }}
1677
strategy:
1778
matrix:
1879
platform:
@@ -23,29 +84,14 @@ jobs:
2384
- name: Set up QEMU
2485
uses: docker/setup-qemu-action@v3
2586

26-
- name: Install deps
27-
run: |
28-
sudo apt update && sudo apt install -y --no-install-recommends ninja-build curl ca-certificates build-essential git clang llvm pkg-config autoconf automake libtool libelf-dev wget libc-ares-dev libcurl4-openssl-dev libssl-dev libtbb-dev libjq-dev libjsoncpp-dev libgrpc++-dev protobuf-compiler-grpc libgtest-dev libprotobuf-dev cmake ninja-build
29-
DIR=$(pwd)
30-
cd /tmp
31-
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch
32-
cd bpftool
33-
git submodule update --init
34-
cd src
35-
sudo make install
36-
cd ${DIR}
37-
3887
- name: Checkout Sysdig
3988
uses: actions/checkout@v4
4089
with:
4190
fetch-depth: 0
4291

43-
- name: Install zig
44-
uses: ./.github/actions/install-zig
45-
4692
- name: Build Sysdig
4793
run: |
48-
cmake -DUSE_BUNDLED_DEPS=ON -DBUILD_BPF=OFF -DBUILD_SYSDIG_MODERN_BPF=OFF -DBUILD_DRIVER=OFF -DCMAKE_BUILD_TYPE=Release -S . -B build -G Ninja
94+
cmake -DUSE_BUNDLED_DEPS=ON -DBUILD_BPF=OFF -DBUILD_DRIVER=OFF -DCMAKE_BUILD_TYPE=Release -S . -B build -G Ninja
4995
cmake --build build --target package --config Release
5096
5197
- name: Set artifact name

Diff for: docker/builder/Dockerfile

+47-29
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
FROM centos:7
2-
3-
LABEL name="sysdig/sysdig-builder"
4-
LABEL usage="docker run -v $PWD/..:/source -v $PWD/build:/build sysdig/sysdig-builder cmake"
1+
FROM ubuntu:22.04
52

63
ARG BUILD_TYPE=release
74
ARG BUILD_DRIVER=OFF
@@ -17,31 +14,52 @@ ENV BUILD_VERSION=${BUILD_VERSION}
1714
ENV BUILD_WARNINGS_AS_ERRORS=${BUILD_WARNINGS_AS_ERRORS}
1815
ENV MAKE_JOBS=${MAKE_JOBS}
1916

20-
COPY ./root /
21-
22-
WORKDIR /
17+
ARG ZIG_VERSION=0.14.0-dev.2441+3670910f2
2318

24-
# build toolchain
25-
RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
26-
sed -i 's/^#.*baseurl=http/baseurl=https/g' /etc/yum.repos.d/*.repo && \
27-
sed -i 's/^mirrorlist=http/#mirrorlist=https/g' /etc/yum.repos.d/*.repo && \
28-
yum -y install centos-release-scl; \
29-
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
30-
sed -i 's/^#.*baseurl=http/baseurl=https/g' /etc/yum.repos.d/*.repo && \
31-
sed -i 's/^mirrorlist=http/#mirrorlist=https/g' /etc/yum.repos.d/*.repo && \
32-
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ git wget make m4 rpm-build clang perl-IPC-Cmd ; \
33-
source scl_source enable devtoolset-9
19+
COPY ./zig-cc /usr/bin/
20+
COPY ./zig-c++ /usr/bin/
3421

35-
RUN curl -L -o /tmp/cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.27.6/cmake-3.27.6-linux-$(uname -m).tar.gz; \
36-
gzip -d /tmp/cmake.tar.gz; \
37-
tar -xpf /tmp/cmake.tar --directory=/tmp; \
38-
cp -R /tmp/cmake-3.27.6-linux-$(uname -m)/* /usr; \
39-
rm -rf /tmp/cmake-3.27.6-linux-$(uname -m)/
40-
41-
# DTS
42-
ENV BASH_ENV=/usr/bin/scl_enable \
43-
ENV=/usr/bin/scl_enable \
44-
PROMPT_COMMAND=". /usr/bin/scl_enable"
22+
WORKDIR /
4523

46-
ENTRYPOINT ["build"]
47-
CMD ["usage"]
24+
RUN apt update && \
25+
apt install -y --no-install-recommends \
26+
autoconf \
27+
automake \
28+
build-essential \
29+
ca-certificates \
30+
clang \
31+
cmake \
32+
curl \
33+
git \
34+
libc-ares-dev \
35+
libcurl4-openssl-dev \
36+
libelf-dev \
37+
libgrpc++-dev \
38+
libgtest-dev \
39+
libjq-dev \
40+
libjsoncpp-dev \
41+
libprotobuf-dev \
42+
libssl-dev \
43+
libtbb-dev \
44+
libtool \
45+
llvm \
46+
ninja-build \
47+
pkg-config \
48+
protobuf-compiler-grpc \
49+
wget \
50+
xz-utils && \
51+
git clone https://github.com/libbpf/bpftool.git --branch v7.3.0 --single-branch && \
52+
cd bpftool && \
53+
git submodule update --init && \
54+
cd src && \
55+
make install && \
56+
cd ../.. && \
57+
rm -fr bpftool && \
58+
curl -LO https://ziglang.org/builds/zig-linux-$(uname -m)-${ZIG_VERSION}.tar.xz && \
59+
tar -xaf zig-linux-$(uname -m)-${ZIG_VERSION}.tar.xz && \
60+
rm -v zig-linux-$(uname -m)-${ZIG_VERSION}.tar.xz && \
61+
cd zig-linux-$(uname -m)-${ZIG_VERSION} && \
62+
cp -v zig /usr/bin && \
63+
find lib -exec cp --parents {} /usr/ \; && \
64+
cd .. && \
65+
rm -fr zig*

Diff for: docker/builder/zig-c++

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec zig c++ -target $(uname -m)-linux-gnu.2.17 -mcpu=baseline $@

Diff for: docker/builder/zig-cc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec zig cc -target $(uname -m)-linux-gnu.2.17 -mcpu=baseline $@

0 commit comments

Comments
 (0)