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: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
committed by
Robert Schmidt
parent
4db8dfaf5d
commit
8e35d8fe5b
@@ -384,10 +384,10 @@ class Containerize():
|
||||
if self.host == 'Ubuntu':
|
||||
imageNames.append(('oai-lte-ru', 'lteRU', 'oai-lte-ru', ''))
|
||||
# Building again the 5G images with Address Sanitizer
|
||||
imageNames.append(('ran-build', 'build', 'ran-build-asan', '--build-arg "SANITIZE_OPTION=--sanitize"'))
|
||||
imageNames.append(('oai-gnb', 'gNB', 'oai-gnb-asan', '--build-arg "SANITIZE_OPTION=--sanitize"'))
|
||||
imageNames.append(('oai-nr-ue', 'nrUE', 'oai-nr-ue-asan', '--build-arg "SANITIZE_OPTION=--sanitize"'))
|
||||
imageNames.append(('oai-nr-cuup', 'nr-cuup', 'oai-nr-cuup-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 "BUILD_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 "BUILD_OPTION=--sanitize"'))
|
||||
result = re.search('build_cross_arm64', self.imageKind)
|
||||
if result is not None:
|
||||
self.dockerfileprefix = '.ubuntu20.cross-arm64'
|
||||
@@ -707,10 +707,11 @@ class Containerize():
|
||||
orgTag = 'develop'
|
||||
if self.ranAllowMerge:
|
||||
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 imageNames:
|
||||
for image in IMAGES:
|
||||
tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge)
|
||||
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)
|
||||
if re.search(': digest:', mySSH.getBefore()) is None:
|
||||
logging.debug(mySSH.getBefore())
|
||||
@@ -1070,12 +1071,16 @@ class Containerize():
|
||||
imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup']
|
||||
for image in imageNames:
|
||||
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)
|
||||
# In the scenario, for 5G images, we have the choice of either pulling normal images
|
||||
# or -asan images. We need to detect which kind we did pull.
|
||||
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:
|
||||
tagToUse = tagToUse.replace('oai-gnb', 'oai-gnb-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'
|
||||
myCmd.run(cmd, silent=self.displayedNewTags)
|
||||
self.displayedNewTags = True
|
||||
@@ -1214,21 +1219,7 @@ class Containerize():
|
||||
logPath = '../cmake_targets/log/' + ymlPath[1]
|
||||
myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0])
|
||||
cmd = 'cp docker-compose.y*ml docker-compose-ci.yml'
|
||||
myCmd.run(cmd, silent=self.displayedNewTags)
|
||||
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
|
||||
myCmd.run(cmd)
|
||||
|
||||
# check which containers are running for log recovery later
|
||||
cmd = 'docker-compose -f docker-compose-ci.yml ps --all'
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
FROM ran-base:latest as ran-build
|
||||
ARG SANITIZE_OPTION
|
||||
ARG BUILD_OPTION
|
||||
|
||||
RUN rm -Rf /oai-ran
|
||||
WORKDIR /oai-ran
|
||||
@@ -36,6 +36,6 @@ COPY . .
|
||||
RUN /bin/sh oaienv && \
|
||||
cd cmake_targets && \
|
||||
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
|
||||
ldd ran_build/build/nr-softmodem
|
||||
|
||||
@@ -32,7 +32,7 @@ FROM ran-build:latest AS enb-build
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:focal as oai-enb
|
||||
ARG SANITIZE_OPTION
|
||||
ARG BUILD_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Paris
|
||||
|
||||
@@ -59,7 +59,7 @@ RUN apt-get update && \
|
||||
python3-requests \
|
||||
libusb-1.0-0 && \
|
||||
# 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 \
|
||||
libubsan1 \
|
||||
liblapacke; fi' && \
|
||||
|
||||
@@ -32,7 +32,7 @@ FROM ran-build:latest AS gnb-build
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:focal as oai-gnb
|
||||
ARG SANITIZE_OPTION
|
||||
ARG BUILD_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe
|
||||
|
||||
@@ -58,7 +58,7 @@ RUN apt-get update && \
|
||||
python3-requests \
|
||||
libusb-1.0-0 && \
|
||||
# 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 \
|
||||
libubsan1 \
|
||||
liblapacke; fi' && \
|
||||
|
||||
@@ -32,7 +32,7 @@ FROM ran-build:latest AS lte-ue-build
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:focal as oai-lte-ue
|
||||
ARG SANITIZE_OPTION
|
||||
ARG BUILD_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Paris
|
||||
|
||||
@@ -58,7 +58,7 @@ RUN apt-get update && \
|
||||
iproute2 \
|
||||
iperf && \
|
||||
# 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 \
|
||||
libubsan1 \
|
||||
liblapacke; fi' && \
|
||||
|
||||
@@ -31,7 +31,7 @@ FROM ran-build:latest AS gnb-build
|
||||
|
||||
|
||||
FROM ubuntu:focal as oai-nr-cuup
|
||||
ARG SANITIZE_OPTION
|
||||
ARG BUILD_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe
|
||||
|
||||
@@ -42,7 +42,7 @@ RUN apt-get update && \
|
||||
libconfig9 \
|
||||
openssl && \
|
||||
# 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 \
|
||||
libubsan1 \
|
||||
liblapacke; fi' && \
|
||||
|
||||
@@ -32,7 +32,7 @@ FROM ran-build:latest AS nr-ue-build
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:focal as oai-nr-ue
|
||||
ARG SANITIZE_OPTION
|
||||
ARG BUILD_OPTION
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Paris
|
||||
|
||||
@@ -58,7 +58,7 @@ RUN apt-get update && \
|
||||
iproute2 \
|
||||
iperf && \
|
||||
# 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 \
|
||||
libubsan1; fi' && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
+17
-7
@@ -46,16 +46,15 @@ For all platforms, the strategy for building docker/podman images is the same:
|
||||
- Some tools (such as `ping`, `ifconfig`)
|
||||
|
||||
Note that on every push to develop (i.e., typically after integrating merge
|
||||
requests), we build all images and push them to [Docker
|
||||
Hub](https://hub.docker.com/u/oaisoftwarealliance). To pull them, do
|
||||
requests), we build all images and push them to [Docker Hub](https://hub.docker.com/u/oaisoftwarealliance). To pull them, do
|
||||
|
||||
```
|
||||
docker pull oaisoftwarealliance/oai-gnb:develop
|
||||
docker pull oaisoftwarealliance/oai-nr-ue:develop
|
||||
docker pull oaisoftwarealliance/oai-enb:develop
|
||||
docker pull oaisoftwarealliance/oai-lte-ue:develop
|
||||
```
|
||||
Have a look at [this
|
||||
README](../ci-scripts/yaml_files/5g_rfsimulator/README.md) to get some
|
||||
Have a look at [this README](../ci-scripts/yaml_files/5g_rfsimulator/README.md) to get some
|
||||
information on how to use the images.
|
||||
|
||||
# 2. File organization #
|
||||
@@ -114,12 +113,21 @@ ran-base latest 5c9c02a5b4a8 1 minute ago
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
```bash
|
||||
@@ -131,6 +139,8 @@ ran-build latest f2633a7f5102 1 minute ago
|
||||
|
||||
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 ##
|
||||
|
||||
For example, the eNB:
|
||||
@@ -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:
|
||||
|
||||
```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.
|
||||
|
||||
Reference in New Issue
Block a user