Commit c2ad3ae1 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 146af1e0
...@@ -182,6 +182,7 @@ pipeline { ...@@ -182,6 +182,7 @@ pipeline {
// Currently this pipeline only runs for pushes to `develop` branch // Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry // First clean image registry
try { try {
myShCmd('docker image tag oai-smf:develop oai-smf:develop-previous', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image rm oai-smf:develop', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image rm oai-smf:develop', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} catch (Exception e) { } catch (Exception e) {
echo "Maybe a previous build went wrong" echo "Maybe a previous build went wrong"
...@@ -221,8 +222,11 @@ pipeline { ...@@ -221,8 +222,11 @@ pipeline {
} }
success { success {
sh "echo 'OAI-SMF DOCKER IMAGE BUILD: OK' >> archives/smf_docker_image_build.log" sh "echo 'OAI-SMF DOCKER IMAGE BUILD: OK' >> archives/smf_docker_image_build.log"
myShCmd('docker image rm oai-smf:develop-previous || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} }
unsuccessful { unsuccessful {
myShCmd('docker image tag oai-smf:develop-previous oai-smf:develop || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker image rm oai-smf:develop-previous || true', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
sh "echo 'OAI-SMF DOCKER IMAGE BUILD: KO' >> archives/smf_docker_image_build.log" sh "echo 'OAI-SMF DOCKER IMAGE BUILD: KO' >> archives/smf_docker_image_build.log"
} }
} }
...@@ -237,6 +241,7 @@ pipeline { ...@@ -237,6 +241,7 @@ pipeline {
// Currently this pipeline only runs for pushes to `develop` branch // Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry // First clean image registry
try { try {
myShCmd('sudo podman image tag oai-smf:develop oai-smf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image rm oai-smf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host) myShCmd('sudo podman image rm oai-smf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
} catch (Exception e) { } catch (Exception e) {
echo "Maybe a previous build went wrong" echo "Maybe a previous build went wrong"
...@@ -270,9 +275,12 @@ pipeline { ...@@ -270,9 +275,12 @@ pipeline {
} }
} }
success { success {
myShCmd('sudo podman image rm oai-smf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/smf_podman_image_build.log" sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: OK' >> archives/smf_podman_image_build.log"
} }
unsuccessful { unsuccessful {
myShCmd('sudo podman image tag oai-smf:develop-previous oai-smf:develop || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman image rm oai-smf:develop-previous || true', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/smf_podman_image_build.log" sh "echo 'OAI-SMF PODMAN RHEL8 IMAGE BUILD: KO' >> archives/smf_podman_image_build.log"
} }
} }
......
...@@ -33,13 +33,14 @@ ...@@ -33,13 +33,14 @@
ARG BASE_IMAGE=ubuntu:bionic ARG BASE_IMAGE=ubuntu:bionic
FROM oai-smf-base:latest as oai-smf-builder FROM oai-smf-base:latest as oai-smf-builder
RUN rm -Rf /openair-smf/
WORKDIR /openair-smf/ WORKDIR /openair-smf/
COPY . /openair-smf COPY . /openair-smf
RUN cp -Rf /openair-smf-ext-ref /openair-smf/build/ext
# Building SMF # Building SMF
WORKDIR /openair-smf/build/scripts WORKDIR /openair-smf/build/scripts
RUN ldconfig && \ RUN ldconfig && \
cp -Rf /openair-smf-ext-ref /openair-smf/build/ext && \
./build_smf --clean --Verbose --build-type Release --jobs && \ ./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \ ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf
......
...@@ -492,7 +492,7 @@ class HtmlReport(): ...@@ -492,7 +492,7 @@ class HtmlReport():
base_image = False base_image = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile: for line in logfile:
result = re.search('FROM oai-smf-base', line) result = re.search('FROM oai-smf-base:latest', line)
if result is not None: if result is not None:
base_image = True base_image = True
result = re.search(section_start_pattern, line) 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