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 {
// Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry
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)
} catch (Exception e) {
echo "Maybe a previous build went wrong"
......@@ -221,8 +222,11 @@ pipeline {
}
success {
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 {
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"
}
}
......@@ -237,6 +241,7 @@ pipeline {
// Currently this pipeline only runs for pushes to `develop` branch
// First clean image registry
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)
} catch (Exception e) {
echo "Maybe a previous build went wrong"
......@@ -270,9 +275,12 @@ pipeline {
}
}
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"
}
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"
}
}
......
......@@ -33,13 +33,14 @@
ARG BASE_IMAGE=ubuntu:bionic
FROM oai-smf-base:latest as oai-smf-builder
RUN rm -Rf /openair-smf/
WORKDIR /openair-smf/
COPY . /openair-smf
RUN cp -Rf /openair-smf-ext-ref /openair-smf/build/ext
# Building SMF
WORKDIR /openair-smf/build/scripts
RUN ldconfig && \
cp -Rf /openair-smf-ext-ref /openair-smf/build/ext && \
./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf
......
......@@ -492,7 +492,7 @@ class HtmlReport():
base_image = False
with open(cwd + '/archives/' + logFileName, 'r') as 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:
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