Skip to content
Snippets Groups Projects
Commit ad3043e5 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge branch 'ci-fix-healthcheck' into 'develop'

fix(ci): healthcheck not correct anymore w/ YAML structure

See merge request !32
parents 0103238c b8ecc3ad
No related branches found
No related tags found
1 merge request!32fix(ci): healthcheck not correct anymore w/ YAML structure
Pipeline #38361 passed
......@@ -73,6 +73,8 @@ RUN ldconfig && \
rm -rf /etc/pki/entitlement && \
rm -rf /etc/rhsm
FROM mikefarah/yq:latest as yq-source
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
......@@ -91,8 +93,6 @@ COPY ./rhsm-ca /etc/rhsm/ca
RUN rm -f /etc/rhsm-host && \
microdnf update -y && \
microdnf install -y \
python3 \
python3-pip \
tzdata \
# libasan \
procps-ng \
......@@ -102,7 +102,6 @@ RUN rm -f /etc/rhsm-host && \
boost \
libevent \
findutils && \
pip3 install jinja2 && \
microdnf clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf && \
# Remove entitlements and Subscription Manager configs
......@@ -115,6 +114,7 @@ COPY --from=oai-pcf-builder \
/openair-pcf/build/pcf/build/oai_pcf \
/openair-pcf/scripts/healthcheck.sh \
./
COPY --from=yq-source /usr/bin/yq /usr/bin
COPY --from=oai-pcf-builder \
# Copying only the packages built from source
......
......@@ -62,11 +62,9 @@ RUN ./build_pcf --install-deps --force
RUN ldconfig && \
./build_pcf --clean --Verbose --build-type Release --jobs && \
ldd /openair-pcf/build/pcf/build/pcf && \
mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf && \
# Adapting the entrypoint to PCF NF
sed -i -e "s@openair-nf-root-folder@openair-pcf@g" \
-e "s@nf-config-file@pcf.yaml@g" \
../common-build/docker-scripts/entrypoint.py
mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf
FROM mikefarah/yq:latest as yq-source
#---------------------------------------------------------------------
# TARGET IMAGE
......@@ -77,8 +75,6 @@ ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN microdnf update -y && \
microdnf install -y \
python3 \
python3-pip \
tzdata \
# libasan \
procps-ng \
......@@ -88,7 +84,6 @@ RUN microdnf update -y && \
boost \
libevent \
findutils && \
pip3 install jinja2 && \
microdnf clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
......@@ -96,9 +91,9 @@ RUN microdnf update -y && \
WORKDIR /openair-pcf/bin
COPY --from=oai-pcf-builder \
/openair-pcf/build/pcf/build/oai_pcf \
/openair-pcf/build/common-build/docker-scripts/entrypoint.py \
/openair-pcf/scripts/healthcheck.sh \
./
COPY --from=yq-source /usr/bin/yq /usr/bin
COPY --from=oai-pcf-builder \
# Copying only the packages built from source
......@@ -130,5 +125,4 @@ HEALTHCHECK --interval=10s \
--retries=6 \
CMD /openair-pcf/bin/healthcheck.sh
ENTRYPOINT ["python3", "/openair-pcf/bin/entrypoint.py"]
CMD ["/openair-pcf/bin/oai_pcf", "-c", "/openair-pcf/etc/pcf.yaml", "-o"]
......@@ -72,6 +72,8 @@ RUN ./build_pcf --clean --Verbose --build-type Release --jobs && \
ldd /openair-pcf/build/pcf/build/pcf && \
mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf
FROM mikefarah/yq:latest as yq-source
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
......@@ -82,8 +84,6 @@ ENV TZ=Europe/Paris
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
python3 \
python3-jinja2 \
psmisc \
net-tools \
tzdata \
......@@ -106,6 +106,7 @@ COPY --from=oai-pcf-builder \
/openair-pcf/build/pcf/build/oai_pcf \
/openair-pcf/scripts/healthcheck.sh \
./
COPY --from=yq-source /usr/bin/yq /usr/bin
WORKDIR /usr/local/lib/
COPY --from=oai-pcf-builder \
......
#!/bin/bash
set -eo pipefail
pgrep oai_pcf
STATUS=0
PCF_INTERFACE_NAME_FOR_SBI=$(yq '.nfs.pcf.sbi.interface_name' /openair-pcf/etc/config.yaml)
PCF_INTERFACE_PORT_FOR_SBI=$(yq '.nfs.pcf.sbi.port' /openair-pcf/etc/config.yaml)
PCF_IP_SBI_INTERFACE=$(ifconfig $PCF_INTERFACE_NAME_FOR_SBI | grep inet | grep -v inet6 | awk {'print $2'})
#Check if entrypoint properly configured the conf file and no parameter is unset(optional)
PCF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$PCF_IP_SBI_INTERFACE:$PCF_INTERFACE_PORT_FOR_SBI")
if [[ -z $PCF_SBI_PORT_STATUS ]]; then
STATUS=-1
echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $PCF_INTERFACE_PORT_FOR_SBI is not listening."
fi
exit $STATUS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment