From e2c59441cdb838e1548d3699adcb25b464a4a20e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 29 Aug 2022 18:34:56 +0200 Subject: [PATCH 01/22] Dockerfile: delete artifacts using -c before building --- docker/Dockerfile.build.rhel8.2 | 2 +- docker/Dockerfile.build.ubuntu18 | 2 +- docker/Dockerfile.phySim.rhel8.2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.build.rhel8.2 b/docker/Dockerfile.build.rhel8.2 index 2664096a9b..6fc2598276 100644 --- a/docker/Dockerfile.build.rhel8.2 +++ b/docker/Dockerfile.build.rhel8.2 @@ -35,4 +35,4 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 + ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 -c diff --git a/docker/Dockerfile.build.ubuntu18 b/docker/Dockerfile.build.ubuntu18 index 7809d56216..8c1ea3556d 100644 --- a/docker/Dockerfile.build.ubuntu18 +++ b/docker/Dockerfile.build.ubuntu18 @@ -35,4 +35,4 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 + ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 -c diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 index b4eb9a1eeb..507b56f18d 100644 --- a/docker/Dockerfile.phySim.rhel8.2 +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -38,7 +38,7 @@ RUN yum install -y libasan RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address --noavx512 + ./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address --noavx512 -c #start from scratch for target executable FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim From e62662e46359d68a3923df7c95764b439afd7ef3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 8 Aug 2022 15:50:59 +0200 Subject: [PATCH 02/22] Correct entitlements in base Dockerfile --- ci-scripts/cls_containerize.py | 7 ++++--- docker/Dockerfile.base.rhel8.2 | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index edf43cd1bf..e3d5397eee 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -215,9 +215,10 @@ class Containerize(): # if asterix, copy the entitlement and subscription manager configurations if self.host == 'Red Hat': - mySSH.command('mkdir -p tmp/ca/ tmp/entitlement/', '\$', 5) - mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca/', '\$', 5) - mySSH.command('sudo cp /etc/pki/entitlement/*.pem tmp/entitlement/', '\$', 5) + mySSH.command('mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca', '\$', 5) + mySSH.command('sudo cp /etc/rhsm/rhsm.conf ./rhsm-conf/', '\$', 5) + mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem ./rhsm-ca/', '\$', 5) + mySSH.command('sudo cp /etc/pki/entitlement/*.pem ./etc-pki-entitlement/', '\$', 5) baseImage = 'ran-base' baseTag = 'develop' diff --git a/docker/Dockerfile.base.rhel8.2 b/docker/Dockerfile.base.rhel8.2 index 3050f09849..5f897bd0e2 100644 --- a/docker/Dockerfile.base.rhel8.2 +++ b/docker/Dockerfile.base.rhel8.2 @@ -32,8 +32,12 @@ ENV TZ=Europe/Paris ENV BUILD_UHD_FROM_SOURCE=True ENV UHD_VERSION=3.15.0.0 -COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca -COPY tmp/entitlement/*.pem /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 #install developers pkg/repo RUN rm -f /etc/rhsm-host && \ From 02f97a15b44ee560f4f70980852d07a7ee550617 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 1 Aug 2022 15:11:19 +0200 Subject: [PATCH 03/22] Drop old OpenShift cluster files --- docker/Dockerfile.eNB.rhel7.oc4-4 | 83 -------------- docker/Dockerfile.eNB.rhel8.2.oc4-4 | 124 --------------------- docker/Dockerfile.gNB.rhel7.oc4-4 | 89 --------------- docker/Dockerfile.gNB.rhel8.2.oc4-4 | 128 ---------------------- docker/Dockerfile.lteUE.rhel8.2.oc4-4 | 122 --------------------- docker/Dockerfile.nrUE.rhel8.2.oc4-4 | 119 -------------------- docker/Dockerfile.ran.rhel7.oc4-4 | 74 ------------- docker/Dockerfile.ran.rhel8.2.oc4-4 | 74 ------------- docker/README.md | 4 +- openshift/oai-enb-build-config.yml | 55 ---------- openshift/oai-enb-image-stream.yml | 30 ----- openshift/oai-enb-rh8-build-config.yml | 48 -------- openshift/oai-gnb-build-config.yml | 55 ---------- openshift/oai-gnb-image-stream.yml | 30 ----- openshift/oai-gnb-rh8-build-config.yml | 48 -------- openshift/oai-gnb-rh8-image-stream.yml | 30 ----- openshift/oai-lte-ue-rh8-build-config.yml | 48 -------- openshift/oai-lte-ue-rh8-image-stream.yml | 30 ----- openshift/oai-nr-ue-rh8-build-config.yml | 48 -------- openshift/oai-nr-ue-rh8-image-stream.yml | 30 ----- openshift/oai-ran-build-config.yml | 52 --------- openshift/oai-ran-image-stream.yml | 30 ----- openshift/oai-ran-rh8-build-config.yml | 57 ---------- 23 files changed, 1 insertion(+), 1407 deletions(-) delete mode 100644 docker/Dockerfile.eNB.rhel7.oc4-4 delete mode 100644 docker/Dockerfile.eNB.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.gNB.rhel7.oc4-4 delete mode 100644 docker/Dockerfile.gNB.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.lteUE.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.nrUE.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.ran.rhel7.oc4-4 delete mode 100644 docker/Dockerfile.ran.rhel8.2.oc4-4 delete mode 100644 openshift/oai-enb-build-config.yml delete mode 100644 openshift/oai-enb-image-stream.yml delete mode 100644 openshift/oai-enb-rh8-build-config.yml delete mode 100644 openshift/oai-gnb-build-config.yml delete mode 100644 openshift/oai-gnb-image-stream.yml delete mode 100644 openshift/oai-gnb-rh8-build-config.yml delete mode 100644 openshift/oai-gnb-rh8-image-stream.yml delete mode 100644 openshift/oai-lte-ue-rh8-build-config.yml delete mode 100644 openshift/oai-lte-ue-rh8-image-stream.yml delete mode 100644 openshift/oai-nr-ue-rh8-build-config.yml delete mode 100644 openshift/oai-nr-ue-rh8-image-stream.yml delete mode 100644 openshift/oai-ran-build-config.yml delete mode 100644 openshift/oai-ran-image-stream.yml delete mode 100644 openshift/oai-ran-rh8-build-config.yml diff --git a/docker/Dockerfile.eNB.rhel7.oc4-4 b/docker/Dockerfile.eNB.rhel7.oc4-4 deleted file mode 100644 index 85c2a17ead..0000000000 --- a/docker/Dockerfile.eNB.rhel7.oc4-4 +++ /dev/null @@ -1,83 +0,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 BUILD service -# Valid for RHEL7 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:latest AS enb-build - - -WORKDIR /oai-enb -COPY . . - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai --eNB - - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi7/ubi:latest as oai-enb - -# 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 - - -#install developers pkg/repo -RUN rm /etc/rhsm-host && \ - # Initialize /etc/yum.repos.d/redhat.repo - # See https://access.redhat.com/solutions/1443553 - yum repolist --disablerepo=* && \ - yum-config-manager --enable rhel-7-server-optional-rpms rhel-server-rhscl-7-rpms && \ - yum update -y && \ - yum install -y \ - lksctp-tools \ - protobuf-c \ - nettle \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf - - -WORKDIR /opt/oai-enb/bin -COPY --from=enb-build /oai-enb/targets/bin/lte-softmodem.Rel15 . - -RUN ldd lte-softmodem.Rel15 - -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] - diff --git a/docker/Dockerfile.eNB.rhel8.2.oc4-4 b/docker/Dockerfile.eNB.rhel8.2.oc4-4 deleted file mode 100644 index 03f6ec8e45..0000000000 --- a/docker/Dockerfile.eNB.rhel8.2.oc4-4 +++ /dev/null @@ -1,124 +0,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 BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS enb-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --eNB --ninja -w USRP - -# debug -#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 -#RUN ls -ls /oai-ran/targets/bin -#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-enb - -RUN yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - lksctp-tools \ - nettle \ - atlas \ - net-tools \ - iproute \ - iputils \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-enb/bin -COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . - -WORKDIR /usr/local/lib/ -COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/libcoding.so . -COPY --from=enb-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=enb-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -COPY --from=enb-build /oai-ran/cmake_targets/ran_build/build/liboai_iqplayer.so . -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" - -COPY --from=enb-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=enb-build /lib64/libconfig.so.9 /lib64 -COPY --from=enb-build /lib64/libblas.so.3 /lib64 -COPY --from=enb-build /lib64/liblapack.so.3 /lib64 -COPY --from=enb-build /lib64/liblapacke.so.3 /lib64 -COPY --from=enb-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=enb-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig - -#debug -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libdfts.so -RUN ldd /usr/local/lib/liboai_iqplayer.so -RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15 - -# Copy the relevant configuration files for eNB -WORKDIR /opt/oai-enb/etc -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* . - -WORKDIR /opt/oai-enb - -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.gNB.rhel7.oc4-4 b/docker/Dockerfile.gNB.rhel7.oc4-4 deleted file mode 100644 index 5165dd9715..0000000000 --- a/docker/Dockerfile.gNB.rhel7.oc4-4 +++ /dev/null @@ -1,89 +0,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 BUILD service -# Valid for RHEL7 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:latest AS gnb-build - - -WORKDIR /oai-gnb -COPY . . - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai --gNB - - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi7/ubi:latest as oai-gnb - -# 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 - - -#install developers pkg/repo -RUN rm /etc/rhsm-host && \ - # Initialize /etc/yum.repos.d/redhat.repo - # See https://access.redhat.com/solutions/1443553 - yum repolist --disablerepo=* && \ - yum-config-manager --enable rhel-7-server-optional-rpms rhel-server-rhscl-7-rpms && \ - yum update -y && \ - yum install -y \ - libXpm \ - libX11 \ - atlas \ - blas \ - lapack \ - lksctp-tools \ - protobuf-c \ - nettle \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-gnb/bin -COPY --from=gnb-build /oai-gnb/targets/bin/nr-softmodem.Rel15 . -WORKDIR /lib64 -COPY --from=gnb-build /lib64/libforms.so.2 . - -RUN ldd /opt/oai-gnb/bin/nr-softmodem.Rel15 - -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"] -#ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"] - diff --git a/docker/Dockerfile.gNB.rhel8.2.oc4-4 b/docker/Dockerfile.gNB.rhel8.2.oc4-4 deleted file mode 100644 index 6c88d3ad8e..0000000000 --- a/docker/Dockerfile.gNB.rhel8.2.oc4-4 +++ /dev/null @@ -1,128 +0,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 BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS gnb-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --gNB --ninja -w USRP - -#debug -#RUN ldconfig -v -#RUN ldd /oai-ran/targets/bin/nr-softmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-gnb - -RUN yum repolist --disablerepo=* && \ - yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - libXpm \ - libX11 \ - atlas \ - lksctp-tools \ - nettle \ - net-tools \ - iputils \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-gnb/bin -COPY --from=gnb-build /oai-ran/targets/bin/nr-softmodem.Rel15 . - -WORKDIR /usr/local/lib/ -COPY --from=gnb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/libcoding.so . -COPY --from=gnb-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim8seg.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc_orig.so . - -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" -COPY --from=gnb-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=gnb-build /lib64/libconfig.so.9 /lib64 -COPY --from=gnb-build /lib64/libforms.so.2 /lib64 -COPY --from=gnb-build /lib64/libblas.so.3 /lib64 -COPY --from=gnb-build /lib64/liblapack.so.3 /lib64 -COPY --from=gnb-build /lib64/liblapacke.so.3 /lib64 -COPY --from=gnb-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=gnb-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig -#debug -RUN ldd /opt/oai-gnb/bin/nr-softmodem.Rel15 -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libdfts.so -RUN ldd /usr/local/lib/libldpc.so -RUN ldd /usr/local/lib/libldpc_optim.so -RUN ldd /usr/local/lib/libldpc_optim8seg.so -RUN ldd /usr/local/lib/libldpc_orig.so - -# Copy the relevant configuration files for gNB -WORKDIR /opt/oai-gnb/etc -COPY --from=gnb-build /oai-ran/ci-scripts/conf_files/gnb.* . - -WORKDIR /opt/oai-gnb -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"] -#ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 b/docker/Dockerfile.lteUE.rhel8.2.oc4-4 deleted file mode 100644 index cc492882f5..0000000000 --- a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 +++ /dev/null @@ -1,122 +0,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 BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS lte-ue-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --UE --ninja -w USRP - -# debug -#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-lte-ue - -RUN yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - lksctp-tools \ - nettle \ - atlas \ - iproute \ - net-tools \ - iputils \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-lte-ue/bin -COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata . -COPY --from=lte-ue-build /oai-ran/targets/bin/nvram . -COPY --from=lte-ue-build /oai-ran/targets/bin/usim . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 . - -WORKDIR /usr/local/lib/ -COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/libcoding.so . -COPY --from=lte-ue-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=lte-ue-build /oai-ran/cmake_targets/ran_build/build/libSIMU.so . -COPY --from=lte-ue-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" - -COPY --from=lte-ue-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=lte-ue-build /lib64/libconfig.so.9 /lib64 -COPY --from=lte-ue-build /lib64/libblas.so.3 /lib64 -COPY --from=lte-ue-build /lib64/liblapack.so.3 /lib64 -COPY --from=lte-ue-build /lib64/liblapacke.so.3 /lib64 -COPY --from=lte-ue-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=lte-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig - -#debug -RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15 -RUN ldd /opt/oai-lte-ue/bin/conf2uedata -RUN ldd /opt/oai-lte-ue/bin/nvram -RUN ldd /opt/oai-lte-ue/bin/usim -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libSIMU.so -RUN ldd /usr/local/lib/libdfts.so - -# Copy the relevant configuration files for eNB -WORKDIR /opt/oai-lte-ue/etc -COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* . -COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf - -WORKDIR /opt/oai-lte-ue -#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 b/docker/Dockerfile.nrUE.rhel8.2.oc4-4 deleted file mode 100644 index 2d018c96af..0000000000 --- a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 +++ /dev/null @@ -1,119 +0,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 BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS nr-ue-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --nrUE --ninja -w USRP - -# debug -#RUN ldconfig -v -#RUN ldd /oai-ran/targets/bin/nr-uesoftmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-nr-ue - -RUN yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - lksctp-tools \ - nettle \ - net-tools \ - iputils \ - atlas \ - libXpm \ - libX11 \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-nr-ue/bin -COPY --from=nr-ue-build /oai-ran/targets/bin/nr-uesoftmodem.Rel15 . - -WORKDIR /usr/local/lib/ -COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/libcoding.so . -COPY --from=nr-ue-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim8seg.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc_orig.so . -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" - -COPY --from=nr-ue-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=nr-ue-build /lib64/libconfig.so.9 /lib64 -COPY --from=nr-ue-build /lib64/libblas.so.3 /lib64 -COPY --from=nr-ue-build /lib64/liblapack.so.3 /lib64 -COPY --from=nr-ue-build /lib64/liblapacke.so.3 /lib64 -COPY --from=nr-ue-build /lib64/libforms.so.2 /lib64 -COPY --from=nr-ue-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=nr-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig -RUN ldd /opt/oai-nr-ue/bin/nr-uesoftmodem.Rel15 -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libdfts.so -RUN ldd /usr/local/lib/libldpc.so -RUN ldd /usr/local/lib/libldpc_optim.so -RUN ldd /usr/local/lib/libldpc_optim8seg.so -RUN ldd /usr/local/lib/libldpc_orig.so - -# Copy the relevant configuration files for eNB -WORKDIR /opt/oai-nr-ue/etc -COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/ue.* . - -WORKDIR /opt/oai-nr-ue -#CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-nr-ue/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.ran.rhel7.oc4-4 b/docker/Dockerfile.ran.rhel7.oc4-4 deleted file mode 100644 index 2f0423801a..0000000000 --- a/docker/Dockerfile.ran.rhel7.oc4-4 +++ /dev/null @@ -1,74 +0,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 BUILD service -# Valid for RHEL7 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - - -FROM registry.access.redhat.com/ubi7/ubi:latest AS ran-base - -# 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 - - -#install developers pkg/repo -RUN rm /etc/rhsm-host && \ - # Initialize /etc/yum.repos.d/redhat.repo - # See https://access.redhat.com/solutions/1443553 - yum repolist --disablerepo=* && \ - yum-config-manager --enable rhel-7-server-optional-rpms rhel-server-rhscl-7-rpms && \ - yum update -y && \ - yum install -y \ - #gcc needed for build_oai - gcc gcc-c++ \ - diffutils \ - file \ - psmisc \ - git \ - #unzip is needed for protobuf - unzip && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf - -# In some network environments, GIT proxy is required -RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi" - -#create the WORKDIR -WORKDIR /oai-ran -COPY . . - -#run build_oai -I to get the builder image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai -I - -#as the image is public, we need to remove the subscription manager configurations -#RUN rm -Rf /etc/rhsm /etc/pki/entitlement - diff --git a/docker/Dockerfile.ran.rhel8.2.oc4-4 b/docker/Dockerfile.ran.rhel8.2.oc4-4 deleted file mode 100644 index 93af2b0e37..0000000000 --- a/docker/Dockerfile.ran.rhel8.2.oc4-4 +++ /dev/null @@ -1,74 +0,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 BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - - -FROM registry.access.redhat.com/ubi8/ubi:latest AS ran-base - -# 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 - -#install developers pkg/repo -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 install -y \ - #gcc needed for build_oai - gcc gcc-c++ \ - diffutils \ - file \ - psmisc \ - git \ - #unzip is needed for protobuf - unzip && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -# In some network environments, GIT proxy is required -RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi" - -#create the WORKDIR -WORKDIR /oai-ran -COPY . . - -#run build_oai -I to get the builder image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai -I -w USRP - -#as the image is public, we need to remove the subscription certificates -RUN rm -Rf /etc/pki/entitlement/*.pem - diff --git a/docker/README.md b/docker/README.md index 85f553c721..7844b46bce 100644 --- a/docker/README.md +++ b/docker/README.md @@ -78,9 +78,7 @@ The currently-supported OS are: The currently-supported cluster version is: -- `rhel8.2.oc4-4` - -We have also `rhel7.oc4-4` support but it will be discontinued soon. +- `rhel8.2.oc4-9` For more details in build within a Openshift Cluster, see [OpenShift README](../openshift/README.md) for more details. diff --git a/openshift/oai-enb-build-config.yml b/openshift/oai-enb-build-config.yml deleted file mode 100644 index 3f6875c50d..0000000000 --- a/openshift/oai-enb-build-config.yml +++ /dev/null @@ -1,55 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-enb-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - 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: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.eNB.rhel7.oc4-4" - output: - to: - kind: "ImageStreamTag" - name: "oai-enb:latest" diff --git a/openshift/oai-enb-image-stream.yml b/openshift/oai-enb-image-stream.yml deleted file mode 100644 index 94ee13e50f..0000000000 --- a/openshift/oai-enb-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-enb - namespace: oai -status: - tag: latest - diff --git a/openshift/oai-enb-rh8-build-config.yml b/openshift/oai-enb-rh8-build-config.yml deleted file mode 100644 index e715fc5733..0000000000 --- a/openshift/oai-enb-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-enb-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.eNB.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "8Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-enb:rhel8-latest" diff --git a/openshift/oai-gnb-build-config.yml b/openshift/oai-gnb-build-config.yml deleted file mode 100644 index b0c99959d1..0000000000 --- a/openshift/oai-gnb-build-config.yml +++ /dev/null @@ -1,55 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-gnb-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - 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: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.gNB.rhel7.oc4-4" - output: - to: - kind: "ImageStreamTag" - name: "oai-gnb:latest" diff --git a/openshift/oai-gnb-image-stream.yml b/openshift/oai-gnb-image-stream.yml deleted file mode 100644 index 22a6c157d2..0000000000 --- a/openshift/oai-gnb-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-gnb - namespace: oai -status: - tag: latest - diff --git a/openshift/oai-gnb-rh8-build-config.yml b/openshift/oai-gnb-rh8-build-config.yml deleted file mode 100644 index aa3553c1e4..0000000000 --- a/openshift/oai-gnb-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-gnb-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.gNB.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "15Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-gnb:rhel8-latest" diff --git a/openshift/oai-gnb-rh8-image-stream.yml b/openshift/oai-gnb-rh8-image-stream.yml deleted file mode 100644 index 2e04e94f5b..0000000000 --- a/openshift/oai-gnb-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-gnb - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-lte-ue-rh8-build-config.yml b/openshift/oai-lte-ue-rh8-build-config.yml deleted file mode 100644 index f077e4cb26..0000000000 --- a/openshift/oai-lte-ue-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-lte-ue-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.lteUE.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "8Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-lte-ue:rhel8-latest" diff --git a/openshift/oai-lte-ue-rh8-image-stream.yml b/openshift/oai-lte-ue-rh8-image-stream.yml deleted file mode 100644 index 09aeb2a766..0000000000 --- a/openshift/oai-lte-ue-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-lte-ue - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-nr-ue-rh8-build-config.yml b/openshift/oai-nr-ue-rh8-build-config.yml deleted file mode 100644 index b3367f6ab6..0000000000 --- a/openshift/oai-nr-ue-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-nr-ue-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.nrUE.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "8Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-nr-ue:rhel8-latest" diff --git a/openshift/oai-nr-ue-rh8-image-stream.yml b/openshift/oai-nr-ue-rh8-image-stream.yml deleted file mode 100644 index e61cc0dfde..0000000000 --- a/openshift/oai-nr-ue-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-nr-ue - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-ran-build-config.yml b/openshift/oai-ran-build-config.yml deleted file mode 100644 index 39d7a40f6d..0000000000 --- a/openshift/oai-ran-build-config.yml +++ /dev/null @@ -1,52 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-ran-build-config" -spec: - runPolicy: "Serial" - source: - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - 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.ran.rhel7.oc4-4" - output: - to: - kind: "ImageStreamTag" - name: "oai-ran:latest" diff --git a/openshift/oai-ran-image-stream.yml b/openshift/oai-ran-image-stream.yml deleted file mode 100644 index e1ef9d0b31..0000000000 --- a/openshift/oai-ran-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-ran - namespace: oai -status: - tag: latest - diff --git a/openshift/oai-ran-rh8-build-config.yml b/openshift/oai-ran-rh8-build-config.yml deleted file mode 100644 index 3d27b7cb5c..0000000000 --- a/openshift/oai-ran-rh8-build-config.yml +++ /dev/null @@ -1,57 +0,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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-ran-rhel8-build-config" -spec: - runPolicy: "Serial" - source: - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - 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.ran.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "5Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-ran:rhel8-latest" From d524bbb0edceea312906e3bf6ff741debe4ad57b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Jul 2022 17:05:31 +0200 Subject: [PATCH 04/22] Add openshift build-configs and image-streams --- openshift/oai-enb-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-enb-is.yaml | 32 ++++++++++++++++++++++++ openshift/oai-gnb-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-gnb-is.yaml | 33 +++++++++++++++++++++++++ openshift/oai-lte-ue-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-lte-ue-is.yaml | 32 ++++++++++++++++++++++++ openshift/oai-nr-ue-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-nr-ue-is.yaml | 32 ++++++++++++++++++++++++ openshift/ran-base-bc.yaml | 48 ++++++++++++++++++++++++++++++++++++ openshift/ran-base-is.yaml | 31 +++++++++++++++++++++++ openshift/ran-build-bc.yaml | 41 ++++++++++++++++++++++++++++++ openshift/ran-build-is.yaml | 33 +++++++++++++++++++++++++ 12 files changed, 430 insertions(+) create mode 100644 openshift/oai-enb-bc.yaml create mode 100644 openshift/oai-enb-is.yaml create mode 100644 openshift/oai-gnb-bc.yaml create mode 100644 openshift/oai-gnb-is.yaml create mode 100644 openshift/oai-lte-ue-bc.yaml create mode 100644 openshift/oai-lte-ue-is.yaml create mode 100644 openshift/oai-nr-ue-bc.yaml create mode 100644 openshift/oai-nr-ue-is.yaml create mode 100644 openshift/ran-base-bc.yaml create mode 100644 openshift/ran-base-is.yaml create mode 100644 openshift/ran-build-bc.yaml create mode 100644 openshift/ran-build-is.yaml diff --git a/openshift/oai-enb-bc.yaml b/openshift/oai-enb-bc.yaml new file mode 100644 index 0000000000..f9973224cc --- /dev/null +++ b/openshift/oai-enb-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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-enb" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.eNB.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-enb:latest" diff --git a/openshift/oai-enb-is.yaml b/openshift/oai-enb-is.yaml new file mode 100644 index 0000000000..7e75af58d6 --- /dev/null +++ b/openshift/oai-enb-is.yaml @@ -0,0 +1,32 @@ +#/* +# * 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-enb + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/oai-gnb-bc.yaml b/openshift/oai-gnb-bc.yaml new file mode 100644 index 0000000000..78b9248f19 --- /dev/null +++ b/openshift/oai-gnb-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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-gnb" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.gNB.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-gnb:latest" diff --git a/openshift/oai-gnb-is.yaml b/openshift/oai-gnb-is.yaml new file mode 100644 index 0000000000..996ad9fd1d --- /dev/null +++ b/openshift/oai-gnb-is.yaml @@ -0,0 +1,33 @@ +#/* +# * 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-gnb + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest + diff --git a/openshift/oai-lte-ue-bc.yaml b/openshift/oai-lte-ue-bc.yaml new file mode 100644 index 0000000000..a0dd92e670 --- /dev/null +++ b/openshift/oai-lte-ue-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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-lte-ue" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.lteUE.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-lte-ue:latest" diff --git a/openshift/oai-lte-ue-is.yaml b/openshift/oai-lte-ue-is.yaml new file mode 100644 index 0000000000..678b8e6cbf --- /dev/null +++ b/openshift/oai-lte-ue-is.yaml @@ -0,0 +1,32 @@ +#/* +# * 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-lte-ue + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/oai-nr-ue-bc.yaml b/openshift/oai-nr-ue-bc.yaml new file mode 100644 index 0000000000..da9a5e424c --- /dev/null +++ b/openshift/oai-nr-ue-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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-nr-ue" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.nrUE.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-nr-ue:latest" diff --git a/openshift/oai-nr-ue-is.yaml b/openshift/oai-nr-ue-is.yaml new file mode 100644 index 0000000000..0afd7b9448 --- /dev/null +++ b/openshift/oai-nr-ue-is.yaml @@ -0,0 +1,32 @@ +#/* +# * 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-nr-ue + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/ran-base-bc.yaml b/openshift/ran-base-bc.yaml new file mode 100644 index 0000000000..85247813aa --- /dev/null +++ b/openshift/ran-base-bc.yaml @@ -0,0 +1,48 @@ +#/* +# * 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: "ran-base" +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.base.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "ran-base:latest" diff --git a/openshift/ran-base-is.yaml b/openshift/ran-base-is.yaml new file mode 100644 index 0000000000..edde0d700e --- /dev/null +++ b/openshift/ran-base-is.yaml @@ -0,0 +1,31 @@ +#/* +# * 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: ran-base + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/ran-build-bc.yaml b/openshift/ran-build-bc.yaml new file mode 100644 index 0000000000..db144569b6 --- /dev/null +++ b/openshift/ran-build-bc.yaml @@ -0,0 +1,41 @@ +#/* +# * 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: "ran-build" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.build.rhel8.2" + from: + kind: ImageStreamTag # Use an imagestream tag as 'FROM' + namespace: oaicicd-ran # Which project? + name: oai-ran-base:latest # Use the imagestream created above + output: + to: + kind: "ImageStreamTag" + name: "ran-build:latest" diff --git a/openshift/ran-build-is.yaml b/openshift/ran-build-is.yaml new file mode 100644 index 0000000000..4f38d0ab47 --- /dev/null +++ b/openshift/ran-build-is.yaml @@ -0,0 +1,33 @@ +#/* +# * 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: ran-build + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest + From 580b2f326339b1b77c81059e840175be7a620540 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 17 Aug 2022 20:08:28 +0200 Subject: [PATCH 05/22] Create physim BuildConfig and harmonize ImageStream filename --- ci-scripts/cls_physim1.py | 2 +- openshift/oai-physim-bc.yaml | 41 +++++++++++++++++++ ...im-image-stream.yml => oai-physim-is.yaml} | 3 ++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 openshift/oai-physim-bc.yaml rename openshift/{oai-physim-image-stream.yml => oai-physim-is.yaml} (96%) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0464681b1d..0f187a4633 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -173,7 +173,7 @@ class PhySim: else: logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-image-stream.yml || true', '\$', 30) + mySSH.command('oc create -f openshift/oai-physim-is.yml || true', '\$', 30) if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) diff --git a/openshift/oai-physim-bc.yaml b/openshift/oai-physim-bc.yaml new file mode 100644 index 0000000000..050dd8bca8 --- /dev/null +++ b/openshift/oai-physim-bc.yaml @@ -0,0 +1,41 @@ +#/* +# * 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-physim" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.phySim.rhel8.2" + from: + kind: ImageStreamTag + namespace: oaicicd-ran + name: oai-ran-base:latest + output: + to: + kind: "ImageStreamTag" + name: "oai-physim:latest" diff --git a/openshift/oai-physim-image-stream.yml b/openshift/oai-physim-is.yaml similarity index 96% rename from openshift/oai-physim-image-stream.yml rename to openshift/oai-physim-is.yaml index 9ef338f139..f2c7853540 100644 --- a/openshift/oai-physim-image-stream.yml +++ b/openshift/oai-physim-is.yaml @@ -24,6 +24,9 @@ apiVersion: image.openshift.io/v1 kind: ImageStream metadata: name: oai-physim + namespace: oaicicd-ran spec: lookupPolicy: local: true +status: + tag: latest From f77bf443861c98ec556615458e771bcad4f89948 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 19 Aug 2022 15:44:20 +0200 Subject: [PATCH 06/22] Help function for copying RAN build logs to executor --- ci-scripts/cls_containerize.py | 53 ++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index e3d5397eee..0978c0a7d3 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -48,6 +48,26 @@ import sshconnection as SSH import helpreadme as HELP import constants as CONST +#----------------------------------------------------------- +# Helper functions used here and in other classes +# (e.g., cls_cluster.py) +#----------------------------------------------------------- +def CopyLogsToExecutor(sshSession, sourcePath, log_name, scpIp, scpUser, scpPw): + sshSession.command(f'cd {sourcePath}/cmake_targets', '\$', 5) + sshSession.command(f'rm -f {log_name}.zip', '\$', 5) + sshSession.command(f'mkdir -p {log_name}', '\$', 5) + sshSession.command(f'mv log/* {log_name}', '\$', 5) + sshSession.command(f'zip -r -qq {log_name}.zip {log_name}', '\$', 5) + + # copy zip to executor for analysis + if (os.path.isfile(f'./{log_name}.zip')): + os.remove(f'./{log_name}.zip') + if (os.path.isdir(f'./{log_name}')): + shutil.rmtree(f'./{log_name}') + sshSession.copyin(scpIp, scpUser, scpPw, f'{sourcePath}/cmake_targets/{log_name}.zip', '.') + sshSession.command(f'rm -f {log_name}.zip','\$', 5) + ZipFile(f'{log_name}.zip').extractall('.') + #----------------------------------------------------------- # Class Declaration #----------------------------------------------------------- @@ -333,30 +353,19 @@ class Containerize(): # Now pruning dangling images in between target builds mySSH.command(self.cli + ' image prune --force', '\$', 30) - # Analyzing the logs - mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) - mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) - mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) - - mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) - mySSH.command('rm -f build_log_' + self.testCase_id + '.zip || true', '\$', 5) - if (os.path.isfile('./build_log_' + self.testCase_id + '.zip')): - os.remove('./build_log_' + self.testCase_id + '.zip') - if (os.path.isdir('./build_log_' + self.testCase_id)): - shutil.rmtree('./build_log_' + self.testCase_id) - mySSH.command('zip -r -qq build_log_' + self.testCase_id + '.zip build_log_' + self.testCase_id, '\$', 5) - mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '.zip', '.') - mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) - # Remove all intermediate build images + # Remove all intermediate build images and clean up if self.ranAllowMerge and forceBaseImageBuild: - mySSH.command(self.cli + ' image rm ' + baseImage + ':' + baseTag + ' || true', '\$', 30) - mySSH.command(self.cli + ' image rm ran-build:' + imageTag + ' || true','\$', 30) - # Cleaning any created tmp volume - mySSH.command(self.cli + ' volume prune --force || true','\$', 15) - mySSH.close() - ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.') + mySSH.command(f'{self.cli} image rm {baseImage}:{baseTag} || true', '\$', 30) + mySSH.command(f'{self.cli} image rm ran-build:{imageTag}','\$', 30) + mySSH.command(f'{self.cli} volume prune --force','\$', 15) - #Trying to identify the errors and warnings for each built images + # create a zip with all logs + build_log_name = f'build_log_{self.testCase_id}' + CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, lUserName, lPassWord) + mySSH.close() + + # Analyzing the logs + # Trying to identify the errors and warnings for each built images imageNames1 = imageNames base = ('ran-base','ran') imageNames1.insert(0, base) From d78ccd64ca726c4209017ec7504484fb5c7d7137 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 19 Aug 2022 16:00:10 +0200 Subject: [PATCH 07/22] Help function for analyzing RAN build logs --- ci-scripts/cls_containerize.py | 121 ++++++++++++++++----------------- 1 file changed, 60 insertions(+), 61 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 0978c0a7d3..6d9b20bc68 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -68,6 +68,58 @@ def CopyLogsToExecutor(sshSession, sourcePath, log_name, scpIp, scpUser, scpPw): sshSession.command(f'rm -f {log_name}.zip','\$', 5) ZipFile(f'{log_name}.zip').extractall('.') +def AnalyzeBuildLogs(buildRoot, images, globalStatus): + collectInfo = {} + for image in images: + files = {} + file_list = [f for f in os.listdir(f'{buildRoot}/{image}') if os.path.isfile(os.path.join(f'{buildRoot}/{image}', f)) and f.endswith('.txt')] + # Analyze the "sub-logs" of every target image + for fil in file_list: + errorandwarnings = {} + warningsNo = 0 + errorsNo = 0 + with open(f'{buildRoot}/{image}/{fil}', mode='r') as inputfile: + for line in inputfile: + result = re.search(' ERROR ', str(line)) + if result is not None: + errorsNo += 1 + result = re.search(' error:', str(line)) + if result is not None: + errorsNo += 1 + result = re.search(' WARNING ', str(line)) + if result is not None: + warningsNo += 1 + result = re.search(' warning:', str(line)) + if result is not None: + warningsNo += 1 + errorandwarnings['errors'] = errorsNo + errorandwarnings['warnings'] = warningsNo + errorandwarnings['status'] = globalStatus + files[fil] = errorandwarnings + # Analyze the target image + if os.path.isfile(f'{buildRoot}/{image}.log'): + errorandwarnings = {} + committed = False + tagged = False + with open(f'{buildRoot}/{image}.log', mode='r') as inputfile: + startOfTargetImageCreation = False # check for tagged/committed only after image created + for line in inputfile: + result = re.search(f'FROM .* [aA][sS] {image}$', str(line)) + if result is not None: + startOfTargetImageCreation = True + if startOfTargetImageCreation: + lineHasTag = re.search(f'Successfully tagged {image}:', str(line)) is not None + tagged = tagged or lineHasTag + # the OpenShift Cluster builder prepends image registry URL + lineHasCommit = re.search(f'COMMIT [a-zA-Z0-9\.:/\-]*{image}', str(line)) is not None + committed = committed or lineHasCommit + errorandwarnings['errors'] = 0 if committed or tagged else 1 + errorandwarnings['warnings'] = 0 + errorandwarnings['status'] = committed or tagged + files['Target Image Creation'] = errorandwarnings + collectInfo[image] = files + return collectInfo + #----------------------------------------------------------- # Class Declaration #----------------------------------------------------------- @@ -112,7 +164,6 @@ class Containerize(): self.dockerfileprefix = '' self.host = '' self.allImagesSize = {} - self.collectInfo = {} self.deployedContainers = [] self.tsharkStarted = False @@ -364,71 +415,18 @@ class Containerize(): CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, lUserName, lPassWord) mySSH.close() - # Analyzing the logs - # Trying to identify the errors and warnings for each built images - imageNames1 = imageNames - base = ('ran-base','ran') - imageNames1.insert(0, base) - for image,pattern in imageNames1: - files = {} - file_list = [f for f in os.listdir('build_log_' + self.testCase_id + '/' + image) if os.path.isfile(os.path.join('build_log_' + self.testCase_id + '/' + image, f)) and f.endswith('.txt')] - for fil in file_list: - errorandwarnings = {} - warningsNo = 0 - errorsNo = 0 - with open('build_log_{}/{}/{}'.format(self.testCase_id,image,fil), mode='r') as inputfile: - for line in inputfile: - result = re.search(' ERROR ', str(line)) - if result is not None: - errorsNo += 1 - result = re.search(' error:', str(line)) - if result is not None: - errorsNo += 1 - result = re.search(' WARNING ', str(line)) - if result is not None: - warningsNo += 1 - result = re.search(' warning:', str(line)) - if result is not None: - warningsNo += 1 - errorandwarnings['errors'] = errorsNo - errorandwarnings['warnings'] = warningsNo - errorandwarnings['status'] = status - files[fil] = errorandwarnings - # Let analyze the target image creation part - if os.path.isfile('build_log_{}/{}.log'.format(self.testCase_id,image)): - errorandwarnings = {} - with open('build_log_{}/{}.log'.format(self.testCase_id,image), mode='r') as inputfile: - startOfTargetImageCreation = False - buildStatus = False - for line in inputfile: - result = re.search('FROM .* [aA][sS] ' + image + '$', str(line)) - if result is not None: - startOfTargetImageCreation = True - if startOfTargetImageCreation: - result = re.search('Successfully tagged ' + image + ':', str(line)) - if result is not None: - buildStatus = True - result = re.search('COMMIT ' + image + ':', str(line)) - if result is not None: - buildStatus = True - inputfile.close() - if buildStatus: - errorandwarnings['errors'] = 0 - else: - errorandwarnings['errors'] = 1 - errorandwarnings['warnings'] = 0 - errorandwarnings['status'] = buildStatus - files['Target Image Creation'] = errorandwarnings - self.collectInfo[image] = files + # Analyze the logs + images = ['ran-base'] + [tpl[0] for tpl in imageNames] + collectInfo = AnalyzeBuildLogs(build_log_name, images, status) if status: logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) else: logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) HTML.CreateHtmlTabFooter(False) sys.exit(1) @@ -550,7 +548,8 @@ class Containerize(): errorandwarnings['warnings'] = 0 errorandwarnings['status'] = True files['Target Image Creation'] = errorandwarnings - self.collectInfo['proxy'] = files + collectInfo = {} + collectInfo['proxy'] = files mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' proxy:' + tag, '\$', 5) result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: @@ -567,7 +566,7 @@ class Containerize(): logging.info('\u001B[1m Building L2sim Proxy Image Pass\u001B[0m') HTML.CreateHtmlTestRow('commit ' + tag, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) def Copy_Image_to_Test_Server(self, HTML): imageTag = 'develop' From 668d0865b8b08daa884bdde221ee4ef0ff4b7ca7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 15:27:36 +0200 Subject: [PATCH 08/22] Simplify cls_containerize.BuildImage() and drop allImagesSize class member --- ci-scripts/cls_containerize.py | 92 +++++++++++++--------------------- 1 file changed, 36 insertions(+), 56 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 6d9b20bc68..d083b69be8 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -163,7 +163,6 @@ class Containerize(): self.cliBuildOptions = '' self.dockerfileprefix = '' self.host = '' - self.allImagesSize = {} self.deployedContainers = [] self.tsharkStarted = False @@ -318,32 +317,10 @@ class Containerize(): if forceBaseImageBuild: mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + baseImage + ' --tag ' + baseImage + ':' + baseTag + ' --file docker/Dockerfile.base' + self.dockerfileprefix + ' . > cmake_targets/log/ran-base.log 2>&1', '\$', 1600) # First verify if the base image was properly created. - status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + baseImage + ':' + baseTag, '\$', 5) + allImagesSize = {} if mySSH.getBefore().count('o such image') != 0: logging.error('\u001B[1m Could not build properly ran-base\u001B[0m') - status = False - else: - result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) - if result is not None: - imageSize = float(result.group('size')) - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ran-base size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - self.allImagesSize['ran-base'] = str(round(imageSize,1)) + ' kbytes' - else: - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ran-base size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize['ran-base'] = str(round(imageSize,1)) + ' Mbytes' - else: - imageSize = imageSize / 1000 - logging.debug('\u001B[1m ran-base size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - self.allImagesSize['ran-base'] = str(round(imageSize,1)) + ' Gbytes' - else: - logging.debug('ran-base size is unknown') - # If the base image failed, no need to continue - if not status: # Recover the name of the failed container? mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) mySSH.command(self.cli + ' image prune --force', '\$', 30) @@ -353,20 +330,32 @@ class Containerize(): HTML.CreateHtmlTabFooter(False) sys.exit(1) else: - # Recover build logs, for the moment only possible when build is successful - mySSH.command(self.cli + ' create --name test ' + baseImage + ':' + baseTag, '\$', 5) - mySSH.command('mkdir -p cmake_targets/log/ran-base', '\$', 5) - mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-base', '\$', 5) - mySSH.command(self.cli + ' rm -f test', '\$', 5) + result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) + if result is not None: + size = float(result.group("size")) / 1000000 + imageSizeStr = f'{size:.1f}' + logging.debug(f'\u001B[1m ran-base size is {imageSizeStr} Mbytes\u001B[0m') + allImagesSize['ran-base'] = f'{imageSizeStr} Mbytes' + else: + logging.debug('ran-base size is unknown') + + # Recover build logs, for the moment only possible when build is successful + mySSH.command(self.cli + ' create --name test ' + baseImage + ':' + baseTag, '\$', 5) + mySSH.command('mkdir -p cmake_targets/log/ran-base', '\$', 5) + mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-base', '\$', 5) + mySSH.command(self.cli + ' rm -f test', '\$', 5) # Build the target image(s) + status = True + attemptedImages = ['ran-base'] for image,pattern in imageNames: + attemptedImages += [image] # the archived Dockerfiles have "ran-base:latest" as base image # we need to update them with proper tag - mySSH.command('sed -i -e "s#' + baseImage + ':latest#' + baseImage + ':' + baseTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) + mySSH.command(f'sed -i -e "s#{baseImage}:latest#{baseImage}:{baseTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}', '\$', 5) if image != 'ran-build': - mySSH.command('sed -i -e "s#' + "ran-build" + ':latest#' + "ran-build" + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) - mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) + mySSH.command(f'sed -i -e "s#ran-build:latest#ran-build:{imageTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}', '\$', 5) + mySSH.command(f'{self.cli} build {self.cliBuildOptions} --target {image} --tag {image}:{imageTag} --file docker/Dockerfile.{pattern}{self.dockerfileprefix} . > cmake_targets/log/{image}.log 2>&1', '\$', 1200) # Flatten Image if image != 'ran-build': mySSH.command('python3 ./ci-scripts/flatten_image.py --tag ' + image + ':' + imageTag, '\$', 300) @@ -380,27 +369,18 @@ class Containerize(): status = False # Here we should check if the last container corresponds to a failed command and destroy it mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) - self.allImagesSize[image] = 'N/A -- Build Failed' + allImagesSize[image] = 'N/A -- Build Failed' + break else: result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: - imageSize = float(result.group('size')) - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - self.allImagesSize[image] = str(round(imageSize,1)) + ' kbytes' - else: - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize[image] = str(round(imageSize,1)) + ' Mbytes' - else: - imageSize = imageSize / 1000 - logging.debug('\u001B[1m ' + image + ' size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - self.allImagesSize[image] = str(round(imageSize,1)) + ' Gbytes' + size = float(result.group("size")) / 1000000 + imageSizeStr = f'{size:.1f}' + logging.debug(f'\u001B[1m {image} size is {imageSizeStr} Mbytes\u001B[0m') + allImagesSize[image] = f'{imageSizeStr} Mbytes' else: - logging.debug('ran-base size is unknown') - self.allImagesSize[image] = 'unknown' + logging.debug(f'{image} size is unknown') + allImagesSize[image] = 'unknown' # Now pruning dangling images in between target builds mySSH.command(self.cli + ' image prune --force', '\$', 30) @@ -416,17 +396,16 @@ class Containerize(): mySSH.close() # Analyze the logs - images = ['ran-base'] + [tpl[0] for tpl in imageNames] - collectInfo = AnalyzeBuildLogs(build_log_name, images, status) + collectInfo = AnalyzeBuildLogs(build_log_name, attemptedImages, status) if status: logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) else: logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) HTML.CreateHtmlTabFooter(False) sys.exit(1) @@ -552,13 +531,14 @@ class Containerize(): collectInfo['proxy'] = files mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' proxy:' + tag, '\$', 5) result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) + allImagesSize = {} if result is not None: imageSize = float(result.group('size')) / 1000000 logging.debug('\u001B[1m proxy size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize['proxy'] = str(round(imageSize,1)) + ' Mbytes' + allImagesSize['proxy'] = str(round(imageSize,1)) + ' Mbytes' else: logging.debug('proxy size is unknown') - self.allImagesSize['proxy'] = 'unknown' + allImagesSize['proxy'] = 'unknown' # Cleaning any created tmp volume mySSH.command(self.cli + ' volume prune --force || true','\$', 15) @@ -566,7 +546,7 @@ class Containerize(): logging.info('\u001B[1m Building L2sim Proxy Image Pass\u001B[0m') HTML.CreateHtmlTestRow('commit ' + tag, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) def Copy_Image_to_Test_Server(self, HTML): imageTag = 'develop' From 01add24beeb150c2526eada0a684524d5215919b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 29 Aug 2022 13:31:41 +0200 Subject: [PATCH 09/22] GetParametersFromXML(): simplify forced_workspace_cleanup reading --- ci-scripts/main.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 9349a3decc..8b18989a26 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -106,16 +106,11 @@ def GetParametersFromXML(action): RAN.Build_eNB_args=test.findtext('Build_eNB_args') CONTAINERS.imageKind=test.findtext('kind') forced_workspace_cleanup = test.findtext('forced_workspace_cleanup') - if (forced_workspace_cleanup is None): - RAN.Build_eNB_forced_workspace_cleanup=False - CONTAINERS.forcedWorkspaceCleanup=False - else: - if re.match('true', forced_workspace_cleanup, re.IGNORECASE): - RAN.Build_eNB_forced_workspace_cleanup=True - CONTAINERS.forcedWorkspaceCleanup=True - else: - RAN.Build_eNB_forced_workspace_cleanup=True - CONTAINERS.forcedWorkspaceCleanup=False + RAN.Build_eNB_forced_workspace_cleanup=False + CONTAINERS.forcedWorkspaceCleanup=False + if forced_workspace_cleanup is not None and re.match('true', forced_workspace_cleanup, re.IGNORECASE): + RAN.Build_eNB_forced_workspace_cleanup = True + CONTAINERS.forcedWorkspaceCleanup = True eNB_instance=test.findtext('eNB_instance') if (eNB_instance is None): RAN.eNB_instance=0 From 0e9455b721906a6ebd487227e745e4b5db300345 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 8 Aug 2022 18:55:46 +0200 Subject: [PATCH 10/22] Update README.md --- openshift/README.md | 120 +++++++++++++------------ openshift/oai-enb-rh8-image-stream.yml | 30 ------- openshift/oai-ran-rh8-image-stream.yml | 30 ------- 3 files changed, 65 insertions(+), 115 deletions(-) delete mode 100644 openshift/oai-enb-rh8-image-stream.yml delete mode 100644 openshift/oai-ran-rh8-image-stream.yml diff --git a/openshift/README.md b/openshift/README.md index b7409ab945..8b904127cd 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -1,32 +1,27 @@ - - - - - -
- - - - - - OpenShift Build and Usage Procedures -
+# 1. Introduction ------ +## General -**CAUTION: this is experimental. Still a lot to be done.** +What follows is a tutorial on how to build images on an OpenShift cluster in a three-step process +(base image, build artifact image, target image). Note that all image +streams/build configs assume the OC project/namespace `oaicicd-ran`. ------ +If you want to regenerate images from modified sources, you have to rebuild +the ran-build image. If you reinstalled dependencies, you have to restart from +ran-base. -# 1. Build pre-requisites # +You first need to login. Do: +```bash +oc login -u -p --server +``` -To build our RAN images, we SHALL use the `codeready-builder-for-rhel-8-x86_64-rpms` repository with all the proper development libraries. +## RHEL8 Entitlements +To build the RAN images, we use the `codeready-builder-for-rhel-8-x86_64-rpms` repository with all the proper development libraries. This repository is not directly accessible from the UBI RHEL8 image (`registry.access.redhat.com/ubi8/ubi:latest`). +Therefore, we need to copy certificates and subscription manager configuration files from a registered RHEL8 machine. -So we need to copy from a register RHEL8 machine certificates and subsccription manager configuration files. - -SO on a `RHEL8` physical machine (or a virtual machine) connected to the OpenShift Cluster, recover the entitlement and the RH subscription manager configs: +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 @@ -35,9 +30,10 @@ 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. - -**CAUTION: these files expire every month or so. If you have done a build on your OC project and try again a few weeks later, you may need to re-copy them**. +These configmaps and secret will be shared by all the build configs in your OC +project. No need to do it each time. However, these files expire every month +or so. If you have done a build on your OC project and try again a few weeks +later, you may need to re-copy them. (The CI recopies them every time.) ```bash oc delete secret etc-pki-entitlement @@ -45,55 +41,69 @@ oc delete cm rhsm-conf oc delete cm rhsm-ca ``` -**LAST POINT: your OC project SHALL be `oai`.** +# 2. Build of `base` shared image -# 2. Build the Builder shared image # - -In our Eurecom/OSA environment we need to pass a GIT proxy. - -2 things are impacted by this situation: - -* In `openshift/oai-ran-rh8-build-config.yml` file - * `httpProxy: http://proxy.eurecom.fr:8080` - * `httpsProxy: https://proxy.eurecom.fr:8080` -* Add a environment variable to the build config +Create an image stream and build config that specify image properties and build parameters, then start the build: ```bash -oc apply -f openshift/oai-ran-rh8-image-stream.yml -oc apply -f openshift/oai-ran-rh8-build-config.yml -oc set env bc/oai-ran-rhel8-build-config NEEDED_GIT_PROXY=http://proxy.eurecom.fr:8080 -oc start-build oai-ran-rhel8-build-config --follow +oc create -f openshift/ran-base-is.yaml +oc create -f openshift/ran-base-bc.yaml +oc start-build ran-base --from-file= --follow ``` -In case you do NOT require a GIT proxy: **you SHALL remove the 2 lines in `openshift/oai-ran-rh8-build-config.yml` file.** +The `--from-file=` uploads the repository (from which the +build is done) as a binary blob. It is therefore possible to make +merges or other modifications and build an image. -And no need to add a `NEEDED_GIT_PROXY` variable to the build config. +# 3. Build of `build` shared image + +The same as for the `base` image. ```bash -oc apply -f openshift/oai-ran-rh8-image-stream.yml -oc apply -f openshift/modified-oai-ran-rh8-build-config.yml -oc start-build oai-ran-rhel8-build-config --follow +oc create -f openshift/ran-build-is.yaml +oc create -f openshift/ran-build-bc.yaml +oc start-build ran-build --from-file= --follow ``` -After a while it should be successful. +# 4. Build of a target image -# 3. Build an OAI target image # - -For the example the eNB: +The same as for the `base` image: ```bash -oc apply -f openshift/oai-enb-rh8-image-stream.yml -oc apply -f openshift/oai-enb-rh8-build-config.yml -oc start-build oai-enb-rh8-build-config --follow +oc create -f openshift/oai-gnb-is.yaml +oc create -f openshift/oai-gnb-bc.yaml +oc start-build oai-gnb --from-file= --follow ``` -**CAUTION: if you are pushing modifications to the branch you are using, it won't be taken into account besides the Dockerfile.** +# 5. Retrieval of Build Container Images and Build Artifacts -**Because the source files are copied during the shared image creation.** +Build artifacts, such as build logs, can be retrieved by checking the logs of +the individual build steps. For example, for the `ran-build` step, you can do: +```bash +oc logs ran-build-1-build +``` +where `ran-build-1-build` is the name of the `ran-build` build (type `oc get +pods` to get a list of all pods). -**Only way to regenerate images w/ modified source code is to re-start from step #2.** +It is also possible to retrieve the build logs from a running pod. Currently, +this is only used for the `ran-base` step (the others using a python script to +scrape it from stdout): +```bash +oc create -f openshift/ran-base-log-retrieval.yaml +oc rsync ran-base-log-retrieval:/oai-ran/cmake_targets/log cmake_targets/log/ran-base +oc delete -f openshift/ran-base-log-retrieval.yaml +``` -# 4. Deployment using HELM charts # +The images are uploaded into the OpenShift image registry. To download, login +using podman, then pull an image: +```bash +oc whoami -t | sudo podman login -u --password-stdin --tls-verify=false +sudo podman pull /oaicicd-ran/: --tls-verify=false +sudo podman logout +``` +The `` could be `oai-gnb`, and the `` `ci-temp`. + +# 6. Deployment using HELM Charts **CAUTION: even more experimental.** diff --git a/openshift/oai-enb-rh8-image-stream.yml b/openshift/oai-enb-rh8-image-stream.yml deleted file mode 100644 index 9d1cfebd54..0000000000 --- a/openshift/oai-enb-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-enb - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-ran-rh8-image-stream.yml b/openshift/oai-ran-rh8-image-stream.yml deleted file mode 100644 index f6f4f8614f..0000000000 --- a/openshift/oai-ran-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-ran - namespace: oai -status: - tag: rhel8-latest - From ebdbb1fc1386745334a63dfbff0c5ab468952943 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 29 Aug 2022 14:48:47 +0200 Subject: [PATCH 11/22] Physim: image is already on openshift image registry --- ci-scripts/cls_physim1.py | 73 --------------------------------------- 1 file changed, 73 deletions(-) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0f187a4633..56934fcd22 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -115,30 +115,6 @@ class PhySim: mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) else: imageTag = "develop" - # Check if image is exist on the Red Hat server, before pushing it to OC cluster - mySSH.command('sudo podman image inspect --format="Size = {{.Size}} bytes" oai-physim:' + imageTag, '\$', 60) - if mySSH.getBefore().count('no such image') != 0: - logging.error('\u001B[1m No such image oai-physim\u001B[0m') - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.PHYSIM_IMAGE_ABSENT) - RAN.prematureExit = True - return - else: - result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) - if result is not None: - imageSize = float(result.group('size')) - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - else: - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - else: - imageSize = imageSize / 1000 - logging.debug('\u001B[1m oai-physim is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - else: - logging.debug('oai-physim size is unknown') # logging to OC Cluster and then switch to corresponding project mySSH.command(f'oc login -u {ocUserName} -p {ocPassword} --server https://api.oai.cs.eurecom.fr:6443', '\$', 30) @@ -161,46 +137,7 @@ class PhySim: else: logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m') - # Tag the image and push to the OC cluster - mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/ --tls-verify=false', '\$', 30) - if mySSH.getBefore().count('Login Succeeded!') == 0: - logging.error('\u001B[1m Podman Login to OC Cluster Registry Failed\u001B[0m') - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) - RAN.prematureExit = True - return - else: - logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') - time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-is.yml || true', '\$', 30) - if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: - logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) - RAN.prematureExit = True - return - else: - logging.debug(f'\u001B[1m Image Stream "oai-physim" created on OC project {ocProjectName}\u001B[0m') - time.sleep(2) - mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) - time.sleep(2) - mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) - if mySSH.getBefore().count('Storing signatures') == 0: - logging.error('\u001B[1m Image "oai-physim" push to OC Cluster Registry Failed\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) - RAN.prematureExit = True - return - else: - logging.debug('\u001B[1m Image "oai-physim" push to OC Cluster Registry Successfully\u001B[0m') - # Using helm charts deployment - time.sleep(5) mySSH.command(f'grep -rl OAICICD_PROJECT ./charts/ | xargs sed -i -e "s#OAICICD_PROJECT#{ocProjectName}#"', '\$', 30) mySSH.command(f'sed -i -e "s#TAG#{imageTag}#g" ./charts/physims/values.yaml', '\$', 6) mySSH.command('helm install physim ./charts/physims/ 2>&1 | tee -a cmake_targets/log/physim_helm_summary.txt', '\$', 30) @@ -213,9 +150,6 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) - mySSH.command('oc delete is oai-physim', '\$', 30) - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) mySSH.close() self.AnalyzeLogFile_phySim(HTML) @@ -244,9 +178,6 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) - mySSH.command('oc delete is oai-physim', '\$', 6) - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) @@ -304,10 +235,6 @@ class PhySim: isFinished1 = True if isFinished1 == True: logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) - mySSH.command('oc delete is oai-physim', '\$', 6) - logging.debug('\u001B[1m Deleted the Image and ImageStream\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 6) mySSH.close() self.AnalyzeLogFile_phySim(HTML) From 41a9ac1119699b1fcbcb18c497fa2967687ec339 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 20 Jul 2022 17:45:00 +0200 Subject: [PATCH 12/22] Python Class for Cluster Building and Deployment --- ci-scripts/args_parse.py | 20 +- ci-scripts/cls_cluster.py | 407 +++++++++++++++++++ ci-scripts/main.py | 11 +- ci-scripts/xml_class_list.yml | 1 + ci-scripts/xml_files/cluster_image_build.xml | 35 ++ openshift/oai-physim-bc.yaml | 4 - openshift/ran-base-log-retrieval.yaml | 13 + openshift/ran-build-bc.yaml | 4 - 8 files changed, 484 insertions(+), 11 deletions(-) create mode 100644 ci-scripts/cls_cluster.py create mode 100644 ci-scripts/xml_files/cluster_image_build.xml create mode 100644 openshift/ran-base-log-retrieval.yaml diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index c0203a4c98..01e3eba465 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -41,7 +41,7 @@ import constants as CONST #----------------------------------------------------------- -def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): +def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER): py_param_file_present = False @@ -82,6 +82,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranRepository=matchReg.group(1) SCA.ranRepository=matchReg.group(1) PHYSIM.ranRepository=matchReg.group(1) + CLUSTER.ranRepository=matchReg.group(1) elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE) @@ -96,6 +97,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranAllowMerge=True SCA.ranAllowMerge=True PHYSIM.ranAllowMerge=True + CLUSTER.ranAllowMerge=True elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE) @@ -108,6 +110,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranBranch=matchReg.group(1) SCA.ranBranch=matchReg.group(1) PHYSIM.ranBranch=matchReg.group(1) + CLUSTER.ranBranch=matchReg.group(1) elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE) @@ -120,6 +123,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranCommitID=matchReg.group(1) SCA.ranCommitID=matchReg.group(1) PHYSIM.ranCommitID=matchReg.group(1) + CLUSTER.ranCommitID=matchReg.group(1) elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE) @@ -132,6 +136,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranTargetBranch=matchReg.group(1) SCA.ranTargetBranch=matchReg.group(1) PHYSIM.ranTargetBranch=matchReg.group(1) + CLUSTER.ranTargetBranch=matchReg.group(1) elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE) @@ -140,6 +145,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBIPAddress=matchReg.group(1) SCA.eNBIPAddress=matchReg.group(1) PHYSIM.eNBIPAddress=matchReg.group(1) + CLUSTER.eNBIPAddress=matchReg.group(1) elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1IPAddress=matchReg.group(1) @@ -156,6 +162,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBUserName=matchReg.group(1) SCA.eNBUserName=matchReg.group(1) PHYSIM.eNBUserName=matchReg.group(1) + CLUSTER.eNBUserName=matchReg.group(1) elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1UserName=matchReg.group(1) @@ -172,6 +179,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBPassword=matchReg.group(1) SCA.eNBPassword=matchReg.group(1) PHYSIM.eNBPassword=matchReg.group(1) + CLUSTER.eNBPassword=matchReg.group(1) elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1Password=matchReg.group(1) @@ -188,6 +196,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBSourceCodePath=matchReg.group(1) SCA.eNBSourceCodePath=matchReg.group(1) PHYSIM.eNBSourceCodePath=matchReg.group(1) + CLUSTER.eNBSourceCodePath=matchReg.group(1) elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1SourceCodePath=matchReg.group(1) @@ -260,12 +269,21 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): elif re.match('^\-\-OCUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCUserName=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCUserName = matchReg.group(1) + CLUSTER.OCUserName = matchReg.group(1) elif re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCPassword = matchReg.group(1) + CLUSTER.OCPassword = matchReg.group(1) elif re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCProjectName = matchReg.group(1) + CLUSTER.OCProjectName = matchReg.group(1) + elif re.match('^\-\-OCUrl=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-OCUrl=(.+)$', myArgv, re.IGNORECASE) + CLUSTER.OCUrl = matchReg.group(1) + elif re.match('^\-\-OCRegistry=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-OCRegistry=(.+)$', myArgv, re.IGNORECASE) + CLUSTER.OCRegistry = matchReg.group(1) elif re.match('^\-\-BuildId=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-BuildId=(.+)$', myArgv, re.IGNORECASE) RAN.BuildId = matchReg.group(1) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py new file mode 100644 index 0000000000..864fb254ea --- /dev/null +++ b/ci-scripts/cls_cluster.py @@ -0,0 +1,407 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# Python for CI of OAI-eNB + COTS-UE +# +# Required Python Version +# Python 3.x +# +# Required Python Package +# pexpect +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- +import logging +import sshconnection as SSH +import cls_oai_html +#import os +import re +import time +#import subprocess +import sys +import constants as CONST +import helpreadme as HELP +import cls_containerize + +class Cluster: + def __init__(self): + self.eNBIPAddress = "" + self.eNBSourceCodePath = "" + self.forcedWorkspaceCleanup = False + self.OCUserName = "" + self.OCPassword = "" + self.OCProjectName = "" + self.OCUrl = "https://api.oai.cs.eurecom.fr:6443" + self.OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/" + self.ranRepository = "" + self.ranBranch = "" + self.ranCommitID = "" + self.ranAllowMerge = False + self.ranTargetBranch = "" + + def _createWorkspace(self, sshSession, password, sourcePath): + # on RedHat/CentOS .git extension is mandatory + result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) + if result is not None: + full_ran_repo_name = self.ranRepository.replace('git/', 'git') + else: + full_ran_repo_name = self.ranRepository + '.git' + sshSession.command('mkdir -p ' + sourcePath, '\$', 5) + sshSession.command('cd ' + sourcePath, '\$', 5) + sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + # Raphael: here add a check if git clone or git fetch went smoothly + sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) + + sshSession.command('echo ' + password + ' | sudo -S git clean -x -d -ff', '\$', 30) + sshSession.command('mkdir -p cmake_targets/log', '\$', 5) + # if the commit ID is provided use it to point to it + if self.ranCommitID != '': + sshSession.command('git checkout -f ' + self.ranCommitID, '\$', 30) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should already been checked earlier + if (self.ranAllowMerge): + if self.ranTargetBranch == '': + if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): + sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + self.ranTargetBranch) + sshSession.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + + def _recreate_entitlements(self, sshSession): + # recreating entitlements, don't care if deletion fails + sshSession.command('oc delete secret etc-pki-entitlement', '\$', 5) + if re.search(r"not found", sshSession.getBefore()): + logging.warning("no secrets etc-pki-entitlement found, recreating") + sshSession.command('ls /etc/pki/entitlement/???????????????????.pem | tail -1', '\$', 5, silent=True) + regres1 = re.search(r"/etc/pki/entitlement/[0-9]+.pem", sshSession.getBefore()) + sshSession.command('ls /etc/pki/entitlement/???????????????????-key.pem | tail -1', '\$', 5, silent=True) + regres2 = re.search(r"/etc/pki/entitlement/[0-9]+-key.pem", sshSession.getBefore()) + if regres1 is None or regres2 is None: + logging.error("could not find entitlements") + return false + file1 = regres1.group(0) + file2 = regres2.group(0) + sshSession.command(f'oc create secret generic etc-pki-entitlement --from-file {file1} --from-file {file2}', '\$', 5) + regres = re.search(r"secret/etc-pki-entitlement created", sshSession.getBefore()) + if regres is None: + logging.error("could not create secret/etc-pki-entitlement") + return False + return True + + def _recreate_bc(self, sshSession, name, newTag, filename): + self._retag_image_statement(sshSession, name, name, newTag, filename) + sshSession.command(f'oc delete -f {filename}', '\$', 5) + sshSession.command(f'oc create -f {filename}', '\$', 5) + before = sshSession.getBefore() + if re.search('buildconfig.build.openshift.io/[a-zA-Z\-0-9]+ created', before) is not None: + return True + logging.error('error while creating buildconfig: ' + sshSession.getBefore()) + return False + + def _recreate_is(self, sshSession, name, newTag, filename): + sshSession.command(f'sed -i -e "s#tag: *latest#tag: {newTag}#" {filename}', '\$', 5) + sshSession.command(f'oc delete -f {filename}', '\$', 5) + sshSession.command(f'oc create -f {filename}', '\$', 5) + before = sshSession.getBefore() + if re.search('imagestream.image.openshift.io/[a-zA-Z\-0-9]+ created', before) is not None: + return True + logging.error('error while creating imagestream: ' + sshSession.getBefore()) + return False + + def _start_build(self, sshSession, name): + # will return "immediately" but build runs in background + # if multiple builds are started at the same time, this can take some time, however + ret = sshSession.command(f'oc start-build {name} --from-file={self.eNBSourceCodePath}', '\$', 300) + before = sshSession.getBefore() + regres = re.search(r'build.build.openshift.io/(?P[a-zA-Z0-9\-]+) started', str(before)) + if ret != 0 or before.count('Uploading finished') != 1 or regres is None: + logging.error("error during oc start-build: " + sshSession.getBefore()) + self._delete_pod(sshSession, name) + return None + return regres.group('jobname') + '-build' + + def _delete_pod(self, sshSession, shortName): + sshSession.command(f"oc get pods | grep {shortName}", '\$', 5) + regres = re.search(rf'{shortName}-[0-9]+-build', sshSession.getBefore()) + if regres is not None: + sshSession.command(f"oc delete pod {regres.group(0)}", '\$', 5) + else: + logging.warning(f"no pod found with name {shortName}") + + def _wait_build_end(self, sshSession, jobs, timeout_sec, check_interval_sec = 5): + logging.debug(f"waiting for jobs {jobs} to finish building") + while timeout_sec > 0: + # check status + for j in jobs: + sshSession.command(f'oc get pods | grep {j}', '\$', 5, silent = True) + if sshSession.getBefore().count('Completed') > 0: jobs.remove(j) + if sshSession.getBefore().count('Error') > 0: + logging.error(f'error for job {j}: ' + sshSession.getBefore()) + return False + if jobs == []: + logging.debug('all jobs completed') + return True + time.sleep(check_interval_sec) + timeout_sec -= check_interval_sec + logging.error(f"timeout while waiting for end of build of {jobs}") + return False + + def _retag_image_statement(self, sshSession, oldImage, newImage, newTag, filename): + sshSession.command(f'sed -i -e "s#{oldImage}:latest#{newImage}:{newTag}#" {filename}', '\$', 5) + + def _pull_image(self, sshSession, image, tag): + sshSession.command(f'oc whoami -t | sudo podman login -u oaicicd --password-stdin https://{self.OCRegistry} --tls-verify=false', '\$', 5, silent=True) + if sshSession.getBefore().count('Login Succeeded!') == 0: + return None + imageName = f'{self.OCRegistry}{self.OCProjectName}/{image}:{tag}' + sshSession.command(f'sudo podman pull {imageName} --tls-verify=false', '\$', 300) + pullResult = sshSession.getBefore() + sshSession.command(f'sudo podman logout https://{self.OCRegistry}', '\$', 10, silent=True) + if pullResult.count('Storing signatures') == 0: + return None + return imageName + + def _get_image_size(self, sshSession, image, tag): + # get the SHA of the image we built using the image name and its tag + sshSession.command(f'oc describe is {image} | grep -A4 {tag}', '\$', 5) + result = re.search(f'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/(?P{image}@sha256:[a-f0-9]+)', sshSession.getBefore()) + if result is None: + return -1 + imageSha = result.group("imageSha") + + # retrieve the size + sshSession.command(f'oc get -o json isimage {imageSha} | jq -Mc "{{dockerImageSize: .image.dockerImageMetadata.Size}}"', '\$', 5) + result = re.search('{"dockerImageSize":(?P[0-9]+)}', str(sshSession.getBefore())) + if result is None: + return -1 + return int(result.group("size")) + + def _deploy_pod(self, sshSession, filename, timeout = 30): + sshSession.command(f'oc create -f {filename}', '\$', 10) + result = re.search(f'pod/(?P[a-zA-Z0-9_\-]+) created', sshSession.getBefore()) + if result is None: + logging.error(f'could not deploy pod: {sshSession.getBefore()}') + return None + pod = result.group("pod") + logging.debug(f'checking if pod {pod} is in Running state') + while timeout > 0: + sshSession.command(f'oc get pod {pod} -o json | jq -Mc .status.phase', '\$', 5, silent=True) + if re.search('"Running"', sshSession.getBefore()) is not None: return pod + timeout -= 1 + time.sleep(1) + logging.error(f'pod {pod} did not reach Running state') + self._undeploy_pod(sshSession, filename) + return None + + def _undeploy_pod(self, sshSession, filename): + # to save time we start this in the background and trust that oc stops correctly + sshSession.command(f'oc delete -f {filename} &', '\$', 5) + + def BuildClusterImage(self, HTML): + if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': + HELP.GenericHelp(CONST.Version) + sys.exit(f'Insufficient Parameter: ranRepository {self.ranRepository} ranBranch {ranBranch} ranCommitID {self.ranCommitID}') + + lIpAddr = self.eNBIPAddress + lSourcePath = self.eNBSourceCodePath + if lIpAddr == '' or lSourcePath == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter: no SSH Credentials') + ocUserName = self.OCUserName + ocPassword = self.OCPassword + ocProjectName = self.OCProjectName + if ocUserName == '' or ocPassword == '' or ocProjectName == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter: no OC Credentials') + if self.OCRegistry.startswith("http") and not self.OCRegistry.endswith("/"): + sys.exit(f'ocRegistry {self.OCRegistry} should not start with http:// or https:// and end on a slash /') + + logging.debug(f'Building on cluster triggered from server: {lIpAddr}') + mySSH = SSH.SSHConnection() + mySSH.open(lIpAddr, "oaicicd", "SHOULD NOT BE NECESSARY") + + self.testCase_id = HTML.testCase_id + + # Workaround for some servers, we need to erase completely the workspace + if self.forcedWorkspaceCleanup: + mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) + self._createWorkspace(mySSH, "SHOULD NOT BE NECESSARY", lSourcePath) + + # we don't necessarily need a forced workspace cleanup, but in + # order to reduce the amount of data send to OpenShift, we + # manually delete all generated files in the workspace + mySSH.command(f'rm -rf {lSourcePath}/cmake_targets/ran_build', '\$', 30); + + baseTag = 'develop' + forceBaseImageBuild = False + imageTag = 'develop' + if self.ranAllowMerge: # merging MR branch into develop -> temporary image + imageTag = 'ci-temp' + if self.ranTargetBranch == 'develop': + # TODO IMPORTANT: delete next line, uncomment following + mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper | grep --colour=never -i INDEX', '\$', 5) + #mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base.rhel8.2 | grep --colour=never -i INDEX', '\$', 5) + result = re.search('index', mySSH.getBefore()) + if result is not None: + forceBaseImageBuild = True + baseTag = 'ci-temp' + else: + forceBaseImageBuild = True + + # logging to OC Cluster and then switch to corresponding project + mySSH.command(f'oc login -u {ocUserName} -p {ocPassword} --server {self.OCUrl}', '\$', 31) + if mySSH.getBefore().count('Login successful.') == 0: + logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + return False + + mySSH.command(f'oc project {ocProjectName}', '\$', 30) + if mySSH.getBefore().count(f'Already on project "{ocProjectName}"') == 0 and mySSH.getBefore().count(f'Now using project "{self.OCProjectName}"') == 0: + logging.error(f'\u001B[1mUnable to access OC project {ocProjectName}\u001B[0m') + mySSH.command('oc logout', '\$', 30) + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL) + return False + + self._recreate_entitlements(mySSH) + + status = True # flag to abandon compiling if any image fails + attemptedImages = [] + if forceBaseImageBuild: + self._recreate_is(mySSH, 'ran-base', baseTag, 'openshift/ran-base-is.yaml') + self._recreate_bc(mySSH, 'ran-base', baseTag, 'openshift/ran-base-bc.yaml') + ranbase_job = self._start_build(mySSH, 'ran-base') + attemptedImages += ['ran-base'] + status = ranbase_job is not None and self._wait_build_end(mySSH, [ranbase_job], 600) + if not status: logging.error('failure during build of ran-base') + mySSH.command(f'oc logs {ranbase_job} > cmake_targets/log/ran-base.log', '\$', 10) + # recover logs by mounting image + self._retag_image_statement(mySSH, 'ran-base', 'ran-base', baseTag, 'openshift/ran-base-log-retrieval.yaml') + pod = self._deploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') + if pod is not None: + mySSH.command(f'mkdir -p cmake_targets/log/ran-base', '\$', 5) + mySSH.command(f'oc rsync {pod}:/oai-ran/cmake_targets/log cmake_targets/log/ran-base', '\$', 5) + self._undeploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') + else: + status = False + + if status: + self._recreate_is(mySSH, 'oai-physim', imageTag, 'openshift/oai-physim-is.yaml') + self._recreate_bc(mySSH, 'oai-physim', imageTag, 'openshift/oai-physim-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.phySim.rhel8.2') + physim_job = self._start_build(mySSH, 'oai-physim') + attemptedImages += ['oai-physim'] + + self._recreate_is(mySSH, 'ran-build', imageTag, 'openshift/ran-build-is.yaml') + self._recreate_bc(mySSH, 'ran-build', imageTag, 'openshift/ran-build-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.build.rhel8.2') + ranbuild_job = self._start_build(mySSH, 'ran-build') + attemptedImages += ['ran-build'] + + wait = ranbuild_job is not None and physim_job is not None and self._wait_build_end(mySSH, [ranbuild_job, physim_job], 1200) + if not wait: logging.error('error during build of ranbuild_job or physim_job') + status = status and wait + mySSH.command(f'oc logs {ranbuild_job} > cmake_targets/log/ran-build.log', '\$', 10) + mySSH.command(f'oc logs {physim_job} > cmake_targets/log/oai-physim.log', '\$', 10) + + if status: + self._recreate_is(mySSH, 'oai-enb', imageTag, 'openshift/oai-enb-is.yaml') + self._recreate_bc(mySSH, 'oai-enb', imageTag, 'openshift/oai-enb-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.eNB.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.eNB.rhel8.2') + enb_job = self._start_build(mySSH, 'oai-enb') + attemptedImages += ['oai-enb'] + + self._recreate_is(mySSH, 'oai-gnb', imageTag, 'openshift/oai-gnb-is.yaml') + self._recreate_bc(mySSH, 'oai-gnb', imageTag, 'openshift/oai-gnb-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.gNB.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.gNB.rhel8.2') + gnb_job = self._start_build(mySSH, 'oai-gnb') + attemptedImages += ['oai-gnb'] + + self._recreate_is(mySSH, 'oai-lte-ue', imageTag, 'openshift/oai-lte-ue-is.yaml') + self._recreate_bc(mySSH, 'oai-lte-ue', imageTag, 'openshift/oai-lte-ue-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.lteUE.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.lteUE.rhel8.2') + lteue_job = self._start_build(mySSH, 'oai-lte-ue') + attemptedImages += ['oai-lte-ue'] + + self._recreate_is(mySSH, 'oai-nr-ue', imageTag, 'openshift/oai-nr-ue-is.yaml') + self._recreate_bc(mySSH, 'oai-nr-ue', imageTag, 'openshift/oai-nr-ue-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.nrUE.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.nrUE.rhel8.2') + nrue_job = self._start_build(mySSH, 'oai-nr-ue') + attemptedImages += ['oai-nr-ue'] + + wait = enb_job is not None and gnb_job is not None and lteue_job is not None and nrue_job is not None and self._wait_build_end(mySSH, [enb_job, gnb_job, lteue_job, nrue_job], 600) + if not wait: logging.error('error during build of eNB/gNB/lteUE/nrUE') + status = status and wait + # recover logs + mySSH.command(f'oc logs {enb_job} > cmake_targets/log/oai-enb.log', '\$', 10) + mySSH.command(f'oc logs {gnb_job} > cmake_targets/log/oai-gnb.log', '\$', 10) + mySSH.command(f'oc logs {lteue_job} > cmake_targets/log/oai-lte-ue.log', '\$', 10) + mySSH.command(f'oc logs {nrue_job} > cmake_targets/log/oai-nr-ue.log', '\$', 10) + + # split and analyze logs + imageSize = {} + for image in attemptedImages: + mySSH.command(f'mkdir -p cmake_targets/log/{image}', '\$', 5) + mySSH.command(f'python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/{image}.log', '\$', 5) + tag = imageTag if image != 'ran-base' else baseTag + size = self._get_image_size(mySSH, image, tag) + if size <= 0: + imageSize[image] = 'unknown -- BUILD FAILED' + status = False + else: + sizeMb = float(size) / 1000000 + imageSize[image] = f'{sizeMb:.1f} Mbytes (uncompressed: ~{sizeMb*2.5:.1f} Mbytes)' + logging.info(f'\u001B[1m{image} size is {imageSize[image]}\u001B[0m') + + build_log_name = f'build_log_{self.testCase_id}' + cls_containerize.CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, 'oaicicd', 'SHOULD NOT MATTER') + + mySSH.command('for pod in $(oc get pods | tail -n +2 | awk \'{print $1}\'); do oc delete pod ${pod}; done', '\$', 60) + + mySSH.command('oc logout', '\$', 30) + mySSH.close() + + # Analyze the logs + collectInfo = cls_containerize.AnalyzeBuildLogs(build_log_name, attemptedImages, status) + for img in collectInfo: + for f in collectInfo[img]: + status = status and collectInfo[img][f]['status'] + if not status: + logging.debug(collectInfo) + + if status: + logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') + HTML.CreateHtmlTestRow('all', 'OK', CONST.ALL_PROCESSES_OK) + else: + logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') + HTML.CreateHtmlTestRow('all', 'KO', CONST.ALL_PROCESSES_OK) + + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, imageSize) + + return status diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 8b18989a26..b5d0ef2d97 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -45,6 +45,7 @@ import cls_containerize #class Containerize for all container-based oper import cls_static_code_analysis #class for static code analysis import cls_ci_ueinfra #class defining the multi Ue infrastrucure import cls_physim1 #class PhySim for physical simulators deploy and run +import cls_cluster # class for building/deploying on cluster import sshconnection import epc @@ -102,15 +103,17 @@ def AssignParams(params_dict): def GetParametersFromXML(action): - if action == 'Build_eNB' or action == 'Build_Image' or action == 'Build_Proxy': + if action == 'Build_eNB' or action == 'Build_Image' or action == 'Build_Proxy' or action == "Build_Cluster_Image": RAN.Build_eNB_args=test.findtext('Build_eNB_args') CONTAINERS.imageKind=test.findtext('kind') forced_workspace_cleanup = test.findtext('forced_workspace_cleanup') RAN.Build_eNB_forced_workspace_cleanup=False CONTAINERS.forcedWorkspaceCleanup=False + CLUSTER.forcedWorkspaceCleanup = False if forced_workspace_cleanup is not None and re.match('true', forced_workspace_cleanup, re.IGNORECASE): RAN.Build_eNB_forced_workspace_cleanup = True CONTAINERS.forcedWorkspaceCleanup = True + CLUSTER.forcedWorkspaceCleanup = True eNB_instance=test.findtext('eNB_instance') if (eNB_instance is None): RAN.eNB_instance=0 @@ -529,6 +532,7 @@ HTML = cls_oai_html.HTMLManagement() CONTAINERS = cls_containerize.Containerize() SCA = cls_static_code_analysis.StaticCodeAnalysis() PHYSIM = cls_physim1.PhySim() +CLUSTER = cls_cluster.Cluster() ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build @@ -538,7 +542,7 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b #----------------------------------------------------------- import args_parse -py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM) +py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER) @@ -926,6 +930,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re HTML=ldpc.Run_NRulsimTest(HTML,CONST,id) if ldpc.exitStatus==1: RAN.prematureExit = True + elif action == 'Build_Cluster_Image': + if not CLUSTER.BuildClusterImage(HTML): + RAN.prematureExit = True elif action == 'Build_Image': CONTAINERS.BuildImage(HTML) elif action == 'Build_Proxy': diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index f9894d501f..6497fd3020 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -1,4 +1,5 @@ - Build_Proxy + - Build_Cluster_Image - Build_PhySim - Run_LDPCTest - Run_NRulsimTest diff --git a/ci-scripts/xml_files/cluster_image_build.xml b/ci-scripts/xml_files/cluster_image_build.xml new file mode 100644 index 0000000000..057d49da86 --- /dev/null +++ b/ci-scripts/xml_files/cluster_image_build.xml @@ -0,0 +1,35 @@ + + + + build-tab + Build Images on Cluster + wrench + 000001 + + + + Build_Cluster_Image + Build Images on OpenShift Cluster + + + diff --git a/openshift/oai-physim-bc.yaml b/openshift/oai-physim-bc.yaml index 050dd8bca8..e013a20fd3 100644 --- a/openshift/oai-physim-bc.yaml +++ b/openshift/oai-physim-bc.yaml @@ -31,10 +31,6 @@ spec: strategy: dockerStrategy: dockerfilePath: "docker/Dockerfile.phySim.rhel8.2" - from: - kind: ImageStreamTag - namespace: oaicicd-ran - name: oai-ran-base:latest output: to: kind: "ImageStreamTag" diff --git a/openshift/ran-base-log-retrieval.yaml b/openshift/ran-base-log-retrieval.yaml new file mode 100644 index 0000000000..7fc1d78cc6 --- /dev/null +++ b/openshift/ran-base-log-retrieval.yaml @@ -0,0 +1,13 @@ +# Creating a pod to retrieve ran-base logs +apiVersion: v1 +kind: Pod +metadata: + name: ran-base-log-retrieval + namespace: oaicicd-ran +spec: + containers: + - name: logcontainer + image: ran-base:latest + command: ["/bin/sh", "-c"] + args: + ["sleep inf"] diff --git a/openshift/ran-build-bc.yaml b/openshift/ran-build-bc.yaml index db144569b6..84b0f9e589 100644 --- a/openshift/ran-build-bc.yaml +++ b/openshift/ran-build-bc.yaml @@ -31,10 +31,6 @@ spec: strategy: dockerStrategy: dockerfilePath: "docker/Dockerfile.build.rhel8.2" - from: - kind: ImageStreamTag # Use an imagestream tag as 'FROM' - namespace: oaicicd-ran # Which project? - name: oai-ran-base:latest # Use the imagestream created above output: to: kind: "ImageStreamTag" From 07783676339325c394fbe1dbc6e0be836ff3ec87 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 2 Sep 2022 13:21:04 +0200 Subject: [PATCH 13/22] Add Jenkinsfile for cluster jobs --- ci-scripts/Jenkinsfile-cluster | 254 +++++++++++++++++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 ci-scripts/Jenkinsfile-cluster diff --git a/ci-scripts/Jenkinsfile-cluster b/ci-scripts/Jenkinsfile-cluster new file mode 100644 index 0000000000..e3f7da6141 --- /dev/null +++ b/ci-scripts/Jenkinsfile-cluster @@ -0,0 +1,254 @@ +#!/bin/groovy +/* + * 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 + */ + +// Location of the executor node +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the resource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch + +def directoryExistsGlob(fileNameWithGlob) { + /* if multiple directories match, will join their names and call fileExists() on that */ + def dir = sh returnStdout: true, script: 'find . -name \'' + fileNameWithGlob + '\' -type d' + dir = dir.replaceAll("\n", "").trim() + echo "matching '" + fileNameWithGlob + "' found: '" + dir + "'" + if (dir == "") + return false + return fileExists(dir) +} + +//------------------------------------------------------------------------------- +// Pipeline start +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + timestamps() + ansiColor('xterm') + lock(extra: lockResources) + } + + stages { + stage ('Verify Parameters') { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + + JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"' + JOB_TIMESTAMP = JOB_TIMESTAMP.trim() + + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false + } + if (params.eNB_IPAddress == null) { + echo "no eNB_IPAddress given" + allParametersPresent = false + } + if (params.eNB_SourceCodePath == null) { + echo "no eNB_SourceCodePath given" + allParametersPresent = false + } + if (params.eNB_Credentials == null) { + echo "no eNB_Credentials given" + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + if (params.eNB_CommitID == null) { + eNB_CommitID = env.GIT_COMMIT + } else { + eNB_CommitID = params.eNB_CommitID + } + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_mergeRequest != null) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } else { + echo "no eNB_mergeRequest given - not merging develop" + } + + if (params.EPC_IPAddress == null) { + echo "no EPC_IPAddress given" + allParametersPresent = false + } + if (params.EPC_Type == null) { + echo "no EPC_Type given" + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + echo "no EPC_SourceCodePath given" + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + echo "no EPC_Credentials given" + allParametersPresent = false + } + + if (params.ADB_IPAddress == null) { + echo "no ADB_IPAddress given" + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + echo "no ADB_IPAddress given" + allParametersPresent = false + } + if (params.OC_Credentials == null) { + echo "no OC_Credentials given" + allParametersPresent = false + } + if (params.OC_ProjectName == null) { + echo "no OC_ProjectName given" + allParametersPresent = false + } + if (params.pythonTestXmlFile == null) { + echo "no pythonTestXmlFile given" + allParametersPresent = false + } + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + + stage ("Deploy and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" + } + } + } + } + } + stage ("Log Collection") { + steps { + script { + dir ('ci-scripts') { + if (directoryExistsGlob("build_log_*")) { + sh "zip -r -qq build_log_${env.BUILD_ID}.zip build_log_*/*" + sh "rm -rf build_log_*/" + archiveArtifacts artifacts: "build_log_${env.BUILD_ID}.zip" + } + if (directoryExistsGlob("test_log_*")) { + sh "zip -r -qq test_log_${env.BUILD_ID}.zip test_log_*/*" + sh "rm -rf test_log_*/" + archiveArtifacts artifacts: "test_log_${env.BUILD_ID}.zip" + } + if (fileExists("test_results.html")) { + sh "mv test_results.html test_results-${env.JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts artifacts: "test_results-${env.JOB_NAME}.html" + } + } + } + } + } + } +} From 5008eb4e38b448a792582583a8a2d398b38386f7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 15:11:33 +0200 Subject: [PATCH 14/22] Switch to RHEL8-Cluster-Image-Builder in RAN-Container-Parent --- ci-scripts/Jenkinsfile-GitLab-Container | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 89665f292f..c8fb565488 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -136,16 +136,16 @@ pipeline { } } } - stage ("RHEL8 Build") { + stage ("RHEL8-Cluster-Image-Builder") { steps { script { - triggerSlaveJob ('RAN-RHEL8-Image-Builder', 'RHEL8-Images-Build') + triggerSlaveJob ('RAN-RHEL8-Cluster-Image-Builder', 'RHEL8-Cluster-Image-Builder') } } post { always { script { - finalizeSlaveJob('RAN-RHEL8-Image-Builder') + finalizeSlaveJob('RAN-RHEL8-Cluster-Image-Builder') } } failure { From 6ac9296a12f7a749824a2818f8821d17d5325d8d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 15:39:23 +0200 Subject: [PATCH 15/22] Update TESTBenches.doc --- doc/TESTBenches.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index c9a9870953..dd14817863 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -105,8 +105,9 @@ Webhook - [RAN-RF-Sim-Test-5G](https://jenkins-oai.eurecom.fr/job/RAN-RF-Sim-Test-5G/) - obelix (gNB, 2x UE, OAI 5GC) - uses RFsimulator, TDD 40MHz, FDD 40MHz, F1 split -- [RAN-RHEL8-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-RHEL8-Image-Builder/) - - asterix: RHEL 8 image build using podman +- [RAN-RHEL8-Cluster-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-RHEL8-Cluster-Image-Builder/) + - asterix (`Asterix-OC-oaicicd-session` resource): RHEL 8 image build using + the OpenShift in Eurecom - [RAN-Ubuntu18-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu18-Image-Builder/) - obelix: Ubuntu 18 image build using docker From 11d24ff42c1e6b278082ea6c905fc81067e55e9d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 09:39:14 +0200 Subject: [PATCH 16/22] Correct copy path for ran-base logs --- ci-scripts/cls_cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 864fb254ea..ed7514e3bc 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -302,7 +302,7 @@ class Cluster: pod = self._deploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') if pod is not None: mySSH.command(f'mkdir -p cmake_targets/log/ran-base', '\$', 5) - mySSH.command(f'oc rsync {pod}:/oai-ran/cmake_targets/log cmake_targets/log/ran-base', '\$', 5) + mySSH.command(f'oc rsync {pod}:/oai-ran/cmake_targets/log/ cmake_targets/log/ran-base', '\$', 5) self._undeploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') else: status = False From c1fb4b6c270ce64405d87bc94adad1769a5b6870 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 09:40:17 +0200 Subject: [PATCH 17/22] Run oc logout in background to avoid timeout --- ci-scripts/cls_cluster.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index ed7514e3bc..debe4c238b 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -384,7 +384,8 @@ class Cluster: mySSH.command('for pod in $(oc get pods | tail -n +2 | awk \'{print $1}\'); do oc delete pod ${pod}; done', '\$', 60) - mySSH.command('oc logout', '\$', 30) + # logout will return eventually, but we don't care when -> start in background + mySSH.command('oc logout &', '\$', 5) mySSH.close() # Analyze the logs From 879d37b2de6eb7ea24232cdb65cd1adf2753d281 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:21:55 +0200 Subject: [PATCH 18/22] Enable testing for all files to force ran-base rebuild --- ci-scripts/cls_cluster.py | 4 +--- ci-scripts/cls_oai_html.py | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index debe4c238b..519769d0a7 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -259,9 +259,7 @@ class Cluster: if self.ranAllowMerge: # merging MR branch into develop -> temporary image imageTag = 'ci-temp' if self.ranTargetBranch == 'develop': - # TODO IMPORTANT: delete next line, uncomment following - mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper | grep --colour=never -i INDEX', '\$', 5) - #mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base.rhel8.2 | grep --colour=never -i INDEX', '\$', 5) + mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base.rhel8.2 | grep --colour=never -i INDEX', '\$', 5) result = re.search('index', mySSH.getBefore()) if result is not None: forceBaseImageBuild = True diff --git a/ci-scripts/cls_oai_html.py b/ci-scripts/cls_oai_html.py index 13a1ab8691..536f2ff49e 100644 --- a/ci-scripts/cls_oai_html.py +++ b/ci-scripts/cls_oai_html.py @@ -453,13 +453,11 @@ class HTMLManagement(): self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') elif (parameters['warnings'] == 0): self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') - elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') else: - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') + self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') if (parameters['errors'] == 0) and (parameters['warnings'] == 0): self.htmlFile.write(' OK \n') - elif (parameters['errors'] == 0) and ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): + elif (parameters['errors'] == 0): self.htmlFile.write(' OK \n') else: self.htmlFile.write(' NOT OK \n') From 68c6a7932869b03ba8383e423dfca0e9d8d75c02 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:26:36 +0200 Subject: [PATCH 19/22] Replace hard-coded (unused) password with a constant The plan is to migrate the CI to not need any passwords. This constant can be used to give a dummy password. --- ci-scripts/cls_cluster.py | 4 ++-- ci-scripts/constants.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 519769d0a7..a126c74590 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -246,7 +246,7 @@ class Cluster: # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) - self._createWorkspace(mySSH, "SHOULD NOT BE NECESSARY", lSourcePath) + self._createWorkspace(mySSH, CONST.CI_NO_PASSWORD, lSourcePath) # we don't necessarily need a forced workspace cleanup, but in # order to reduce the amount of data send to OpenShift, we @@ -378,7 +378,7 @@ class Cluster: logging.info(f'\u001B[1m{image} size is {imageSize[image]}\u001B[0m') build_log_name = f'build_log_{self.testCase_id}' - cls_containerize.CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, 'oaicicd', 'SHOULD NOT MATTER') + cls_containerize.CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, 'oaicicd', CONST.CI_NO_PASSWORD) mySSH.command('for pod in $(oc get pods | tail -n +2 | awk \'{print $1}\'); do oc delete pod ${pod}; done', '\$', 60) diff --git a/ci-scripts/constants.py b/ci-scripts/constants.py index a7ce01615e..17a4ea33fa 100644 --- a/ci-scripts/constants.py +++ b/ci-scripts/constants.py @@ -79,3 +79,7 @@ X2_HO_REQ_STATE__TARGET_RECEIVES_REQ = 1 X2_HO_REQ_STATE__TARGET_RRC_RECFG_COMPLETE = 2 X2_HO_REQ_STATE__TARGET_SENDS_SWITCH_REQ = 3 X2_HO_REQ_STATE__SOURCE_RECEIVES_REQ_ACK = 10 + +# placeholder for a "don't care" password to gradually transition to +# passwordless CI +CI_NO_PASSWORD = "CIPASSWORDDONTCARE" From c01d846a3a47f3eb0a9d4011cd5a7d83eb75b875 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:28:50 +0200 Subject: [PATCH 20/22] Reintroduce banner in README --- openshift/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openshift/README.md b/openshift/README.md index 8b904127cd..09ae0c941d 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -1,3 +1,17 @@ + + + + + +
+ + + + + + OpenShift Build and Usage Procedures +
+ # 1. Introduction ## General From d0e5786470d2c8960aa1024708ba3bda6faca674 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:31:46 +0200 Subject: [PATCH 21/22] Improve wording in openshift/README.md --- openshift/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openshift/README.md b/openshift/README.md index 09ae0c941d..481dc5e4fe 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -66,8 +66,8 @@ oc start-build ran-base --from-file= --follow ``` The `--from-file=` uploads the repository (from which the -build is done) as a binary blob. It is therefore possible to make -merges or other modifications and build an image. +build is done) as a binary blob. It is therefore possible to make merges or +other (local) modifications and build an image. # 3. Build of `build` shared image From 3bb312dce2995f90948a6cb1cda163d17a4c2089 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 11:23:21 +0200 Subject: [PATCH 22/22] Help function for creating repository workspace --- ci-scripts/cls_cluster.py | 31 +--------------- ci-scripts/cls_containerize.py | 64 +++++++++++++++++----------------- 2 files changed, 33 insertions(+), 62 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index a126c74590..86edfbe568 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -59,35 +59,6 @@ class Cluster: self.ranAllowMerge = False self.ranTargetBranch = "" - def _createWorkspace(self, sshSession, password, sourcePath): - # on RedHat/CentOS .git extension is mandatory - result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) - if result is not None: - full_ran_repo_name = self.ranRepository.replace('git/', 'git') - else: - full_ran_repo_name = self.ranRepository + '.git' - sshSession.command('mkdir -p ' + sourcePath, '\$', 5) - sshSession.command('cd ' + sourcePath, '\$', 5) - sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) - # Raphael: here add a check if git clone or git fetch went smoothly - sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) - sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) - - sshSession.command('echo ' + password + ' | sudo -S git clean -x -d -ff', '\$', 30) - sshSession.command('mkdir -p cmake_targets/log', '\$', 5) - # if the commit ID is provided use it to point to it - if self.ranCommitID != '': - sshSession.command('git checkout -f ' + self.ranCommitID, '\$', 30) - # if the branch is not develop, then it is a merge request and we need to do - # the potential merge. Note that merge conflicts should already been checked earlier - if (self.ranAllowMerge): - if self.ranTargetBranch == '': - if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): - sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) - else: - logging.debug('Merging with the target branch: ' + self.ranTargetBranch) - sshSession.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) - def _recreate_entitlements(self, sshSession): # recreating entitlements, don't care if deletion fails sshSession.command('oc delete secret etc-pki-entitlement', '\$', 5) @@ -246,7 +217,7 @@ class Cluster: # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) - self._createWorkspace(mySSH, CONST.CI_NO_PASSWORD, lSourcePath) + cls_containerize.CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # we don't necessarily need a forced workspace cleanup, but in # order to reduce the amount of data send to OpenShift, we diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index d083b69be8..bc3d43a83e 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -52,6 +52,35 @@ import constants as CONST # Helper functions used here and in other classes # (e.g., cls_cluster.py) #----------------------------------------------------------- +def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTargetBranch, ranAllowMerge): + # on RedHat/CentOS .git extension is mandatory + result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', ranRepository) + if result is not None: + full_ran_repo_name = ranRepository.replace('git/', 'git') + else: + full_ran_repo_name = ranRepository + '.git' + sshSession.command('mkdir -p ' + sourcePath, '\$', 5) + sshSession.command('cd ' + sourcePath, '\$', 5) + sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + if sshSession.getBefore().count('done.') == 0: + logging.warning('did not find \'done.\' in git output while cloning/fetching, was not successful?') + sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) + + sshSession.command('sudo git clean -x -d -ff', '\$', 30) + sshSession.command('mkdir -p cmake_targets/log', '\$', 5) + # if the commit ID is provided use it to point to it + if ranCommitID != '': + sshSession.command('git checkout -f ' + ranCommitID, '\$', 30) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should already been checked earlier + if ranAllowMerge: + if ranTargetBranch == '': + sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + ranTargetBranch) + sshSession.command('git merge --ff origin/' + ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + def CopyLogsToExecutor(sshSession, sourcePath, log_name, scpIp, scpUser, scpPw): sshSession.command(f'cd {sourcePath}/cmake_targets', '\$', 5) sshSession.command(f'rm -f {log_name}.zip', '\$', 5) @@ -185,35 +214,6 @@ class Containerize(): # Container management functions #----------------------------------------------------------- - def _createWorkspace(self, sshSession, password, sourcePath): - # on RedHat/CentOS .git extension is mandatory - result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) - if result is not None: - full_ran_repo_name = self.ranRepository.replace('git/', 'git') - else: - full_ran_repo_name = self.ranRepository + '.git' - sshSession.command('mkdir -p ' + sourcePath, '\$', 5) - sshSession.command('cd ' + sourcePath, '\$', 5) - sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) - # Raphael: here add a check if git clone or git fetch went smoothly - sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) - sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) - - sshSession.command('echo ' + password + ' | sudo -S git clean -x -d -ff', '\$', 30) - sshSession.command('mkdir -p cmake_targets/log', '\$', 5) - # if the commit ID is provided use it to point to it - if self.ranCommitID != '': - sshSession.command('git checkout -f ' + self.ranCommitID, '\$', 30) - # if the branch is not develop, then it is a merge request and we need to do - # the potential merge. Note that merge conflicts should already been checked earlier - if (self.ranAllowMerge): - if self.ranTargetBranch == '': - if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): - sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) - else: - logging.debug('Merging with the target branch: ' + self.ranTargetBranch) - sshSession.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) - def BuildImage(self, HTML): if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': HELP.GenericHelp(CONST.Version) @@ -281,7 +281,7 @@ class Containerize(): self.testCase_id = HTML.testCase_id - self._createWorkspace(mySSH, lPassWord, lSourcePath) + CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # if asterix, copy the entitlement and subscription manager configurations if self.host == 'Red Hat': @@ -460,7 +460,7 @@ class Containerize(): self.ranCommitID = self.proxyCommit self.ranRepository = 'https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy.git' self.ranAllowMerge = False - self._createWorkspace(mySSH, lPassWord, lSourcePath) + CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # to prevent accidentally overwriting data that might be used later self.ranCommitID = oldRanCommidID self.ranRepository = oldRanRepository @@ -641,7 +641,7 @@ class Containerize(): mySSH = SSH.SSHConnection() mySSH.open(lIpAddr, lUserName, lPassWord) - self._createWorkspace(mySSH, lPassWord, lSourcePath) + CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5) mySSH.command('cp docker-compose.yml ci-docker-compose.yml', '\$', 5)