Commit 844a5dbf authored by Raphael Defosseux's avatar Raphael Defosseux

Adding RH8.2 / OC4.4 support for building images

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent c3c89417
......@@ -128,6 +128,7 @@ check_supported_distribution() {
case "$distribution" in
"ubuntu18.04") return 0 ;;
"rhel8") return 0 ;;
"rhel8.2") return 0 ;;
"centos8") return 0 ;;
esac
return 1
......
......@@ -384,6 +384,7 @@ check_install_spgwu_deps() {
bison \
$CMAKE \
cppcheck \
procps-ng \
flex \
gdb \
git"
......@@ -422,12 +423,20 @@ check_install_spgwu_deps() {
python \
pkg-config"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
case "$(get_distribution_release)" in
"centos8")
specific_packages="libidn2-devel"
;;
"rhel8.2")
specific_packages=""
;;
esac
PACKAGE_LIST="\
$specific_packages \
guile-devel \
libconfig-devel \
libgcrypt-devel \
gmp-devel \
libidn2-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
......
......@@ -144,24 +144,26 @@ function main()
mkdir -m 777 -p $dext
if [ $var_check_install_min_deps -gt 0 ];then
disable_ipv6
check_install_spgwu_min_deps $force $debug
if [[ $? -ne 0 ]]; then
echo_error "Error: SPGW-U minimal deps installation failed"
return 1
else
# Done now after
disable_ipv6
echo_success "SPGW-U minimal deps installation successful"
echo_warning "SPGW-U not compiled, to compile it, re-run build_spgwu without -i option"
return 0
fi
fi
if [ $var_check_install_deps -gt 0 ];then
disable_ipv6
check_install_spgwu_deps $force $debug
if [[ $? -ne 0 ]]; then
echo_error "Error: SPGW-U deps installation failed"
return 1
else
# Done now after
disable_ipv6
echo_success "SPGW-U deps installation successful"
echo_warning "SPGW-U not compiled, to compile it, re-run build_spgwu without -I option"
return 0
......
#/*
# * 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 SPGW-U-TINY service
# Valid for RHEL8.2 in the OpenShift context (v4.4)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-spgwu-tiny-builder
# Entitlements and RHSM configurations are Open-Shift Secret and ConfigMaps
# It is pre-requisite
RUN rm -Rf /etc/rhsm/ca /etc/pki/entitlement
# 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
RUN rm /etc/rhsm-host && \
# Initialize /etc/yum.repos.d/redhat.repo
# See https://access.redhat.com/solutions/1443553
yum repolist --disablerepo=* && \
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \
yum update -y && \
yum -y install --enablerepo="codeready-builder-for-rhel-8-x86_64-rpms" \
# diff, cmp and file are not in the ubi???
diffutils \
file \
psmisc \
git
# Copy the workspace as is
WORKDIR /openair-spgwu-tiny
COPY . /openair-spgwu-tiny
# Installing and Building SPGW-U-TINY
WORKDIR /openair-spgwu-tiny/build/scripts
RUN ./build_spgwu --install-deps --force
RUN ./build_spgwu --clean --build-type Release --jobs --Verbose
#debug
RUN ldd /openair-spgwu-tiny/build/spgw_u/build/spgwu
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-spgwu-tiny
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \
yum -y install --enablerepo="ubi-8-codeready-builder" \
psmisc \
net-tools \
libevent \
&& yum clean all -y \
&& rm -rf /var/cache/yum
# Copying executable and generated libraries
WORKDIR /openair-spgwu-tiny/bin
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/build/spgw_u/build/spgwu oai_spgwu
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/scripts/entrypoint.sh .
# Copying installed libraries from builder
COPY --from=oai-spgwu-tiny-builder /lib64/libgflags.so.2.1 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libglog.so.0 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libdouble-conversion.so.1 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libconfig++.so.9 /lib64/
COPY --from=oai-spgwu-tiny-builder /lib64/libboost_system.so.1.66.0 /lib64/
RUN ldconfig
#debug
RUN ldd /openair-spgwu-tiny/bin/oai_spgwu
# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-spgwu-tiny/etc
COPY --from=oai-spgwu-tiny-builder /openair-spgwu-tiny/etc/spgw_u.conf .
WORKDIR /openair-spgwu-tiny
# expose ports
EXPOSE 2152/udp 8805/udp
CMD ["/openair-spgwu-tiny/bin/oai_spgwu", "-c", "/openair-spgwu-tiny/etc/spgw_u.conf", "-o"]
ENTRYPOINT ["/openair-spgwu-tiny/bin/entrypoint.sh"]
# Build and deploying OAI-SPGW-C in OpenShift cluster #
## Pre-requisite ##
On a `RHEL8` physical machine (or a virtual machine) connected to the OpenShift Cluster, recover the entitlement and the RH subscription manager configs:
```bash
oc create configmap rhsm-conf --from-file /etc/rhsm/rhsm.conf
oc create configmap rhsm-ca --from-file /etc/rhsm/ca/redhat-uep.pem
oc create secret generic etc-pki-entitlement --from-file /etc/pki/entitlement/{NUMBER_ON_YOUR_COMPUTER}.pem --from-file /etc/pki/entitlement/{NUMBER_ON_YOUR_COMPUTER}-key.pem
```
These configmaps and secret will be shared by all the build configs in your OC project. No need to do it each time.
## Launching the Build ##
On a machine connected to the OpenShift Cluster, create the target image stream and the build configuration.
Note that the project name is currently hard-coded to `oaicicd-tmp`.
**TODO: pass as env variables: branch name, image tag and project name**
```bash
git clone https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git
cd openair-spgwu-tiny
git checkout dockerfile-improvements-2020-08
oc apply -f openshift/oai-spgwu-tiny-image-stream.yml
oc apply -f openshift/oai-spgwu-tiny-build-config.yml
```
Note that this step has to be done once before the first build and if you modify the yaml files.
Then anytime you want to build:
```bash
oc start-build oai-spgwu-tiny-build-config --follow
```
The `--follow` might break.
```bash
oc logs build/oai-spgwu-tiny-build-config-XYZ --follow
```
where `XYZ` is the build number.
You should see a successful buid when :
```bash
...
Pushing image image-registry.openshift-image-registry.svc:5000/oaicicd-tmp/oai-spgwu-tiny:ci-tmp ...
Getting image source signatures
Copying blob sha256:087e0da17c56af1aaf0a1eba37169b46f6c46936b554b7e13f11165dac4ba8ef
...
Copying blob sha256:0adcf0e0c86fbba84ed7a22a57a2cd4d7695c1ce858dd03f03dc3002880b8061
Copying config sha256:73330dfa1a733335355324848a02ba1899f9d125559979f9911f3dedcd4450ca
Writing manifest to image destination
Storing signatures
Successfully pushed image-registry.openshift-image-registry.svc:5000/oaicicd-tmp/oai-spgwu-tiny@sha256:c1de087af5515d22e40486fb181f6ff65a7f34788d8174aa122d686667042cf9
Push successful
```
#/*
# * 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-spgwu-tiny-build-config"
spec:
runPolicy: "Serial"
source:
git:
uri: "https://github.com/OPENAIRINTERFACE/openair-spgwu-tiny.git"
ref: "dockerfile-improvements-2020-08"
httpProxy: http://proxy.eurecom.fr:8080
httpsProxy: https://proxy.eurecom.fr:8080
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.rhel8-2.oc4-4"
output:
to:
kind: "ImageStreamTag"
name: "oai-spgwu-tiny:ci-tmp"
#/*
# * 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: v1
kind: ImageStream
metadata:
name: oai-spgwu-tiny
namespace: oaicicd-tmp
status:
tag: ci-tmp
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