Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Add support for building on Centos Stream 9 and drop support for building on Centos 7.4 (fixes #521). #528

Merged
merged 28 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e3e6451
Link reducer-server against boost::system and boost::thread.
kirkrodrigues Aug 30, 2024
98e9c86
Upgrade to mongocxx 3.10.2 which installs mongoc by itself.
kirkrodrigues Aug 30, 2024
0269ad1
Add libboost-thread to Jammy container image.
kirkrodrigues Aug 30, 2024
fe2d368
Link against static mongoc.
kirkrodrigues Aug 30, 2024
cf1e02e
Fix typo.
kirkrodrigues Aug 30, 2024
994bcb0
Add shared library build to workflow checks.
kirkrodrigues Aug 30, 2024
58492b6
Remove boost::thread; Link reducer-server against Threads::Threads.
kirkrodrigues Aug 30, 2024
e826830
Remove obsolete mongoc installation script.
kirkrodrigues Aug 30, 2024
a2e5d81
Touch-up comment.
kirkrodrigues Aug 31, 2024
1e65bdf
Don't nuke build directory between builds.
kirkrodrigues Aug 31, 2024
f9fe9d4
Replace build-and-run-unit-tests shell script with Python script; Par…
kirkrodrigues Aug 31, 2024
d99c879
Use flags that name the matrix jobs nicely; Fix typo.
kirkrodrigues Aug 31, 2024
cdacf35
Define functions before use.
kirkrodrigues Aug 31, 2024
58cb7e1
Try ./
kirkrodrigues Aug 31, 2024
780b73b
Set workflow job names explicitly; Refactoring.
kirkrodrigues Sep 1, 2024
e4eadc9
Try not comparing against 'true'.
kirkrodrigues Sep 1, 2024
631d320
core: Replace Centos 7.4 container image with Centos Stream 9 contain…
kirkrodrigues Sep 2, 2024
fdefeb5
Fix typo.
kirkrodrigues Sep 2, 2024
c822f58
Use lowercase names for stages.
kirkrodrigues Sep 2, 2024
c9670f7
Fix remaining references to Centos 7.4.
kirkrodrigues Sep 2, 2024
2b21594
Install task in container image.
kirkrodrigues Sep 2, 2024
41c21ef
Use mysql.h rather than mariadb/mysql.h.
kirkrodrigues Sep 2, 2024
e7b00c1
Set continue-on-error: true so failure of shared/static lib build doe…
kirkrodrigues Sep 2, 2024
f433128
Merge branch 'fix-526' into fix-521
kirkrodrigues Sep 2, 2024
34755df
Update .clang-format.
kirkrodrigues Sep 2, 2024
a0b03ef
Merge branch 'main' into fix-521
kirkrodrigues Sep 5, 2024
ebd64b1
Update components/core/tools/scripts/lib_install/centos-stream-9/inst…
kirkrodrigues Sep 6, 2024
0676df4
CMakeLists.txt: Fix incorrect line wrapping.
kirkrodrigues Sep 6, 2024
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
24 changes: 12 additions & 12 deletions .github/workflows/clp-core-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
filter-relevant-changes:
runs-on: "ubuntu-latest"
outputs:
centos74_image_changed: "${{steps.filter.outputs.centos74_image}}"
centos_stream_9_image_changed: "${{steps.filter.outputs.centos_stream_9_image}}"
ubuntu_focal_image_changed: "${{steps.filter.outputs.ubuntu_focal_image}}"
ubuntu_jammy_image_changed: "${{steps.filter.outputs.ubuntu_jammy_image}}"
clp_changed: "${{steps.filter.outputs.clp}}"
Expand All @@ -63,12 +63,12 @@ jobs:
# image (since it would be different from the published image).
base: "main"
filters: |
centos74_image:
centos_stream_9_image:
- ".github/actions/**"
- ".github/workflows/clp-core-build.yaml"
- "components/core/tools/scripts/lib_install/*.sh"
- "components/core/tools/docker-images/clp-env-base-centos7.4/**"
- "components/core/tools/scripts/lib_install/centos7.4/**"
- "components/core/tools/docker-images/clp-env-base-centos-stream-9/**"
- "components/core/tools/scripts/lib_install/centos-stream-9/**"
ubuntu_focal_image:
- ".github/actions/**"
- ".github/workflows/clp-core-build.yaml"
Expand All @@ -94,8 +94,8 @@ jobs:
- "Taskfile.yml"
- "tools/scripts/deps-download/**"

centos74-deps-image:
if: "needs.filter-relevant-changes.outputs.centos74_image_changed == 'true'"
centos-stream-9-deps-image:
if: "needs.filter-relevant-changes.outputs.centos_stream_9_image_changed == 'true'"
needs: "filter-relevant-changes"
runs-on: "ubuntu-latest"
steps:
Expand All @@ -109,7 +109,7 @@ jobs:

- uses: "./.github/actions/clp-core-build-containers"
env:
OS_NAME: "centos7.4"
OS_NAME: "centos-stream-9"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
docker_context: "components/core"
Expand Down Expand Up @@ -169,18 +169,18 @@ jobs:
${{github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
token: "${{secrets.GITHUB_TOKEN}}"

centos74-binaries:
centos-stream-9-binaries:
# Run if the ancestor jobs succeeded OR they were skipped and clp was changed.
if: >-
success()
|| (!cancelled() && !failure() && needs.filter-relevant-changes.outputs.clp_changed == 'true')
needs:
- "centos74-deps-image"
- "centos-stream-9-deps-image"
- "filter-relevant-changes"
strategy:
matrix:
use_shared_libs: [true, false]
name: "centos74-${{matrix.use_shared_libs && 'dynamic' || 'static'}}-linked-bins"
name: "centos-stream-9-${{matrix.use_shared_libs && 'dynamic' || 'static'}}-linked-bins"
continue-on-error: true
runs-on: "ubuntu-latest"
steps:
Expand All @@ -194,12 +194,12 @@ jobs:

- uses: "./.github/actions/clp-core-build"
env:
OS_NAME: "centos7.4"
OS_NAME: "centos-stream-9"
with:
image_name: "${{env.DEPS_IMAGE_NAME_PREFIX}}${{env.OS_NAME}}"
use_shared_libs: "${{matrix.use_shared_libs}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.centos74_image_changed == 'false'
${{needs.filter-relevant-changes.outputs.centos_stream_9_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
upload_binaries: "false"

Expand Down
4 changes: 2 additions & 2 deletions components/core/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ IncludeCategories:
# NOTE: A header is grouped by first matching regex
# Library headers. Update when adding new libraries.
# NOTE: clang-format retains leading white-space on a line in violation of the YAML spec.
- Regex: "<(absl|antlr4|archive|boost|bsoncxx|catch2|curl|date|fmt|json|log_surgeon|mariadb\
|mongocxx|msgpack|openssl|outcome|regex_utils|simdjson|spdlog|sqlite3|string_utils|yaml-cpp|zstd)"
- Regex: "<(absl|antlr4|archive|boost|bsoncxx|catch2|curl|date|fmt|json|log_surgeon|mongocxx\
|msgpack|mysql|openssl|outcome|regex_utils|simdjson|spdlog|sqlite3|string_utils|yaml-cpp|zstd)"
Priority: 3
# C system headers
- Regex: "^<.+\\.h>"
Expand Down
18 changes: 14 additions & 4 deletions components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,20 @@ endif()

# Detect linking mode (static or shared); Default to static.
set(CLP_USE_STATIC_LIBS ON CACHE BOOL "Whether to link against static libraries")
if (CLP_USE_STATIC_LIBS AND APPLE)
message(AUTHOR_WARNING "Building with static libraries is unsupported on macOS."
" Switching to shared libraries.")
set(CLP_USE_STATIC_LIBS OFF)
if (CLP_USE_STATIC_LIBS)
if (APPLE)
set(CLP_STATIC_LIBS_UNSUPPORTED_PLATFORM "macOS")
elseif (EXISTS "/etc/centos-release")
set(CLP_STATIC_LIBS_UNSUPPORTED_PLATFORM "CentOS")
endif()

if (DEFINED CLP_STATIC_LIBS_UNSUPPORTED_PLATFORM)
message(
AUTHOR_WARNING
"Building with static libraries is unsupported on \
${CLP_STATIC_LIBS_UNSUPPORTED_PLATFORM}. Switching to shared libraries.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at line 132 in the same file, I feel this line wrapping is inappropriate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my mistake.

set(CLP_USE_STATIC_LIBS OFF)
endif()
endif ()
if(CLP_USE_STATIC_LIBS)
set(CLP_LIBS_STRING "static")
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/MySQLDB.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <string>

#include <mariadb/mysql.h>
#include <mysql.h>

#include "Defs.h"
#include "ErrorCode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/MySQLParamBindings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cstdint>
#include <vector>

#include <mariadb/mysql.h>
#include <mysql.h>

#include "ErrorCode.hpp"
#include "TraceableException.hpp"
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/MySQLPreparedStatement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <vector>

#include <mariadb/mysql.h>
#include <mysql.h>

#include "ErrorCode.hpp"
#include "MySQLParamBindings.hpp"
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/glt/MySQLDB.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <string>

#include <mariadb/mysql.h>
#include <mysql.h>

#include "Defs.h"
#include "ErrorCode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/glt/MySQLParamBindings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cstdint>
#include <vector>

#include <mariadb/mysql.h>
#include <mysql.h>

#include "ErrorCode.hpp"
#include "TraceableException.hpp"
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/glt/MySQLPreparedStatement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
#include <vector>

#include <mariadb/mysql.h>
#include <mysql.h>

#include "ErrorCode.hpp"
#include "MySQLParamBindings.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM dokken/centos-stream-9 AS base

WORKDIR /root

RUN mkdir -p ./tools/scripts/lib_install
ADD ./tools/scripts/lib_install ./tools/scripts/lib_install

RUN ./tools/scripts/lib_install/centos-stream-9/install-all.sh

# NOTE:
# 1. `task` doesn't have an apt/dnf package so we use its install script.
# 2. We don't want to install it using `install-prebuilt-packages.sh` since users may use that on
# their own machines and it would change their environment in a way that can't easily be undone.
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin

# Remove cached files
RUN dnf clean all \
&& rm -rf /tmp/* /var/tmp/*

# Flatten the image
FROM scratch
COPY --from=base / /
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# Exit on any error
set -e

# Error on undefined variable
set -u

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
component_root="${script_dir}/../../../"

docker build \
--tag clp-core-dependencies-x86-centos-stream-9:dev \
"$component_root" \
--file "${script_dir}/Dockerfile"

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ set -u

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

"$script_dir"/install-prebuilt-packages.sh
"$script_dir"/install-packages-from-source.sh
"${script_dir}/install-prebuilt-packages.sh"
"${script_dir}/install-packages-from-source.sh"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Exit on any error
set -e

# Error on undefined variable
set -u

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
lib_install_scripts_dir="${script_dir}/.."

# NOTE: The remaining installation scripts depend on and boost, so we install it beforehand.
kirkrodrigues marked this conversation as resolved.
Show resolved Hide resolved
"${lib_install_scripts_dir}/install-boost.sh" 1.76.0

"${lib_install_scripts_dir}/fmtlib.sh" 8.0.1
"${lib_install_scripts_dir}/spdlog.sh" 1.9.2
"${lib_install_scripts_dir}/mongocxx.sh" 3.10.2
"${lib_install_scripts_dir}/msgpack.sh" 6.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# Exit on any error
set -e

# Error on undefined variable
set -u

dnf install -y \
cmake \
gcc-c++ \
git \
java-11-openjdk \
libarchive-devel \
libcurl-devel \
libzstd-devel \
make \
mariadb-connector-c-devel \
openssl-devel

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ fi
source /etc/os-release
if [ $ID = "ubuntu" ] ; then
os_version=ubuntu-$UBUNTU_CODENAME
elif [ $ID = "centos" ] ; then
os_version=centos${VERSION_ID}
else
echo "Unsupported OS ID: $ID"
exit 1
fi

# Download
Expand Down
Loading
Loading