Commit aecfa3d1 authored by Raphael Defosseux's avatar Raphael Defosseux

[CI][DOCKER] display intermediate logs for CI purpose

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 3e998b11
......@@ -189,7 +189,7 @@ class Containerize():
mySSH.command('mkdir -p 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)
sharedimage = 'ran-build'
# Let's remove any previous run artifacts if still there
mySSH.command(self.cli + ' image prune --force', '\$', 5)
......@@ -198,22 +198,7 @@ class Containerize():
mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 5)
# Build the shared image
mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + imageTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600)
# Build the target image(s)
previousImage = sharedimage + ':' + imageTag
danglingShaOnes=[]
for image,pattern in imageNames:
# the archived Dockerfiles have "ran-build:latest" as base image
# we need to update them with proper tag
mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5)
mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200)
# Retrieving the dangling image(s) for the log collection
mySSH.command(self.cli + ' images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5)
result = re.search('sha=(?P<imageShaOne>[a-zA-Z0-9\-\_]+)', mySSH.getBefore())
if result is not None:
danglingShaOnes.append((image, result.group('imageShaOne')))
previousImage = image + ':' + imageTag
# First verify if images were properly created.
# First verify if the shared image was properly created.
status = True
mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + imageTag, '\$', 5)
if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0):
......@@ -238,7 +223,29 @@ class Containerize():
self.allImagesSize['ran-build'] = str(round(imageSize,1)) + ' Gbytes'
else:
logging.debug('ran-build size is unknown')
# If the shared image failed, no need to continue
if not status:
mySSH.close()
logging.error('\u001B[1m Building OAI Images Failed\u001B[0m')
HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK)
HTML.CreateHtmlTabFooter(False)
sys.exit(1)
# Build the target image(s)
previousImage = sharedimage + ':' + imageTag
danglingShaOnes=[]
for image,pattern in imageNames:
# the archived Dockerfiles have "ran-build:latest" as base image
# we need to update them with proper tag
mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5)
mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200)
# Retrieving the dangling image(s) for the log collection
mySSH.command(self.cli + ' images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5)
result = re.search('sha=(?P<imageShaOne>[a-zA-Z0-9\-\_]+)', mySSH.getBefore())
if result is not None:
danglingShaOnes.append((image, result.group('imageShaOne')))
previousImage = image + ':' + imageTag
# checking the status of the build
mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5)
if (mySSH.getBefore().count('No such object') != 0) or (mySSH.getBefore().count('no such image') != 0):
logging.error('Could not build properly ' + image)
......
......@@ -50,6 +50,7 @@ REL="Rel15"
HW="None"
TP="None"
EPC=0
VERBOSE_CI=0
VERBOSE_COMPILE=0
CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0
......@@ -324,6 +325,10 @@ function main() {
HWLAT_TEST=1
echo_info "Will compile hw latency test program"
shift;;
--verbose-ci)
VERBOSE_CI=1
echo_info "Will compile with verbose instructions in CI Docker env"
shift;;
--verbose-compile)
VERBOSE_COMPILE=1
echo_info "Will compile with verbose instructions"
......
......@@ -221,6 +221,11 @@ compilations() {
ret=$?
} > $dlog/$2.$REL.txt 2>&1
set -e
if [ "$VERBOSE_CI" == "1" ]; then
echo_info "====== Start of log for $2.$REL.txt ======"
cat $dlog/$2.$REL.txt
echo_info "====== End of log for $2.$REL.txt ======"
fi
if [[ $ret -ne 0 ]]; then
check_warnings "$dlog/$2.$REL.txt"
check_errors "$dlog/$2.$REL.txt"
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --ninja -w USRP
./build_oai --eNB --ninja -w USRP --verbose-ci
# debug
#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --ninja -w USRP
./build_oai --eNB --ninja -w USRP --verbose-ci
RUN apt-get install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --gNB --ninja -w USRP
./build_oai --gNB --ninja -w USRP --verbose-ci
#debug
#RUN ldconfig -v
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --gNB --ninja -w USRP
./build_oai --gNB --ninja -w USRP --verbose-ci
#debug
RUN ldconfig -v
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --UE --ninja -w USRP
./build_oai --UE --ninja -w USRP --verbose-ci
# debug
#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --UE --ninja -w USRP
./build_oai --UE --ninja -w USRP --verbose-ci
# debug
#RUN ldconfig -v
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --nrUE --ninja -w USRP
./build_oai --nrUE --ninja -w USRP --verbose-ci
# debug
#RUN ldconfig -v
......
......@@ -35,7 +35,7 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --nrUE --ninja -w USRP
./build_oai --nrUE --ninja -w USRP --verbose-ci
# debug
#RUN ldconfig -v
......
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