Commit 8e35d8fe authored by Raphael Defosseux's avatar Raphael Defosseux Committed by Robert Schmidt

chore(ci): post-review changes

  * Dockerfile argument is now a generic BUILD_OPTION for any build_oai available option
  * docker-compose files are only modified at deployment time. Not needed for undeployment
  * fixes for oai-nr-cuup
  * cleaner section for the private registry push
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 4db8dfaf
...@@ -384,10 +384,10 @@ class Containerize(): ...@@ -384,10 +384,10 @@ class Containerize():
if self.host == 'Ubuntu': if self.host == 'Ubuntu':
imageNames.append(('oai-lte-ru', 'lteRU', 'oai-lte-ru', '')) imageNames.append(('oai-lte-ru', 'lteRU', 'oai-lte-ru', ''))
# Building again the 5G images with Address Sanitizer # Building again the 5G images with Address Sanitizer
imageNames.append(('ran-build', 'build', 'ran-build-asan', '--build-arg "SANITIZE_OPTION=--sanitize"')) imageNames.append(('ran-build', 'build', 'ran-build-asan', '--build-arg "BUILD_OPTION=--sanitize"'))
imageNames.append(('oai-gnb', 'gNB', 'oai-gnb-asan', '--build-arg "SANITIZE_OPTION=--sanitize"')) imageNames.append(('oai-gnb', 'gNB', 'oai-gnb-asan', '--build-arg "BUILD_OPTION=--sanitize"'))
imageNames.append(('oai-nr-ue', 'nrUE', 'oai-nr-ue-asan', '--build-arg "SANITIZE_OPTION=--sanitize"')) imageNames.append(('oai-nr-ue', 'nrUE', 'oai-nr-ue-asan', '--build-arg "BUILD_OPTION=--sanitize"'))
imageNames.append(('oai-nr-cuup', 'nr-cuup', 'oai-nr-cuup-asan', '--build-arg "SANITIZE_OPTION=--sanitize"')) imageNames.append(('oai-nr-cuup', 'nr-cuup', 'oai-nr-cuup-asan', '--build-arg "BUILD_OPTION=--sanitize"'))
result = re.search('build_cross_arm64', self.imageKind) result = re.search('build_cross_arm64', self.imageKind)
if result is not None: if result is not None:
self.dockerfileprefix = '.ubuntu20.cross-arm64' self.dockerfileprefix = '.ubuntu20.cross-arm64'
...@@ -707,10 +707,11 @@ class Containerize(): ...@@ -707,10 +707,11 @@ class Containerize():
orgTag = 'develop' orgTag = 'develop'
if self.ranAllowMerge: if self.ranAllowMerge:
orgTag = 'ci-temp' orgTag = 'ci-temp'
imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup', 'oai-gnb-asan', 'oai-nr-ue-asan', 'oai-nr-cuup-asan'] for image in IMAGES:
for image in imageNames:
tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge)
mySSH.command(f'docker image tag {image}:{orgTag} {imagePrefix}/{tagToUse}', '\$', 5) mySSH.command(f'docker image tag {image}:{orgTag} {imagePrefix}/{tagToUse}', '\$', 5)
if re.search('Error response from daemon: No such image:', mySSH.getBefore()) is not None:
continue
mySSH.command(f'docker push {imagePrefix}/{tagToUse}', '\$', 120) mySSH.command(f'docker push {imagePrefix}/{tagToUse}', '\$', 120)
if re.search(': digest:', mySSH.getBefore()) is None: if re.search(': digest:', mySSH.getBefore()) is None:
logging.debug(mySSH.getBefore()) logging.debug(mySSH.getBefore())
...@@ -1070,12 +1071,16 @@ class Containerize(): ...@@ -1070,12 +1071,16 @@ class Containerize():
imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup'] imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup']
for image in imageNames: for image in imageNames:
tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge)
# Maybe we've only pulled sanitized versions of oai-gnb and oai-nr-ue # In the scenario, for 5G images, we have the choice of either pulling normal images
if image == 'oai-gnb' or image == 'oai-nr-ue': # or -asan images. We need to detect which kind we did pull.
ret = myCmd.run(f'docker image inspect oai-ci/{tagToUse}', reportNonZero=False) if image == 'oai-gnb' or image == 'oai-nr-ue' or image == 'oai-nr-cuup':
ret = myCmd.run(f'docker image inspect oai-ci/{tagToUse}', reportNonZero=False, silent=self.displayedNewTags)
if ret.returncode != 0: if ret.returncode != 0:
tagToUse = tagToUse.replace('oai-gnb', 'oai-gnb-asan') tagToUse = tagToUse.replace('oai-gnb', 'oai-gnb-asan')
tagToUse = tagToUse.replace('oai-nr-ue', 'oai-nr-ue-asan') tagToUse = tagToUse.replace('oai-nr-ue', 'oai-nr-ue-asan')
tagToUse = tagToUse.replace('oai-nr-cuup', 'oai-nr-cuup-asan')
if not self.displayedNewTags:
logging.debug(f'\u001B[1m Using sanitized version of {image} with {tagToUse}\u001B[0m')
cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@oai-ci/{tagToUse}@" docker-compose-ci.yml' cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@oai-ci/{tagToUse}@" docker-compose-ci.yml'
myCmd.run(cmd, silent=self.displayedNewTags) myCmd.run(cmd, silent=self.displayedNewTags)
self.displayedNewTags = True self.displayedNewTags = True
...@@ -1214,21 +1219,7 @@ class Containerize(): ...@@ -1214,21 +1219,7 @@ class Containerize():
logPath = '../cmake_targets/log/' + ymlPath[1] logPath = '../cmake_targets/log/' + ymlPath[1]
myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0]) myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0])
cmd = 'cp docker-compose.y*ml docker-compose-ci.yml' cmd = 'cp docker-compose.y*ml docker-compose-ci.yml'
myCmd.run(cmd, silent=self.displayedNewTags) myCmd.run(cmd)
for image in IMAGES:
tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge)
# Maybe we've only pulled sanitized versions of oai-gnb and oai-nr-ue
if image == 'oai-gnb' or image == 'oai-nr-ue':
ret = myCmd.run(f'docker image inspect oai-ci/{tagToUse}', reportNonZero=False)
if ret.returncode != 0:
tagToUse = tagToUse.replace('oai-gnb', 'oai-gnb-asan')
tagToUse = tagToUse.replace('oai-nr-ue', 'oai-nr-ue-asan')
logging.debug(f'Using sanitized version of {image} with {tagToUse}')
if image == 'oai-gnb-asan' or image == 'oai-nr-ue-asan':
continue
cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@oai-ci/{tagToUse}@" docker-compose-ci.yml'
myCmd.run(cmd, silent=self.displayedNewTags)
self.displayedNewTags = True
# check which containers are running for log recovery later # check which containers are running for log recovery later
cmd = 'docker-compose -f docker-compose-ci.yml ps --all' cmd = 'docker-compose -f docker-compose-ci.yml ps --all'
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
FROM ran-base:latest as ran-build FROM ran-base:latest as ran-build
ARG SANITIZE_OPTION ARG BUILD_OPTION
RUN rm -Rf /oai-ran RUN rm -Rf /oai-ran
WORKDIR /oai-ran WORKDIR /oai-ran
...@@ -36,6 +36,6 @@ COPY . . ...@@ -36,6 +36,6 @@ COPY . .
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
mkdir -p log && \ mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP -t Ethernet --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror $SANITIZE_OPTION && \ ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP -t Ethernet --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror $BUILD_OPTION && \
# Mainly to see if the sanitize option was perfectly executed # Mainly to see if the sanitize option was perfectly executed
ldd ran_build/build/nr-softmodem ldd ran_build/build/nr-softmodem
...@@ -32,7 +32,7 @@ FROM ran-build:latest AS enb-build ...@@ -32,7 +32,7 @@ FROM ran-build:latest AS enb-build
#start from scratch for target executable #start from scratch for target executable
FROM ubuntu:focal as oai-enb FROM ubuntu:focal as oai-enb
ARG SANITIZE_OPTION ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
...@@ -59,7 +59,7 @@ RUN apt-get update && \ ...@@ -59,7 +59,7 @@ RUN apt-get update && \
python3-requests \ python3-requests \
libusb-1.0-0 && \ libusb-1.0-0 && \
# if the --sanitize option was used to build, additional packages are required # if the --sanitize option was used to build, additional packages are required
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
libasan5 \ libasan5 \
libubsan1 \ libubsan1 \
liblapacke; fi' && \ liblapacke; fi' && \
......
...@@ -32,7 +32,7 @@ FROM ran-build:latest AS gnb-build ...@@ -32,7 +32,7 @@ FROM ran-build:latest AS gnb-build
#start from scratch for target executable #start from scratch for target executable
FROM ubuntu:focal as oai-gnb FROM ubuntu:focal as oai-gnb
ARG SANITIZE_OPTION ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe ENV TZ=Europe
...@@ -58,7 +58,7 @@ RUN apt-get update && \ ...@@ -58,7 +58,7 @@ RUN apt-get update && \
python3-requests \ python3-requests \
libusb-1.0-0 && \ libusb-1.0-0 && \
# if the --sanitize option was used to build, additional packages are required # if the --sanitize option was used to build, additional packages are required
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
libasan5 \ libasan5 \
libubsan1 \ libubsan1 \
liblapacke; fi' && \ liblapacke; fi' && \
......
...@@ -32,7 +32,7 @@ FROM ran-build:latest AS lte-ue-build ...@@ -32,7 +32,7 @@ FROM ran-build:latest AS lte-ue-build
#start from scratch for target executable #start from scratch for target executable
FROM ubuntu:focal as oai-lte-ue FROM ubuntu:focal as oai-lte-ue
ARG SANITIZE_OPTION ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
...@@ -58,7 +58,7 @@ RUN apt-get update && \ ...@@ -58,7 +58,7 @@ RUN apt-get update && \
iproute2 \ iproute2 \
iperf && \ iperf && \
# if the --sanitize option was used to build, additional packages are required # if the --sanitize option was used to build, additional packages are required
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
libasan5 \ libasan5 \
libubsan1 \ libubsan1 \
liblapacke; fi' && \ liblapacke; fi' && \
......
...@@ -31,7 +31,7 @@ FROM ran-build:latest AS gnb-build ...@@ -31,7 +31,7 @@ FROM ran-build:latest AS gnb-build
FROM ubuntu:focal as oai-nr-cuup FROM ubuntu:focal as oai-nr-cuup
ARG SANITIZE_OPTION ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe ENV TZ=Europe
...@@ -42,7 +42,7 @@ RUN apt-get update && \ ...@@ -42,7 +42,7 @@ RUN apt-get update && \
libconfig9 \ libconfig9 \
openssl && \ openssl && \
# if the --sanitize option was used to build, additional packages are required # if the --sanitize option was used to build, additional packages are required
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
libasan5 \ libasan5 \
libubsan1 \ libubsan1 \
liblapacke; fi' && \ liblapacke; fi' && \
......
...@@ -32,7 +32,7 @@ FROM ran-build:latest AS nr-ue-build ...@@ -32,7 +32,7 @@ FROM ran-build:latest AS nr-ue-build
#start from scratch for target executable #start from scratch for target executable
FROM ubuntu:focal as oai-nr-ue FROM ubuntu:focal as oai-nr-ue
ARG SANITIZE_OPTION ARG BUILD_OPTION
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
...@@ -58,7 +58,7 @@ RUN apt-get update && \ ...@@ -58,7 +58,7 @@ RUN apt-get update && \
iproute2 \ iproute2 \
iperf && \ iperf && \
# if the --sanitize option was used to build, additional packages are required # if the --sanitize option was used to build, additional packages are required
/bin/bash -c 'if [[ "$SANITIZE_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \
libasan5 \ libasan5 \
libubsan1; fi' && \ libubsan1; fi' && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
......
...@@ -46,16 +46,15 @@ For all platforms, the strategy for building docker/podman images is the same: ...@@ -46,16 +46,15 @@ For all platforms, the strategy for building docker/podman images is the same:
- Some tools (such as `ping`, `ifconfig`) - Some tools (such as `ping`, `ifconfig`)
Note that on every push to develop (i.e., typically after integrating merge Note that on every push to develop (i.e., typically after integrating merge
requests), we build all images and push them to [Docker requests), we build all images and push them to [Docker Hub](https://hub.docker.com/u/oaisoftwarealliance). To pull them, do
Hub](https://hub.docker.com/u/oaisoftwarealliance). To pull them, do
``` ```
docker pull oaisoftwarealliance/oai-gnb:develop docker pull oaisoftwarealliance/oai-gnb:develop
docker pull oaisoftwarealliance/oai-nr-ue:develop docker pull oaisoftwarealliance/oai-nr-ue:develop
docker pull oaisoftwarealliance/oai-enb:develop docker pull oaisoftwarealliance/oai-enb:develop
docker pull oaisoftwarealliance/oai-lte-ue:develop docker pull oaisoftwarealliance/oai-lte-ue:develop
``` ```
Have a look at [this Have a look at [this README](../ci-scripts/yaml_files/5g_rfsimulator/README.md) to get some
README](../ci-scripts/yaml_files/5g_rfsimulator/README.md) to get some
information on how to use the images. information on how to use the images.
# 2. File organization # # 2. File organization #
...@@ -114,12 +113,21 @@ ran-base latest 5c9c02a5b4a8 1 minute ago ...@@ -114,12 +113,21 @@ ran-base latest 5c9c02a5b4a8 1 minute ago
Note that the steps are identical for `rocky-linux`. Note that the steps are identical for `rocky-linux`.
You can also create `address-sanitizer` version of the ran-build image. This is only available for the Ubuntu-20 version. ### 3.2.1. Additional build otions
This is only available for the Ubuntu-20 version.
You can, for example, create a `sanitizer` version of the ran-build image.
```bash ```bash
docker build --target ran-build --tag ran-build:latest --file docker/Dockerfile.build.ubuntu20 --build-arg "SANITIZE_OPTION=--sanitize" . docker build --target ran-build --tag ran-build:latest --file docker/Dockerfile.build.ubuntu20 --build-arg "BUILD_OPTION=--sanitize" .
``` ```
Currently the `--sanitize` option for `build_oai` enables:
* [Address Sanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer)
* [Undefined Behavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html)
After building: After building:
```bash ```bash
...@@ -131,6 +139,8 @@ ran-build latest f2633a7f5102 1 minute ago ...@@ -131,6 +139,8 @@ ran-build latest f2633a7f5102 1 minute ago
Note that the image is much bigger. Note that the image is much bigger.
You can also use this docker build arguments to pass any available option(s) on the `build-oai` script.
## 3.3. Building any target image ## ## 3.3. Building any target image ##
For example, the eNB: For example, the eNB:
...@@ -161,7 +171,7 @@ Note that the steps are identical for `rocky-linux`. ...@@ -161,7 +171,7 @@ Note that the steps are identical for `rocky-linux`.
If you have used the sanitizer option, then you should also pass it when building the target image: If you have used the sanitizer option, then you should also pass it when building the target image:
```bash ```bash
docker build --target oai-gnb --tag oai-gnb:latest --file docker/Dockerfile.gNB.ubuntu20 --build-arg "SANITIZE_OPTION=--sanitize" . docker build --target oai-gnb --tag oai-gnb:latest --file docker/Dockerfile.gNB.ubuntu20 --build-arg "BUILD_OPTION=--sanitize" .
``` ```
Normally the target image will be around 200 Mbytes bigger. Normally the target image will be around 200 Mbytes bigger.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment