Commit 49ef8a45 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'add-rhel8-build' into 'develop'

DOCKER/CI: adding RHEL8 dockerfile and build stage in pipeline

See merge request oai/cn5g/oai-cn5g-ausf!4
parents 91a167fc 215f1025
......@@ -224,7 +224,7 @@ install_nghttp2_from_git() {
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
g++ \
cmake \
$CMAKE \
binutils \
autoconf \
automake \
......@@ -330,7 +330,7 @@ check_install_ausf_deps() {
automake \
bison \
build-essential \
cmake \
$CMAKE \
daemon \
doxygen \
flex \
......@@ -340,6 +340,7 @@ check_install_ausf_deps() {
PACKAGE_LIST="\
autoconf \
automake \
make \
bison \
$CMAKE \
doxygen \
......
......@@ -64,7 +64,7 @@ pipeline {
gitLabConnection('OAI GitLab')
gitlabBuilds(builds: [
"Build U18 AUSF Image",
//"Build RHEL8 AUSF Image",
"Build RHEL8 AUSF Image",
"Static Code Analysis",
"Code Formatting Checker" //,
//"Test with DsTester"
......@@ -214,6 +214,52 @@ pipeline {
}
}
}
stage ('Build RHEL8 AUSF Image') {
when { expression {rem_rhel_host_flag} }
steps {
lock (rem_rhel8_resource) {
script {
gitlabCommitStatus(name: "Build RHEL8 AUSF Image") {
if ("PUSH".equals(env.gitlabActionType)) {
// Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry
try {
myShCmd('sudo podman image rm oai-ausf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
} catch (Exception e) {
echo "Maybe a previous build went wrong"
}
} else {
// In case we forgot during a previous run
myShCmd('sudo podman image rm oai-ausf:' + ausf_tag + ' || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
}
myShCmd('sudo podman image prune --force', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
// Copy the RHEL Host certificates for building
myShCmd('mkdir -p tmp/ca tmp/entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('cp /etc/pki/entitlement/*pem tmp/entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman build --no-cache --target oai-ausf --tag oai-ausf:' + ausf_tag + ' --file docker/Dockerfile.ausf.rhel8 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > archives/ausf_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image ls >> archives/ausf_podman_image_build.log', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('sudo podman image tag oai-ausf:' + ausf_tag + ' oai-ausf:' + rhel_ausf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
}
}
}
}
}
post {
always {
script {
copyFrom2ndServer('archives/ausf_podman_image_build.log', 'archives', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
}
}
success {
sh "echo 'OAI-AUSF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/ausf_podman_image_build.log"
}
unsuccessful {
sh "echo 'OAI-AUSF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/ausf_podman_image_build.log"
}
}
}
// Running CPPCHECK in parallel to gain time
stage ('Static Code Analysis') {
steps {
......
......@@ -372,7 +372,7 @@ class HtmlReport():
self.file.write(' <th>Stage Name</th>\n')
self.file.write(' <th>Image Kind</th>\n')
self.file.write(' <th>OAI AUSF <font color="Gold">Ubuntu18</font> Image</th>\n')
#self.file.write(' <th>OAI AUSF <font color="Gold">RHEL8</font> Image</th>\n')
self.file.write(' <th>OAI AUSF <font color="Gold">RHEL8</font> Image</th>\n')
self.file.write(' </tr>\n')
def buildSummaryFooter(self):
......@@ -408,8 +408,7 @@ class HtmlReport():
self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd()
#variants = ['docker', 'podman']
variants = ['docker']
variants = ['docker', 'podman']
for variant in variants:
logFileName = 'ausf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName):
......@@ -457,8 +456,7 @@ class HtmlReport():
self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd()
#variants = ['docker', 'podman']
variants = ['docker']
variants = ['docker', 'podman']
for variant in variants:
logFileName = 'ausf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName):
......@@ -568,8 +566,7 @@ class HtmlReport():
if imageKind:
self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd()
#variants = ['docker', 'podman']
variants = ['docker']
variants = ['docker', 'podman']
for variant in variants:
logFileName = 'ausf_' + variant + '_image_build.log'
......@@ -577,7 +574,7 @@ class HtmlReport():
status = False
if nfType == 'AUSF':
section_start_pattern = 'build_ausf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-ausf$'
section_end_pattern = '[aA][sS] oai-ausf$'
pass_pattern = 'ausf installed'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
......@@ -619,8 +616,7 @@ class HtmlReport():
self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd()
#variants = ['docker', 'podman']
variants = ['docker']
variants = ['docker', 'podman']
for variant in variants:
logFileName = 'ausf_' + variant + '_image_build.log'
nb_errors = 0
......@@ -628,7 +624,7 @@ class HtmlReport():
if os.path.isfile(cwd + '/archives/' + logFileName):
if nfType == 'AUSF':
section_start_pattern = 'build_ausf --clean --Verbose --build-type Release --jobs'
section_end_pattern = 'FROM ubuntu:bionic as oai-ausf$'
section_end_pattern = '[aA][sS] oai-ausf$'
section_status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
......@@ -687,12 +683,11 @@ class HtmlReport():
self.file.write(' <td>Target Image</td>\n')
cwd = os.getcwd()
#variants = ['docker', 'podman']
variants = ['docker']
variants = ['docker', 'podman']
for variant in variants:
logFileName = 'ausf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = 'FROM ubuntu:bionic as oai-ausf$'
section_start_pattern = '[aA][sS] oai-ausf$'
section_end_pattern = 'WORKDIR /openair-ausf/etc'
section_status = False
status = False
......@@ -734,8 +729,7 @@ class HtmlReport():
self.file.write(' <td>Target Image</td>\n')
cwd = os.getcwd()
#variants = ['docker', 'podman']
variants = ['docker']
variants = ['docker', 'podman']
for variant in variants:
logFileName = 'ausf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName):
......@@ -786,8 +780,7 @@ class HtmlReport():
self.file.write(' <td>Target Image</td>\n')
cwd = os.getcwd()
#variants = ['docker', 'podman']
variants = ['docker']
variants = ['docker', 'podman']
for variant in variants:
logFileName = 'ausf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName):
......
#/*
# * 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
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface AUSF service
# Valid for RHEL 8.2
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-ausf-builder
ARG NEEDED_GIT_PROXY
COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca
COPY tmp/entitlement/*.pem /etc/pki/entitlement
RUN rm -f /etc/rhsm-host && \
yum repolist --disablerepo=* && \
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \
yum update -y && \
yum install -y \
psmisc \
git \
diffutils \
file \
gcc-c++ \
boost-devel \
openssl-devel \
openssl \
libasan && \
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 && \
git config --global http.sslverify false
# Copying source code
WORKDIR /openair-ausf
COPY . /openair-ausf
# Installing and Building AUSF
WORKDIR /openair-ausf/build/scripts
RUN ./build_ausf --install-deps --force
RUN ./build_ausf --clean --Verbose --build-type Release --jobs
RUN ldd /openair-ausf/build/ausf/build/ausf
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-ausf
ENV TZ=Europe/Paris
# 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" \
tzdata \
procps-ng \
psmisc \
net-tools \
libubsan \
libasan \
liblsan \
libevent && \
yum clean all -y && \
rm -rf /var/cache/yum && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
# Copying executable and generated libraries
WORKDIR /openair-ausf/bin
COPY --from=oai-ausf-builder /openair-ausf/build/ausf/build/ausf oai_ausf
COPY --from=oai-ausf-builder /openair-ausf/scripts/entrypoint.sh .
WORKDIR /usr/local/lib64
COPY --from=oai-ausf-builder /usr/local/lib64/libpistache.so.0 .
COPY --from=oai-ausf-builder /lib64/libnettle.so.6 .
COPY --from=oai-ausf-builder /lib64/libboost_system.so.1.66.0 .
COPY --from=oai-ausf-builder /lib64/libboost_thread.so.1.66.0 .
COPY --from=oai-ausf-builder /lib64/libboost_date_time.so.1.66.0 .
COPY --from=oai-ausf-builder /lib64/libconfig++.so.9 .
COPY --from=oai-ausf-builder /lib64/libnghttp2.so.14 .
RUN ldconfig -v
RUN ldd /openair-ausf/bin/oai_ausf
WORKDIR /openair-ausf/etc
COPY --from=oai-ausf-builder /openair-ausf/etc/ausf.conf .
WORKDIR /openair-ausf
EXPOSE 80/tcp
ENTRYPOINT ["/bin/bash","/openair-ausf/bin/entrypoint.sh"]
CMD ["/openair-ausf/bin/oai_ausf", "-c" , "/openair-ausf/etc/ausf.conf", "-o"]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment