From c114adf551beeb084748b8d19ce1102ddba291a9 Mon Sep 17 00:00:00 2001 From: Alexander Indenbaum Date: Tue, 19 Nov 2024 16:01:41 +0000 Subject: [PATCH] Try containerized build Signed-off-by: Alexander Indenbaum --- .github/workflows/build-container.yml | 41 +++++++++++++++++++++++++++ do_containerized_build.sh | 23 +++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/build-container.yml create mode 100755 do_containerized_build.sh diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml new file mode 100644 index 0000000000000..8568677283d43 --- /dev/null +++ b/.github/workflows/build-container.yml @@ -0,0 +1,41 @@ +--- +name: "Containerized CEPH build" +on: + push: + tags: + - '*' + branches: + - '*' + pull_request: + branches: + - main +# Credit: https://stackoverflow.com/a/72408109 +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +env: + BUILD_ARTIFACT: build.tar.bz2 +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 480 # Set timeout to 8 hours + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build ceph in centos9 stream container + run: | + docker run --rm -v "$(pwd):/src" -w /src quay.io/centos/centos:stream9 /bin/bash -c "./do_containerized_build.sh" + + - name: Save ceph build + run: | + tar -cjf ${{ env.BUILD_ARTIFACT }} -C ./build . + + - name: Upload ceph build + uses: actions/upload-artifact@v4 + with: + name: ceph_build + path: | + ${{ env.BUILD_ARTIFACT }} diff --git a/do_containerized_build.sh b/do_containerized_build.sh new file mode 100755 index 0000000000000..618f22901d5fd --- /dev/null +++ b/do_containerized_build.sh @@ -0,0 +1,23 @@ +#!/bin/sh -ex + +# This script is intended to run within centos-9 container +# image name: quay.io/centos/centos:stream9 +# docker run --rm -v "$(pwd):/src" -w /src quay.io/centos/centos:stream9 /bin/bash -c "./do_containerized_build.sh" +# Based on https://docs.ceph.com/en/reef/install/build-ceph/#:~:text=You%20can%20get%20Ceph%20software,packages%20and%20install%20the%20packages. + + +# Before you can build Ceph source code, you need to install several libraries and tools: +./install-deps.sh + +# The container root ownership issue +#fatal: detected dubious ownership in repository at '/src' +# To add an exception for this directory, call: +git config --global --add safe.directory /src + +# Ceph is built using cmake. +./do_cmake.sh +cd build +ninja + +# return the ownership to the user +#sudo chown -R $(id -u):$(id -g) .