From 430ba2b9d8a336fab8e60967d11d7db278b69802 Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Wed, 2 Sep 2020 14:29:44 +0200 Subject: [PATCH] build: circleci config for musl Co-Authored-By: Leonardo Grasso Signed-off-by: Lorenzo Fontana --- .circleci/config.yml | 69 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index edf7cad158e..840d03f291e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,50 @@ version: 2 jobs: + # Build a statically linked Falco release binary using musl + # This build is 100% static, there are no host dependencies + "build/musl": + docker: + - image: alpine:3.12 + working_directory: /source-static/falco + steps: + - checkout: + path: /source-static/falco + - run: + name: Update base image + command: apk update -y + - run: + name: Install build dependencies + command: apk add g++ gcc cmake cmake make ncurses-dev git bash perl linux-headers autoconf automake m4 libtool elfutils-dev libelf-static patch binutils -y + - run: + name: Prepare project + command: | + mkdir -p /build-static/release + pushd /build-static/release + cmake -DCPACK_GENERATOR=TGZ -DBUILD_BPF=Off -DBUILD_DRIVER=Off -DCMAKE_BUILD_TYPE=Release -DUSE_BUNDLED_DEPS=On -DMUSL_OPTIMIZED_BUILD=On .. + popd + - run: + name: Build + command: | + pushd /build-static/release + make -j4 all + popd + - run: + name: Package + command: | + pushd /build-static/release + make -j4 package + popd + - run: + name: Run unit tests + command: | + pushd /build-static/release + make tests + popd + - persist_to_workspace: + root: / + paths: + - /build-static/release + - source-static # Build using ubuntu LTS # This build is dynamic, most dependencies are taken from the OS "build/ubuntu-focal": @@ -202,6 +247,20 @@ jobs: - run: name: Execute integration tests command: /usr/bin/entrypoint test + "tests/integration-static": + docker: + - image: falcosecurity/falco-tester:latest + environment: + SOURCE_DIR: "/source-static" + BUILD_DIR: "/build-static" + BUILD_TYPE: "release" + steps: + - setup_remote_docker + - attach_workspace: + at: / + - run: + name: Execute integration tests + command: /usr/bin/entrypoint test "tests/driver-loader/integration": machine: image: ubuntu-1604:202004-01 @@ -271,6 +330,11 @@ jobs: command: | FALCO_VERSION=$(cat /build/release/userspace/falco/config_falco.h | grep 'FALCO_VERSION ' | cut -d' ' -f3 | sed -e 's/^"//' -e 's/"$//') jfrog bt u /build/release/falco-${FALCO_VERSION}-x86_64.tar.gz falcosecurity/bin-dev/falco/${FALCO_VERSION} x86_64/ --user poiana --key ${BINTRAY_SECRET} --publish --override + - run: + name: Publish tgz-static-dev + command: | + FALCO_VERSION=$(cat /build-musl/release/userspace/falco/config_falco.h | grep 'FALCO_VERSION ' | cut -d' ' -f3 | sed -e 's/^"//' -e 's/"$//') + jfrog bt u /build-musl/release/falco-${FALCO_VERSION}-x86_64.tar.gz falcosecurity/bin-dev/falco/${FALCO_VERSION} x86_64/ falco-static-${FALCO_VERSION}-x86_64.tar.gz --user poiana --key ${BINTRAY_SECRET} --publish --override # Publish docker packages "publish/docker-dev": docker: @@ -372,6 +436,7 @@ workflows: version: 2 build_and_test: jobs: + - "build/musl" - "build/ubuntu-focal" - "build/ubuntu-focal-debug" - "build/ubuntu-bionic" @@ -381,6 +446,9 @@ workflows: - "tests/integration": requires: - "build/centos7" + - "tests/integration-static": + requires: + - "build/musl" - "tests/driver-loader/integration": requires: - "build/centos7" @@ -402,6 +470,7 @@ workflows: only: master requires: - "rpm/sign" + - "tests/integration-static" - "publish/docker-dev": context: falco filters: