Commit 4c5b9799 authored by Raphael Defosseux's avatar Raphael Defosseux

fix(ci): handling the case of build on `develop` fails

 * Instead of removing previous `develop` image, rename it and keep it in case of failure
   - will allow other NF CI runs to be tested with this "old" version
 * Proper clean-up of the build workspace when using a base image
 * Little typo in the HTML generation
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent d9e77b90
......@@ -182,6 +182,7 @@ pipeline {
// Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry
try {
myShCmd('docker image tag oai-nrf:develop oai-nrf:develop-previous', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image rm oai-nrf:develop', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} catch (Exception e) {
echo "Maybe a previous build went wrong"
......@@ -220,9 +221,12 @@ pipeline {
}
}
success {
myShCmd('docker image rm oai-nrf:develop-previous || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
sh "echo 'OAI-NRF DOCKER IMAGE BUILD: OK' >> archives/nrf_docker_image_build.log"
}
unsuccessful {
myShCmd('docker image tag oai-nrf:develop-previous oai-nrf:develop || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image rm oai-nrf:develop-previous || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
sh "echo 'OAI-NRF DOCKER IMAGE BUILD: KO' >> archives/nrf_docker_image_build.log"
}
}
......@@ -238,6 +242,7 @@ pipeline {
// Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry
try {
myShCmd('sudo podman image tag oai-nrf:develop oai-nrf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image rm oai-nrf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
} catch (Exception e) {
echo "Maybe a previous build went wrong"
......@@ -271,9 +276,12 @@ pipeline {
}
}
success {
myShCmd('sudo podman image rm oai-nrf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
sh "echo 'OAI-NRF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/nrf_podman_image_build.log"
}
unsuccessful {
myShCmd('sudo podman image tag oai-nrf:develop-previous oai-nrf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image rm oai-nrf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
sh "echo 'OAI-NRF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/nrf_podman_image_build.log"
}
}
......
......@@ -33,13 +33,14 @@ ARG BASE_IMAGE=ubuntu:bionic
FROM oai-nrf-base:latest as oai-nrf-builder
# Copying source code
RUN rm -Rf /openair-nrf
WORKDIR /openair-nrf/
COPY . /openair-nrf
RUN cp -Rf /openair-nrf-ext-ref /openair-nrf/build/ext
# Building NRF
WORKDIR /openair-nrf/build/scripts
RUN ldconfig && \
cp -Rf /openair-nrf-ext-ref /openair-nrf/build/ext && \
./build_nrf --clean --Verbose --build-type Release --jobs && \
ldd /openair-nrf/build/nrf/build/nrf && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf
......
......@@ -477,7 +477,7 @@ class HtmlReport():
base_image = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
result = re.search('FROM oai-nrf-base', line)
result = re.search('FROM oai-nrf-base:latest', line)
if result is not None:
base_image = True
result = re.search(section_start_pattern, line)
......
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