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

add redhat 9 build and package #515

Merged
merged 5 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ cmake -E make_directory ./build
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DBUILD_DIST_PACKAGES=ON \
-DUSE_OPENSSL=ON \
-S . \
-B ./build
source scl_source enable gcc-toolset-10 \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ARG CMAKE_VERSION="3.26.3"

FROM rockylinux:9

ARG CMAKE_VERSION

LABEL org.opencontainers.image.authors="[email protected]"

USER root
WORKDIR /root/

ENV PATH="/usr/local/:${PATH}"
ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
ENV TZ=UTC

RUN dnf install -y \
"@Development Tools" \
dnf-plugins-core \
iproute \
python3 \
systemd-devel \
zlib-devel \
systemd-rpm-macros \
cmake-rpm-macros \
openssl-devel \
libatomic \
&& dnf config-manager --set-enabled crb \
&& dnf install -y \
doxygen \
graphviz \
git \
ninja-build \
&& dnf clean all

RUN curl -sSfL https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}-linux-$(uname -m).sh -o cmake.sh \
&& (bash cmake.sh --skip-license --prefix=/usr/local) \
&& rm cmake.sh

ENV GIT_CONFIG_GLOBAL="/tmp/ziti-builder-gitconfig"

ENV VCPKG_ROOT=/usr/local/vcpkg
# this must be set on arm. see https://learn.microsoft.com/en-us/vcpkg/users/config-environment#vcpkg_force_system_binaries
ENV VCPKG_FORCE_SYSTEM_BINARIES=yes

RUN cd /usr/local \
&& git clone --branch 2023.04.15 https://github.com/microsoft/vcpkg \
&& ./vcpkg/bootstrap-vcpkg.sh -disableMetrics \
&& chmod -R ugo+rwX /usr/local/vcpkg

WORKDIR /github/workspace
COPY ./entrypoint.sh /root/
ENTRYPOINT [ "/root/entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
#
# RedHat 9
#

set -euo pipefail

# these commands must be in the entrypoint so they are run after workspace is mounted on Docker workdir
echo "INFO: GIT_DISCOVERY_ACROSS_FILESYSTEM=${GIT_DISCOVERY_ACROSS_FILESYSTEM}"
echo "INFO: WORKDIR=${PWD}"
echo "INFO: $(git --version)"

# if first positional is an expected arch string then set cmake preset,
# else use ci-linux-x64 (which actually just uses native/host tools - e.g. not cross compile)
if [ ${#} -ge 1 ]; then
cmake_preset="${1}"
else
cmake_preset="ci-linux-x64"
fi

if [ ${#} -ge 2 ]; then
cmake_config="${2}"
else
cmake_config="Release"
fi

# workspace dir for each build env is added to "safe" dirs in global config e.g.
# ~/.gitconfig so both runner and builder containers trust these dirs
# owned by different UIDs from that of Git's EUID. This is made necessary
# by newly-enforced directory boundaries in Git v2.35.2
# ref: https://lore.kernel.org/git/[email protected]/
for SAFE in \
/github/workspace \
/__w/ziti-tunnel-sdk-c/ziti-tunnel-sdk-c \
/mnt ; do
git config --global --add safe.directory ${SAFE}
done

(
[[ -d ./build ]] && rm -r ./build
cmake -E make_directory ./build
# allow unset for scl_source scripts
set +u
cmake \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DBUILD_DIST_PACKAGES=ON \
-S . \
-B ./build
cmake \
--build ./build \
--config "${cmake_config}" \
--target package \
--verbose
)
5 changes: 1 addition & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: CI build

on:
push:
branches: [ '**' ]

pull_request:
branches: [ main ]

workflow_dispatch:
workflow_call:

jobs:
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/cpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ jobs:
release_name: ${{ null }}
type: rpm
container: docker.io/library/rockylinux:8
- name: redhat
version: "9"
release_name: ${{ null }}
type: rpm
container: docker.io/library/rockylinux:9
exclude:
- distro:
name: ubuntu
Expand Down Expand Up @@ -86,7 +91,7 @@ jobs:
steps:
# only focal-20.04 has >= 2.18, which is required by actions/checkout to clone
# which enables cmake version discovery
- name: install Modern Git in runner container if Ubuntu
- name: install contemporary Git in runner container if Ubuntu
if: ${{ matrix.distro.name == 'ubuntu' }}
run: |
apt -y update
Expand All @@ -96,14 +101,14 @@ jobs:
apt -y install git
git --version

- name: install Modern Git in runner container if RedHat 8
if: ${{ matrix.distro.name == 'redhat' && matrix.distro.version == '8' }}
- name: install contemporary Git in runner container if RedHat 8 or 9
if: ${{ matrix.distro.name == 'redhat' && (matrix.distro.version == '8' || matrix.distro.version == '9') }}
run: |
dnf -y update
dnf -y install git
git --version

- name: install Modern Git in runner container if RedHat 7
- name: install contemporary Git in runner container if RedHat 7
if: ${{ matrix.distro.name == 'redhat' && matrix.distro.version == '7' }}
run: |
yum -y update
Expand Down
9 changes: 0 additions & 9 deletions docker/linux-cross-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ set -x

DIRNAME=$(dirname $0)
REPO_DIR=${DIRNAME}/.. # parent of the top-level dir where this script lives
: ${USE_OPENSSL:="OFF"}
: ${TARGET:="bundle"}
: ${BUILD_DIST_PACKAGES:="OFF"}
: ${DISABLE_LIBSYSTEMD_FEATURE:="OFF"}

if (( ${#} )); then
for OPT in ${*}; do
case $OPT in
--openssl)
USE_OPENSSL="ON"
shift
;;
--package)
USE_OPENSSL="ON"
TARGET="package"
BUILD_DIST_PACKAGES="ON"
shift
Expand Down Expand Up @@ -50,7 +44,6 @@ for ARCH in ${JOBS[@]}; do
amd64) { cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/toolchains/default.cmake \
-DUSE_OPENSSL=${USE_OPENSSL} \
-DBUILD_DIST_PACKAGES=${BUILD_DIST_PACKAGES} \
-DDISABLE_LIBSYSTEMD_FEATURE=${DISABLE_LIBSYSTEMD_FEATURE} \
-S ${REPO_DIR} \
Expand All @@ -64,7 +57,6 @@ for ARCH in ${JOBS[@]}; do
arm64) { cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/toolchains/Linux-arm64.cmake \
-DUSE_OPENSSL=${USE_OPENSSL} \
-DBUILD_DIST_PACKAGES=${BUILD_DIST_PACKAGES} \
-DDISABLE_LIBSYSTEMD_FEATURE=${DISABLE_LIBSYSTEMD_FEATURE} \
-S ${REPO_DIR} \
Expand All @@ -78,7 +70,6 @@ for ARCH in ${JOBS[@]}; do
arm) { cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/toolchains/Linux-arm.cmake \
-DUSE_OPENSSL=${USE_OPENSSL} \
-DBUILD_DIST_PACKAGES=${BUILD_DIST_PACKAGES} \
-DDISABLE_LIBSYSTEMD_FEATURE=${DISABLE_LIBSYSTEMD_FEATURE} \
-S ${REPO_DIR} \
Expand Down
7 changes: 0 additions & 7 deletions docker/linux-native-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ set -x

DIRNAME=$(dirname $0)
REPO_DIR=${DIRNAME}/.. # parent of the top-level dir where this script lives
: ${USE_OPENSSL:="OFF"}
: ${TARGET:="bundle"}
: ${BUILD_DIST_PACKAGES:="OFF"}
: ${DISABLE_LIBSYSTEMD_FEATURE:="OFF"}

if (( ${#} )); then
for OPT in ${*}; do
case $OPT in
--openssl)
USE_OPENSSL="ON"
shift
;;
--package)
USE_OPENSSL="ON"
TARGET="package"
BUILD_DIST_PACKAGES="ON"
shift
Expand All @@ -41,7 +35,6 @@ mkdir ${CMAKE_BUILD_DIR}
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/toolchains/default.cmake \
-DUSE_OPENSSL=${USE_OPENSSL} \
-DBUILD_DIST_PACKAGES=${BUILD_DIST_PACKAGES} \
-DDISABLE_LIBSYSTEMD_FEATURE=${DISABLE_LIBSYSTEMD_FEATURE} \
-S ${REPO_DIR} \
Expand Down
2 changes: 1 addition & 1 deletion scripts/openwrt-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ if [ -x /usr/bin/ninja ]; then
fi

if [ -f "$target_dir/usr/include/openssl/opensslv.h" ]; then
CMAKE_OPTS="$CMAKE_OPTS -DUSE_OPENSSL=on"
CMAKE_OPTS="$CMAKE_OPTS"
fi

if [ -f "$target_dir/usr/include/sodium.h" ]; then
Expand Down