Skip to content
Snippets Groups Projects
Commit d5ea640c authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge branch 'build-simplification' into 'develop'

chore(ci): build simplification

See merge request !7
parents ed46811e 1d1773ab
No related branches found
No related tags found
1 merge request!7chore(ci): build simplification
Pipeline #32281 passed
Showing with 310 additions and 241 deletions
......@@ -37,7 +37,7 @@ case "$OS_DISTRO" in
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
esac
IS_CONTAINER=`egrep -c "docker|podman|kubepods|libpod|buildah" /proc/self/cgroup || true`
IS_CONTAINER=`egrep -c "docker|kubepods|podman|buildah|libpod" /proc/self/cgroup || true`
IS_DOCKERBUILD=${IS_DOCKERFILE:-0}
if [ $IS_CONTAINER -eq 0 ] && [ $IS_DOCKERBUILD -eq 0 ]
......@@ -127,6 +127,8 @@ check_supported_distribution() {
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
"ubuntu22.04") return 0 ;;
"rhel8") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
......@@ -162,7 +164,10 @@ clean_kernel() {
#-------------------------------------------------------------------------------
disable_ipv6() {
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
if [ $IS_CONTAINER -eq 0 ]
then
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
fi
}
......@@ -285,12 +290,12 @@ update_package_db() {
check_enable_epel_repos() {
# on Enterprise Linuxes, ensure EPEL repos are installed
# (provides: libidn2-devel, vconfig, iperf, phpMyAdmin, dkms, ...)
if [[ "$OS_DISTRO" == "rhel" ]]; then
if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
if rpm -q epel-release > /dev/null; then
echo "EPEL repos already present. Good."
else
echo "EPEL repos not present. Installing them."
$SUDO $INSTALLER install $OPTION https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$SUDO $INSTALLER install $OPTION https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
fi
fi
}
......
......@@ -30,44 +30,7 @@
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
source $THIS_SCRIPT_PATH/build_helper.libconfig
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fmt() {
echo "Starting to install fmt"
if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
echo "Install fmt from source"
if [[ $prompt =~ [yY](es)* ]]
then
cd /tmp
echo "Downloading fmt"
$SUDO rm -rf /tmp/fmt*
git clone https://github.com/fmtlib/fmt.git
ret=$?;[[ $ret -ne 0 ]] && return $ret
cd fmt
# Looks like since Nov 11 commits, we cannot build
git checkout -f 1936dddc3c53c1c0db55a665cf419dc7a257ba62
$CMAKE -DFMT_TEST=FALSE .
ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc`
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO make install
cd /tmp
rm -rf /tmp/fmt*
fi
echo "fmt installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -140,25 +103,26 @@ install_pistache_from_git() {
fi
git clone $GIT_URL
git submodule update --init
cd pistache && git checkout e18ed9baeb2145af6f9ea41246cf48054ffd9907
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \
-DPISTACHE_BUILD_EXAMPLES=false \
-DPISTACHE_BUILD_TESTS=false \
-DPISTACHE_BUILD_DOCS=false \
..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
rm -Rf $OPENAIRCN_DIR/build/ext/pistache/_build
fi
echo "pistache installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -190,7 +154,6 @@ install_nlohmann_from_git() {
fi
git clone $GIT_URL
git submodule update --init
cd json && git checkout -f v3.10.3
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
......@@ -201,6 +164,7 @@ install_nlohmann_from_git() {
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
rm -Rf $OPENAIRCN_DIR/build/ext/json/_build
fi
echo "Nlohmann Json installation complete"
return 0
......@@ -241,7 +205,7 @@ install_nghttp2_from_git() {
libcunit1-dev \
libssl-dev \
libxml2-dev libev-dev libevent-dev libjansson-dev libc-ares-dev \
libjemalloc-dev libsystemd-dev cython python3-dev python-setuptools"
libjemalloc-dev libsystemd-dev python3-dev python-setuptools"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gcc-c++ \
......@@ -255,14 +219,13 @@ install_nghttp2_from_git() {
zlib-devel \
CUnit-devel \
openssl-devel \
boost-devel \
libxml2-devel libev-devel libevent-devel jansson-devel c-ares-devel \
jemalloc-devel systemd-devel python3-Cython python3-devel python3-setuptools"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
GIT_URL=https://github.com/nghttp2/nghttp2.git
......@@ -285,96 +248,26 @@ install_nghttp2_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
autoconf
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
./configure --enable-asio-lib
./configure --enable-asio-lib --enable-lib-only
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo "nghttp2 installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_cpp_jwt_from_git() {
echo "Starting to install cpp_jwt"
if [ $1 -eq 0 ]; then
read -p "Do you want to install CPP-JWT ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
libgtest-dev \
libssl-dev"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gtest-devel \
openssl-devel"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
#install libgtest
if [[ $OS_DISTRO == "ubuntu" ]]; then
echo "Building the gtest library"
pushd $OPENAIRCN_DIR/build/ext
cd /usr/src/gtest
$SUDO $CMAKE CMakeLists.txt
$SUDO make
$SUDO cp *.a /usr/lib
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
GIT_URL=https://github.com/arun11299/cpp-jwt.git
echo "Install Cpp-jwt from $GIT_URL"
pushd $OPENAIRCN_DIR/build/ext
echo "Downloading CPP-JWT"
if [[ $prompt =~ [yY](es)* ]]
then
$SUDO rm -rf cpp-jwt
fi
git clone $GIT_URL
cd cpp-jwt && git checkout -f v1.4
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
$CMAKE ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
$SUDO ldconfig
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
git clean -x -d -ff .
popd
fi
echo "cpp_jwt installation complete"
echo "nghttp2 installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_libyaml_cpp_from_git() {
# For Ubuntu 2x and RHEL we should install from repo.
echo "Starting to install libyaml_cpp"
if [ $1 -eq 0 ]; then
read -p "Do you want to install yaml_cpp ? <y/N> " prompt
......@@ -405,13 +298,14 @@ install_libyaml_cpp_from_git() {
cd yaml-cpp && git checkout master
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
$CMAKE -G "Unix Makefiles" -DYAML_BUILD_SHARED_LIBS=on ..
$CMAKE -G "Unix Makefiles" -DYAML_BUILD_SHARED_LIBS=on -DYAML_CPP_BUILD_TESTS=off ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
rm -Rf $OPENAIRCN_DIR/build/ext/yaml-cpp/_build
fi
echo "yaml-cpp installation complete"
return 0
......@@ -445,7 +339,9 @@ check_install_pcf_deps() {
#$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
if [ $IS_CONTAINER -eq 0 ]; then
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi
fi
update_package_db
......@@ -458,24 +354,16 @@ check_install_pcf_deps() {
PACKAGE_LIST="\
autoconf \
automake \
bison \
build-essential \
$CMAKE \
daemon \
doxygen \
flex \
gdb \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
autoconf \
automake \
bison \
gcc-c++ \
$CMAKE \
make \
doxygen \
flex \
gdb \
git"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
......@@ -488,46 +376,45 @@ check_install_pcf_deps() {
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
# Currently Ubuntu18.04 has boost 1.65 as the latest
# Currently Ubuntu18.04 has boost 1.65 as the latest
# We need at least 1.66
# PPA has 1.67
$SUDO $INSTALLER install $OPTION software-properties-common
$SUDO add-apt-repository ppa:mhier/libboost-latest --yes
$SUDO $INSTALLER update
specific_packages="libconfig++-dev libboost1.67-dev"
;;
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan4"
;;
"ubuntu20.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan5"
;;
"ubuntu22.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan6"
;;
esac
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
libgcrypt11-dev \
libgmp-dev \
libhogweed? \
libidn2-0-dev \
libidn11-dev \
libpthread-stubs0-dev \
libssl-dev \
libtool \
libxml2 \
libxml2-dev \
openssl \
python \
nettle-dev \
libcurl4 \
net-tools \
pkg-config"
pkg-config \
libasan?"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
guile-devel \
libconfig-devel \
libgcrypt-devel \
gmp-devel \
boost-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
libtool \
libxml2 \
......@@ -537,32 +424,58 @@ check_install_pcf_deps() {
nettle-devel \
libcurl-devel \
python2 \
pkgconfig"
pkgconfig \
ninja-build \
boost-devel \
libasan"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
# fix issue with libboost in U18 for a bare metal deployment
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
$SUDO $INSTALLER remove $OPTION libboost1.65-dev || true
$SUDO $INSTALLER autoremove $OPTION || true
$SUDO $INSTALLER install $OPTION libboost1.67-dev
;;
esac
fi
ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete"
install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_nghttp2_from_git $1 $2
install_pistache_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_nlohmann_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
#install_cpp_jwt_from_git $1 $2
#ret=$?;[[ $ret -ne 0 ]] && return $ret
install_pistache_from_git $1 $2
install_nghttp2_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_libyaml_cpp_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
install_libyaml_cpp_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
;;
"ubuntu20.04")
$SUDO $INSTALLER install $OPTION libyaml-cpp0.6 libyaml-cpp-dev
;;
"ubuntu22.04")
$SUDO $INSTALLER install $OPTION libyaml-cpp0.7 libyaml-cpp-dev
;;
esac
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION yaml-cpp yaml-cpp-devel
fi
$SUDO ldconfig
return 0
......
......@@ -194,7 +194,7 @@ pipeline {
echo "Maybe a previous build went wrong"
}
// In case of push to `develop` branch we build from scratch
myShCmd('docker build --no-cache --target oai-pcf --tag oai-pcf:' + pcf_tag + ' --file docker/Dockerfile.pcf.ubuntu18 . > archives/pcf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-pcf --tag oai-pcf:' + pcf_tag + ' --file docker/Dockerfile.pcf.ubuntu . > archives/pcf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
if ("MERGE".equals(env.gitlabActionType)) {
try {
......@@ -259,7 +259,7 @@ pipeline {
myShCmd('cp /etc/pki/entitlement/*pem ./etc-pki-entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo cp /etc/rhsm/rhsm.conf ./rhsm-conf', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo cp /etc/rhsm/ca/*pem ./rhsm-ca', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman build --no-cache --target oai-pcf --tag oai-pcf:' + pcf_tag + ' --file docker/Dockerfile.pcf.rhel8 . > archives/pcf_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman build --no-cache --target oai-pcf --tag oai-pcf:' + pcf_tag + ' --file docker/Dockerfile.pcf.rhel8 --format docker . > archives/pcf_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
// Putting a place holder to try out on the flattening of image.
// If not satisfactory, we can remove it.
myShCmd('python3 ./ci-scripts/flatten_image.py --tag oai-pcf:' + pcf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
......
......@@ -205,4 +205,4 @@ echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT over $NB_TOTAL checke
echo "NB_FILES_FAILING_CHECK=$NB_TO_FORMAT" > ./oai_rules_result.txt
echo "NB_FILES_CHECKED=$NB_TOTAL" >> ./oai_rules_result.txt
exit 0
if [ $NB_TO_FORMAT -ne 0 ]; then exit -1; else exit 0; fi
......@@ -28,6 +28,7 @@
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
ARG BASE_IMAGE=ubuntu:bionic
FROM oai-pcf-base:latest as oai-pcf-builder
# Copying source code
......@@ -35,16 +36,17 @@ WORKDIR /openair-pcf
COPY . /openair-pcf
RUN cp -Rf /openair-pcf-ext-ref /openair-pcf/build/ext
# Installing and Building PCF
# Building PCF
WORKDIR /openair-pcf/build/scripts
RUN ./build_pcf --clean --Verbose --build-type Release --jobs && \
RUN ldconfig && \
./build_pcf --clean --Verbose --build-type Release --jobs && \
ldd /openair-pcf/build/pcf/build/pcf && \
mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-pcf
FROM $BASE_IMAGE as oai-pcf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
......@@ -55,32 +57,45 @@ RUN apt-get update && \
net-tools \
tzdata \
bc \
libldap-2.4-2 \
libkrb5-3 \
libgssapi-krb5-2 \
openssl \
libasan4 \
&& rm -rf /var/lib/apt/lists/*
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
libasan? \
libconfig++9v5 \
# Ubuntu 18 --> boost62/65 -> will remove both
# Ubuntu 20 --> boost67/71 -> will remove 67
# Ubuntu 22 --> boost74
libboost-filesystem1.??.0 \
libcurl?-gnutls \
librtmp1 \
libpsl5 \
# Ubuntu 18 --> won't install anything
# Ubuntu 20 --> libyaml-cpp 0.6
# Ubuntu 22 --> libyaml-cpp 0.7
libyaml-cpp0.? \
&& rm -rf /var/lib/apt/lists/* \
/lib/x86_64-linux-gnu/libboost_system.so.1.6*.0 \
/lib/x86_64-linux-gnu/ibboost_filesystem.so.1.6*.0
# Copying executable and generated libraries
WORKDIR /openair-pcf/bin
COPY --from=oai-pcf-builder \
/openair-pcf/build/pcf/build/oai_pcf \
/openair-pcf/scripts/entrypoint.sh \
/openair-pcf/scripts/healthcheck.sh \
./
WORKDIR /usr/local/lib/
COPY --from=oai-pcf-builder \
/usr/lib/libboost_system.so.1.67.0 \
/usr/lib/libboost_filesystem.so.1.67.0 \
# Copying only the packages built from source
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/local/lib/libyaml-cpp.so.0.7 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/librtmp.so.1 \
/usr/lib/x86_64-linux-gnu/libpsl.so.5 \
/usr/lib/x86_64-linux-gnu/libconfig++.so.9 \
/usr/local/lib/libyaml-cpp.so.0.? \
# Ubuntu 18 --> boost 67 will be copied
/usr/lib/libboost_system.so.1.* \
/usr/lib/libboost_filesystem.so.1.* \
./
RUN ldconfig && \
......@@ -96,6 +111,11 @@ COPY --from=oai-pcf-builder \
WORKDIR /openair-pcf
EXPOSE 80/tcp 8080/tcp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-pcf/bin/healthcheck.sh
ENTRYPOINT ["/bin/bash","/openair-pcf/bin/entrypoint.sh"]
CMD ["/openair-pcf/bin/oai_pcf", "-c", "/openair-pcf/etc/pcf.conf", "-o"]
......@@ -36,7 +36,7 @@ def _parse_args() -> argparse.Namespace:
'--tag', '-t',
action='store',
required=True,
help='Image Tag in image-name:image tag format',
help='Image Tag in image-name:image-tag format',
)
return parser.parse_args()
......@@ -49,6 +49,9 @@ def perform_flattening(tag):
if re.search('podman', podman_check.strip()):
cli = 'sudo podman'
image_prefix = 'localhost/'
# since HEALTHCHECK is not supported by podman import
# we don't flatten
return 0
if cli == '':
cmd = 'which docker || true'
docker_check = subprocess.check_output(cmd, shell=True, universal_newlines=True)
......@@ -74,6 +77,7 @@ def perform_flattening(tag):
cmd += ' --change "WORKDIR /openair-pcf" '
cmd += ' --change "EXPOSE 80/tcp" '
cmd += ' --change "EXPOSE 9090/tcp" '
cmd += ' --change "HEALTHCHECK --interval=10s --timeout=15s --retries=6 CMD /openair-pcf/bin/healthcheck.sh" '
cmd += ' --change "CMD [\\"/openair-pcf/bin/oai_pcf\\", \\"-c\\", \\"/openair-pcf/etc/pcf.conf\\", \\"-o\\"]" '
cmd += ' --change "ENTRYPOINT [\\"/bin/bash\\", \\"/openair-pcf/bin/entrypoint.sh\\"]" '
cmd += ' - ' + image_prefix + tag
......
......@@ -195,7 +195,7 @@ class HtmlReport():
self.file.write(' <strong>All files in repository follow OAI rules. <span class="glyphicon glyphicon-ok-circle"></span> -> (' + nb_total.strip() + ' were checked)</strong>\n')
self.file.write(' </div>\n')
else:
self.file.write(' <div class="alert alert-warning">\n')
self.file.write(' <div class="alert alert-danger">\n')
if self.git_pull_request:
self.file.write(' <strong>' + nb_fail.strip() + ' modified files in Pull-Request DO NOT follow OAI rules. <span class="glyphicon glyphicon-warning-sign"></span> -> (' + nb_total.strip() + ' were checked)</strong>\n')
else:
......@@ -590,7 +590,7 @@ class HtmlReport():
status = False
if nfType == 'PCF':
section_start_pattern = 'build_pcf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-pcf$'
section_end_pattern = 'FROM .* as oai-pcf$'
pass_pattern = 'pcf installed'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
......@@ -638,7 +638,7 @@ class HtmlReport():
if os.path.isfile(cwd + '/archives/' + logFileName):
if nfType == 'PCF':
section_start_pattern = 'build_pcf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-pcf$'
section_end_pattern = 'FROM .* as oai-pcf$'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
......
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
---
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
name: "oai-pcf"
namespace: oaicicd-core
spec:
runPolicy: "Serial"
source:
type: "Binary"
secrets:
- secret:
name: etc-pki-entitlement
destinationDir: etc-pki-entitlement
configMaps:
- configMap:
name: rhsm-conf
destinationDir: rhsm-conf
- configMap:
name: rhsm-ca
destinationDir: rhsm-ca
strategy:
dockerStrategy:
dockerfilePath: "docker/Dockerfile.pcf.rhel8"
output:
to:
kind: "ImageStreamTag"
name: "oai-pcf:develop"
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: oai-pcf
namespace: oaicicd-core
spec:
lookupPolicy:
local: true
status:
tag: develop
......@@ -21,7 +21,7 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface PCF service
# Valid for RHEL 8.2
# Valid for UBI 8.6 | RHEL 8.6
#
#---------------------------------------------------------------------
......@@ -30,8 +30,6 @@
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-pcf-builder
ARG NEEDED_GIT_PROXY
ENV IS_DOCKERFILE=1
# Copy the entitlements
......@@ -49,13 +47,14 @@ RUN rm -f /etc/rhsm-host && \
psmisc \
git \
diffutils \
libasan \
file && \
yum clean all -y
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
# Copying source code
WORKDIR /openair-pcf
......@@ -63,45 +62,65 @@ COPY . /openair-pcf
# Installing and Building PCF
WORKDIR /openair-pcf/build/scripts
RUN ./build_pcf --install-deps --force && \
ldconfig -v && \
rm /etc/pki/entitlement/*pem
RUN ./build_pcf --clean --Verbose --build-type Release --jobs && \
RUN ./build_pcf --install-deps --force
RUN ldconfig && \
./build_pcf --clean --Verbose --build-type Release --jobs && \
ldd /openair-pcf/build/pcf/build/pcf && \
mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf
mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf && \
# Remove entitlements and Subscription Manager configs
rm -rf /etc/pki/entitlement && \
rm -rf /etc/rhsm
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-pcf
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as oai-pcf
ENV TZ=Europe/Paris
# Copy the entitlements
COPY ./etc-pki-entitlement /etc/pki/entitlement
# Copy the subscription manager configurations
COPY ./rhsm-conf /etc/rhsm
COPY ./rhsm-ca /etc/rhsm/ca
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \
yum install -y --enablerepo="ubi-8-codeready-builder" \
psmisc \
RUN rm -f /etc/rhsm-host && \
microdnf update -y && \
microdnf install -y \
tzdata \
libasan \
procps-ng \
psmisc \
net-tools \
libevent && \
yum clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
libicu \
boost \
libevent \
findutils \
libconfig && \
microdnf clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf && \
# Remove entitlements and Subscription Manager configs
rm -rf /etc/pki/entitlement && \
rm -rf /etc/rhsm
# Copying executable and generated libraries
WORKDIR /openair-pcf/bin
COPY --from=oai-pcf-builder \
/openair-pcf/build/pcf/build/oai_pcf \
/openair-pcf/scripts/entrypoint.sh \
/openair-pcf/scripts/healthcheck.sh \
./
COPY --from=oai-pcf-builder \
# Copying only the packages built from source
/usr/local/lib64/libpistache.so.0 \
/usr/local/lib/libnghttp2_asio.so \
/usr/local/lib64/libyaml-cpp.so.0.7 \
/usr/lib64/libconfig++.so.9 \
/usr/lib64/libboost_system.so.1.66.0 \
/usr/lib64/libboost_filesystem.so.1.66.0 \
/usr/lib64/libboost_thread.so.1.66.0 \
/usr/lib64/libboost_chrono.so.1.66.0 \
/usr/local/lib/libnghttp2_asio.so.1 \
# libyaml-cpp is installed via epel-8
# and epel-8 cannot be installed on ubi-minimal
/lib64/libyaml-cpp.so.0.6 \
/usr/lib64/
RUN ldconfig && \
......@@ -118,6 +137,11 @@ WORKDIR /openair-pcf
# expose ports
EXPOSE 80/tcp 8080/tcp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-pcf/bin/healthcheck.sh
ENTRYPOINT ["/openair-pcf/bin/entrypoint.sh"]
CMD ["/openair-pcf/bin/oai_pcf", "-c", "/openair-pcf/etc/pcf.conf", "-o"]
......@@ -26,44 +26,47 @@
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
# BASE IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-pcf-builder
ARG NEEDED_GIT_PROXY
ARG BASE_IMAGE=ubuntu:bionic
FROM $BASE_IMAGE as oai-pcf-base
ENV DEBIAN_FRONTEND=noninteractive
ENV IS_DOCKERFILE=1
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
software-properties-common \
gnupg \
git && \
rm -rf /var/lib/apt/lists/*
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi" && \
git config --global https.postBuffer 123289600 && \
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
# Copying source code
WORKDIR /openair-pcf
COPY . /openair-pcf
# Installing and Building PCF
# Installing all the needed libraries/packages to build and run NSSF
WORKDIR /openair-pcf/build/scripts
RUN ./build_pcf --install-deps --force
RUN ./build_pcf --clean --Verbose --build-type Release --jobs && \
RUN ./build_pcf --install-deps --force && \
cp -Rf /openair-pcf/build/ext /openair-pcf-ext-ref
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM oai-pcf-base as oai-pcf-builder
# Building PCF
RUN ldconfig && \
./build_pcf --clean --Verbose --build-type Release --jobs && \
ldd /openair-pcf/build/pcf/build/pcf && \
mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-pcf
FROM $BASE_IMAGE as oai-pcf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
......@@ -74,32 +77,45 @@ RUN apt-get update && \
net-tools \
tzdata \
bc \
libldap-2.4-2 \
libkrb5-3 \
libgssapi-krb5-2 \
openssl \
libasan4 \
&& rm -rf /var/lib/apt/lists/*
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
libasan? \
libconfig++9v5 \
# Ubuntu 18 --> boost62/65 -> will remove both
# Ubuntu 20 --> boost67/71 -> will remove 67
# Ubuntu 22 --> boost74
libboost-filesystem1.??.0 \
libcurl?-gnutls \
librtmp1 \
libpsl5 \
# Ubuntu 18 --> won't install anything
# Ubuntu 20 --> libyaml-cpp 0.6
# Ubuntu 22 --> libyaml-cpp 0.7
libyaml-cpp0.? \
&& rm -rf /var/lib/apt/lists/* \
/lib/x86_64-linux-gnu/libboost_system.so.1.6*.0 \
/lib/x86_64-linux-gnu/ibboost_filesystem.so.1.6*.0
# Copying executable and generated libraries
WORKDIR /openair-pcf/bin
COPY --from=oai-pcf-builder \
/openair-pcf/build/pcf/build/oai_pcf \
/openair-pcf/scripts/entrypoint.sh \
/openair-pcf/scripts/healthcheck.sh \
./
WORKDIR /usr/local/lib/
COPY --from=oai-pcf-builder \
/usr/lib/libboost_system.so.1.67.0 \
/usr/lib/libboost_filesystem.so.1.67.0 \
# Copying only the packages built from source
/usr/local/lib/libpistache.so \
/usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/local/lib/libyaml-cpp.so.0.7 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/librtmp.so.1 \
/usr/lib/x86_64-linux-gnu/libpsl.so.5 \
/usr/lib/x86_64-linux-gnu/libconfig++.so.9 \
/usr/local/lib/libyaml-cpp.so.0.? \
# Ubuntu 18 --> boost 67 will be copied
/usr/lib/libboost_system.so.1.* \
/usr/lib/libboost_filesystem.so.1.* \
./
RUN ldconfig && \
......@@ -115,6 +131,11 @@ COPY --from=oai-pcf-builder \
WORKDIR /openair-pcf
EXPOSE 80/tcp 8080/tcp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-pcf/bin/healthcheck.sh
ENTRYPOINT ["/bin/bash","/openair-pcf/bin/entrypoint.sh"]
CMD ["/openair-pcf/bin/oai_pcf", "-c", "/openair-pcf/etc/pcf.conf", "-o"]
#!/bin/bash
set -eo pipefail
pgrep oai_pcf
......@@ -291,9 +291,5 @@ IF(STATIC_LINKING)
SET(ASAN)
ENDIF(STATIC_LINKING)
# folly glog dl double-conversion for FB folly library
# target_link_libraries (pcf ${ASAN} -Wl,--start-group CN_UTILS PCF PCF_API 3GPP_COMMON_TYPES ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto dl -Wl,--end-group
# pthread m rt config++ event boost_system pistache curl -lyaml-cpp )
target_link_libraries (pcf ${ASAN} -Wl,--start-group CN_UTILS PCF PCF_API 3GPP_COMMON_TYPES ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto dl -Wl,--end-group
pthread m rt config++ event boost_system -lboost_filesystem pistache curl -lyaml-cpp)
\ No newline at end of file
pthread m rt config++ event boost_system -lboost_filesystem pistache curl -lyaml-cpp)
......@@ -47,7 +47,7 @@ class pcf_client {
pcf_client(pcf_client const&) = delete;
static long curl_http_client(
std::string remoteUri, std::string method, std::string& response,
std::string msgBody = {});
std::string msgBody);
};
} // namespace app
} // namespace pcf
......
......@@ -42,7 +42,7 @@
using namespace oai::pcf::app;
using namespace oai::pcf::config;
using namespace oai::pcf::model;
using namespace boost::placeholders;
using namespace std;
extern pcf_nrf* pcf_nrf_inst;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment