Commit fdd0cf3b authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/develop' into event_exposure

parents 10bdb7c3 f1873ad2
......@@ -296,7 +296,10 @@ check_enable_epel_repos() {
echo "EPEL repos already present. Good."
else
echo "EPEL repos not present. Installing them."
$SUDO $INSTALLER install $OPTION https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget --tries=4 --retry-connrefused --wait=8 \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$SUDO $INSTALLER install $OPTION epel-release-latest-7.noarch.rpm
rm -f epel-release-latest-7.noarch.rpm
fi
fi
}
......
......@@ -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"
......@@ -200,7 +201,7 @@ pipeline {
}
// "latest" is the tag used in the docker file.
myShCmd('docker image tag oai-smf-base:' +SMF_BASE_IMAGE_TAG + ' oai-smf-base:latest', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
// Putting a place holder to try out on the flattening of image.
// If not satisfactory, we can remove it.
......@@ -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)
......
......@@ -51,6 +51,7 @@ RUN rm -f /etc/rhsm-host && \
boost-devel \
openssl-devel \
openssl \
wget \
libasan && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
......
......@@ -23,36 +23,51 @@
#include "logger.hpp"
#include <boost/asio.hpp>
#include <iostream>
#include <chrono>
#include <thread>
#define MAX_NB_RESOLVE_TRIES 4
#define TIME_BETWEEN_TRIES 2
bool fqdn::resolve(
const std::string& host_name, std::string& address, uint32_t& port,
uint8_t& addr_type, const std::string& protocol) {
try {
boost::asio::io_context io_context = {};
int tries = 0;
Logger::smf_app().debug("Resolving a DNS (name %s)", host_name.c_str());
while (tries < MAX_NB_RESOLVE_TRIES) {
try {
boost::asio::io_context io_context = {};
Logger::smf_app().debug("Resolving DNS Try #%u", tries);
boost::asio::ip::tcp::resolver resolver{io_context};
boost::asio::ip::tcp::resolver::results_type endpoints =
resolver.resolve(host_name, protocol);
boost::asio::ip::tcp::resolver resolver{io_context};
boost::asio::ip::tcp::resolver::results_type endpoints =
resolver.resolve(host_name, protocol);
addr_type = 0; // IPv4 by default
for (auto it = endpoints.cbegin(); it != endpoints.cend(); it++) {
// get the first Endpoint
boost::asio::ip::tcp::endpoint endpoint = *it;
address = endpoint.address().to_string();
port = endpoint.port();
Logger::smf_app().debug(
"Resolve a DNS (name %s, protocol %s): Ip Addr %s, port %u",
host_name.c_str(), protocol.c_str(), address.c_str(), port);
if (endpoint.address().is_v4())
addr_type = 0;
else
addr_type = 1;
return true;
addr_type = 0; // IPv4 by default
for (auto it = endpoints.cbegin(); it != endpoints.cend(); it++) {
// get the first Endpoint
boost::asio::ip::tcp::endpoint endpoint = *it;
address = endpoint.address().to_string();
port = endpoint.port();
Logger::smf_app().debug(
"Resolved a DNS (name %s, protocol %s): Ip Addr %s, port %u",
host_name.c_str(), protocol.c_str(), address.c_str(), port);
if (endpoint.address().is_v4())
addr_type = 0;
else
addr_type = 1;
return true;
}
} catch (std::exception& e) {
tries++;
if (tries == MAX_NB_RESOLVE_TRIES) {
throw std::runtime_error(
"Cannot resolve a DNS name " + std::string(e.what()) + " after " +
std::to_string(tries) + " tries");
return false;
}
std::this_thread::sleep_for(std::chrono::seconds(TIME_BETWEEN_TRIES));
}
} catch (std::exception& e) {
throw std::runtime_error(
"Cannot resolve a DNS name " + std::string(e.what()));
return false;
}
return false;
......
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