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

build packages with cmake presets and vcpkg #641

Merged
merged 65 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
fcf7fc0
use cmake presets when building package
scareything Apr 21, 2023
a4e291f
install and set up vcpkg in build image
scareything Apr 22, 2023
fbd7d22
fix cmake --build argument order
scareything Apr 22, 2023
d5fb04c
look for zet binary in ${config} directory
scareything Apr 22, 2023
b39dbd1
include config in run binary step
scareything Apr 22, 2023
c47b1a7
use ssl libs from package manager when building with -DOPENSSL=ON on …
scareything Apr 24, 2023
5a22a42
don't specify overlay ports from preset, since some OSs don't provide…
scareything Apr 24, 2023
ffe4f78
build openssl on rocky 8, since the repos provide an older version th…
scareything Apr 24, 2023
cafcaae
redhat 7 & 8 package builds with openssl
scareything Apr 24, 2023
2bfeea2
install vcpkg
scareything Apr 24, 2023
bd160b3
install vcpkg in ubuntu 14 builder image
scareything Apr 24, 2023
ecba7c6
try with system ssl libraries now that tlsuv builds with openssl 1.x
scareything Apr 26, 2023
06166a1
correct cmake build arguments
scareything Apr 26, 2023
fc7cd7f
use zlib from system when building for linux
scareything Apr 26, 2023
242e7cc
install openssl-devel from epel repo for newer version
scareything Apr 26, 2023
223db98
re-add the Debian builder Dockerfile for reference
qrkourier Apr 24, 2023
a4c1ccc
configure MultiArch for Ubuntu so we can build for Jammy, Focal on Ub…
qrkourier Apr 24, 2023
7635848
build bionic with vcpkg
qrkourier Apr 25, 2023
1faece1
stop running ZET with extra args
qrkourier Apr 25, 2023
2c4020f
delete the old Dockerfile for building ZET on Debian
qrkourier Apr 26, 2023
175b898
try with system ssl libraries now that tlsuv builds with openssl 1.x
scareything Apr 26, 2023
ed5e324
use separate vcpkg path for rh7.
scareything Apr 26, 2023
e4296a8
dont use system-provided openssl on rh7
scareything Apr 26, 2023
926599e
install zlib-dev packages for cross compiling
scareything Apr 26, 2023
a6007dc
use vcpkg on ubuntu 16
scareything Apr 26, 2023
52b5cb7
remove line continuation
scareything Apr 26, 2023
4fe372d
install dependencies for vcpkg
scareything Apr 26, 2023
40304af
install ninja
scareything Apr 26, 2023
3853af6
build opeenssl on ubuntu 16
scareything Apr 26, 2023
c6744d5
fix cmake command
scareything Apr 26, 2023
7662e96
install dependencies for vcpkg on ubuntu 14
scareything Apr 26, 2023
d35bfc3
give cmake more leeway when looking for things.
scareything Apr 28, 2023
94f42c3
give cmake more leeway when looking for things.
scareything Apr 28, 2023
dfebad2
update cmake
scareything Apr 28, 2023
fe085b8
sell pkg-config where to look for .pc files
scareything Apr 28, 2023
5fa9b44
add zlib for cross builds
scareything Apr 28, 2023
b774901
set pkg_config_path for arm toolchain
scareything Apr 29, 2023
52fad4a
install zlib1g-dev
scareything Apr 30, 2023
7abd06b
don't use olde ssl libs provided by buuntu 18
scareything May 1, 2023
ee1daef
see if run-vcpkg@11 fixes incorrect submodule detection
scareything May 1, 2023
4cb8848
rename vcpkg subdirectory to avoid confusing run-vcpkg action
scareything May 1, 2023
28b2732
don't use openssl from package manager on any ubuntu 18 builds
scareything May 1, 2023
7ad25ee
use matrix_cmake_opts when configuring
scareything May 1, 2023
fcd5fbb
quotes
scareything May 1, 2023
84116e7
different quotes
scareything May 1, 2023
5e1bd3b
different quotes
scareything May 1, 2023
78b2187
different quotes
scareything May 1, 2023
b53d368
nested quotes
scareything May 1, 2023
337cf37
un-nest overlay subdirectories
scareything May 1, 2023
60503d4
clean up comments
scareything May 1, 2023
7978d3b
tighten up package dependencies
scareything May 1, 2023
45c6773
fix overlay path
scareything May 2, 2023
c514d41
fall back to useradd in debian post script if systemd-sysuers is absent
scareything May 4, 2023
ce5e391
use distro subdirectories for docker context
scareything May 4, 2023
0395ac2
construct dockerfile path with format
scareything May 4, 2023
afc7211
require distro input
scareything May 4, 2023
e1889d8
copy action metadata file into distro subdirectory before calling
scareything May 4, 2023
c0e2a8b
fix paths. use workflow variable
scareything May 4, 2023
9fa5c98
fix paths
scareything May 4, 2023
8c38bd3
fix line escape
scareything May 4, 2023
c22f872
move all files from distro subdirectory when configuring build action
scareything May 4, 2023
0a5e511
Adjusts systemd unit directory for older Ubuntu distribution packages.
sabedevops May 5, 2023
638c86d
Reverts to static path for systemd unit dir.
sabedevops May 5, 2023
ed83643
Merge pull request #647 from openziti/hotfix/package-regression-pr-622
scareything May 5, 2023
3d5bbe1
don't use older versions of systemd-sysusers
scareything May 8, 2023
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
14 changes: 8 additions & 6 deletions .github/actions/openziti-tunnel-build-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@
type: rpm
container: docker.io/library/rockylinux:8

steps:
- name: configure build action for distro version
env:
DISTRO_LABEL: ${{ format('{0}:{1}', matrix.distro.name, matrix.distro.version) }}
DISTRO_LABEL: ${{ format('{0}-{1}', matrix.distro.name, matrix.distro.version) }}
shell: bash
run: |
for FILE in Dockerfile entrypoint.sh; do
mv -v ./.github/actions/openziti-tunnel-build-action/${FILE}.${DISTRO_LABEL} \
./.github/actions/openziti-tunnel-build-action/${FILE}
done
mv -v ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/

- name: build cmake target "package"
# entrypoint.sh uses the value of arch to select the cmake preset
- name: build binary and package
uses: ./.github/actions/openziti-tunnel-build-action
with:
arch: ${{ matrix.arch.cmake }}
config: Release

- name: run binary artifact
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/openziti-tunnel-build-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ description: 'Builds ziti-edge-tunnel binary and install package for Linux'
author: 'NetFoundry'
inputs:
arch:
description: 'The architecture string used by entrypoint.sh to select CMAKE_TOOLCHAIN_FILE'
description: 'The cmake preset used by entrypoint.sh when running cmake'
required: false
config:
description: 'The cmake build configuration used by entrypoint.sh when running cmake'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.arch }}
- ${{ inputs.config }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CMAKE_VERSION="3.22.3"
ARG CMAKE_VERSION="3.26.3"

FROM docker.io/library/centos:7

Expand All @@ -20,14 +20,27 @@ RUN yum -y install \
graphviz \
python3 \
zlib-devel \
epel-release \
&& yum -y install \
devtoolset-11 \
devtoolset-11-libatomic-devel \
ninja-build \
&& yum clean all

# needed only to build openssl. we can't use openssl from rocky's repos because it is too old.
RUN yum install -y perl-IPC-Cmd

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 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

COPY ./entrypoint.sh /root/
ENTRYPOINT [ "/root/entrypoint.sh" ]
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,18 @@ 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 toolchain file, else default toolchain
if (( ${#} )); then
case ${1} in
amd64) CMAKE_TOOLCHAIN_FILE="default.cmake"
shift
;;
arm64) CMAKE_TOOLCHAIN_FILE="Linux-arm64.cmake"
shift
;;
arm) CMAKE_TOOLCHAIN_FILE="Linux-arm.cmake"
shift
;;
*) CMAKE_TOOLCHAIN_FILE="default.cmake"
;;
esac
# 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 [ -n "${1}" ]; then
cmake_preset="${1}"
else
CMAKE_TOOLCHAIN_FILE="default.cmake"
cmake_preset="ci-linux-x64"
fi

if [ -n "${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.
Expand All @@ -49,21 +44,17 @@ cmake -E make_directory ./build
set +u
source scl_source enable devtoolset-11 \
&& cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=./toolchains/${CMAKE_TOOLCHAIN_FILE} \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DBUILD_DIST_PACKAGES=ON \
-DDISABLE_LIBSYSTEMD_FEATURE=ON \
-DVCPKG_OVERLAY_PORTS="./vcpkg-overlays/linux-syslibs/redhat7" \
-S . \
-B ./build
source scl_source enable devtoolset-11 \
&& cmake \
--build ./build \
--config "${cmake_config}" \
--target package \
--verbose
)

if (( ${#} )); then
echo "INFO: running ziti-edge-tunnel"
set -x
./build/programs/ziti-edge-tunnel/ziti-edge-tunnel ${@}
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CMAKE_VERSION="3.22.3"
ARG CMAKE_VERSION="3.26.3"

FROM rockylinux:8

Expand Down Expand Up @@ -30,12 +30,21 @@ RUN 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 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

WORKDIR /github/workspace
COPY ./entrypoint.sh /root/
ENTRYPOINT [ "/root/entrypoint.sh" ]
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,18 @@ 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 toolchain file, else default toolchain
if (( ${#} )); then
case ${1} in
amd64) CMAKE_TOOLCHAIN_FILE="default.cmake"
shift
;;
arm64) CMAKE_TOOLCHAIN_FILE="Linux-arm64.cmake"
shift
;;
arm) CMAKE_TOOLCHAIN_FILE="Linux-arm.cmake"
shift
;;
*) CMAKE_TOOLCHAIN_FILE="default.cmake"
;;
esac
# 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_TOOLCHAIN_FILE="default.cmake"
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.
Expand All @@ -49,21 +44,16 @@ cmake -E make_directory ./build
set +u
source scl_source enable gcc-toolset-10 \
&& cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=./toolchains/${CMAKE_TOOLCHAIN_FILE} \
--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 \
&& cmake \
--build ./build \
--config "${cmake_config}" \
--target package \
--verbose
)

if (( ${#} )); then
echo "INFO: running ziti-edge-tunnel"
set -x
./build/programs/ziti-edge-tunnel/ziti-edge-tunnel ${@}
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CMAKE_VERSION="3.22.3"
ARG CMAKE_VERSION="3.26.3"

FROM ubuntu:trusty

Expand All @@ -19,14 +19,17 @@ RUN apt-get -y update \
&& apt-get -y install \
build-essential \
curl \
zip \
unzip \
tar \
doxygen \
git \
graphviz \
iproute2 \
pkg-config \
python3 \
software-properties-common \
zlib1g-dev \
ninja-build \
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& apt-get -y update \
&& apt-get -y install \
Expand All @@ -43,6 +46,15 @@ RUN curl -sSfL https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSIO
&& (bash cmake.sh --skip-license --prefix=/usr/local) \
&& rm cmake.sh

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 config --global advice.detachedHead false \
&& git clone --branch 2023.04.15 https://github.com/microsoft/vcpkg \
&& ./vcpkg/bootstrap-vcpkg.sh -disableMetrics

WORKDIR /github/workspace
COPY ./entrypoint.sh /root/
ENTRYPOINT [ "/root/entrypoint.sh" ]
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,18 @@ 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 toolchain file, else default toolchain
if (( ${#} )); then
case ${1} in
amd64) CMAKE_TOOLCHAIN_FILE="default.cmake"
shift
;;
arm64) CMAKE_TOOLCHAIN_FILE="Linux-arm64.cmake"
shift
;;
arm) CMAKE_TOOLCHAIN_FILE="Linux-arm.cmake"
shift
;;
*) CMAKE_TOOLCHAIN_FILE="default.cmake"
;;
esac
# 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 [ -n "${1}" ]; then
cmake_preset="${1}"
else
CMAKE_TOOLCHAIN_FILE="default.cmake"
cmake_preset="ci-linux-x64"
fi

if [ -n "${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.
Expand All @@ -44,19 +39,15 @@ done
[[ -d ./build ]] && rm -r ./build
cmake -E make_directory ./build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=./toolchains/${CMAKE_TOOLCHAIN_FILE} \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DBUILD_DIST_PACKAGES=ON \
-DDISABLE_LIBSYSTEMD_FEATURE=ON \
-DVCPKG_OVERLAY_PORTS="./vcpkg-overlays/linux-syslibs/ubuntu14" \
-S . \
-B ./build
cmake \
--build ./build \
--config "${cmake_config}" \
--target package \
--verbose

if (( ${#} )); then
echo "INFO: running ziti-edge-tunnel"
set -x
./build/programs/ziti-edge-tunnel/ziti-edge-tunnel ${@}
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CMAKE_VERSION="3.22.3"
ARG CMAKE_VERSION="3.26.3"

FROM ubuntu:xenial

Expand All @@ -19,19 +19,31 @@ RUN apt-get -y update \
&& apt-get -y install \
build-essential \
curl \
zip \
unzip \
tar \
doxygen \
git \
graphviz \
iproute2 \
pkg-config \
python3 \
zlib1g-dev \
ninja-build \
&& rm -rf /var/lib/apt/lists/*

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 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 config --global advice.detachedHead false \
&& git clone --branch 2023.04.15 https://github.com/microsoft/vcpkg \
&& ./vcpkg/bootstrap-vcpkg.sh -disableMetrics

WORKDIR /github/workspace
COPY ./entrypoint.sh /root/
ENTRYPOINT [ "/root/entrypoint.sh" ]
Loading
Loading