Commit 123fa6a4 authored by Raphael Defosseux's avatar Raphael Defosseux

chore(ci): refactoring of build pipeline

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent c140a19c
This diff is collapsed.
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
FROM ubuntu:focal as amf-clang-format-check
ARG MERGE_REQUEST_CHECK
ARG SOURCE_BRANCH
ARG TARGET_BRANCH
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install --yes \
git \
tree \
clang-format-9
WORKDIR /home
COPY . .
RUN /bin/bash -c "if [[ -v MERGE_REQUEST_CHECK ]]; then ./ci-scripts/checkCodingFormattingRules.sh --src-branch $SOURCE_BRANCH --target-branch $TARGET_BRANCH; else ./ci-scripts/checkCodingFormattingRules.sh; fi"
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
FROM ubuntu:focal as amf-cppcheck
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install --yes cppcheck
WORKDIR /home
COPY . .
RUN cppcheck --enable=warning --force \
--xml --xml-version=2 \
--suppressions-list=ci-scripts/cppcheck_suppressions.list src \
2> cppcheck.xml \
1> cppcheck_build.log
......@@ -472,9 +472,18 @@ class HtmlReport():
nghttp2_build_start = False
nghttp2_build_status = False
base_image = False
build_stage_id = 'NotAcorrectBuildStageId'
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
# old method
result = re.search('FROM oai-amf-base:latest', line)
if result is not None:
base_image = True
# new method --> buildx may cache this stage
result = re.search('^#([0-9]+).* RUN ./build_amf --install-deps', line)
if result is not None:
build_stage_id = result.group(1)
result = re.search(f'^#{build_stage_id} CACHED', line)
if result is not None:
base_image = True
result = re.search(section_start_pattern, line)
......@@ -709,7 +718,7 @@ class HtmlReport():
for variant in variants:
logFileName = 'amf_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = 'FROM .* as oai-amf$'
section_start_pattern = 'COPY --from=oai-amf-builder */openair-amf/build/amf/build/oai_amf'
section_end_pattern = 'WORKDIR /openair-amf/etc'
section_status = False
status = False
......@@ -757,7 +766,7 @@ class HtmlReport():
if os.path.isfile(cwd + '/archives/' + logFileName):
section_start_pattern = 'WORKDIR /openair-amf/etc'
if variant == 'docker':
section_end_pattern = 'Successfully tagged oai-amf'
section_end_pattern = 'naming to docker.io/library/oai-amf:'
else:
section_end_pattern = 'COMMIT oai-amf:'
section_status = False
......@@ -808,27 +817,26 @@ class HtmlReport():
if os.path.isfile(cwd + '/archives/' + logFileName):
if nfType == 'AMF':
if variant == 'docker':
section_start_pattern = 'Successfully tagged oai-amf'
section_start_pattern = 'naming to docker.io/library/oai-smf:'
section_end_pattern = 'OAI-AMF DOCKER IMAGE BUILD'
else:
section_start_pattern = 'COMMIT oai-amf:'
section_end_pattern = 'OAI-AMF PODMAN RHEL8 IMAGE BUILD'
section_status = False
status = False
imageTag = 'notAcorrectTagForTheMoment'
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
result = re.search(section_start_pattern, line)
result = re.search(f'{section_start_pattern}([0-9a-zA-Z\-\_\.]+)', line)
if result is not None:
section_status = True
imageTag = result.group(1)
result = re.search(section_end_pattern, line)
if result is not None:
section_status = True
section_status = False
if section_status:
if nfType == 'AMF':
if self.git_pull_request:
result = re.search('oai-amf *ci-tmp', line)
else:
result = re.search('oai-amf *develop', line)
result = re.search(f'oai-amf *{imageTag}', line)
if result is not None and not status:
result = re.search('ago *([0-9A-Z ]+)', line)
if result is not None:
......
......@@ -49,7 +49,9 @@ RUN git config --global https.postBuffer 123289600 && \
# Copying source code
WORKDIR /openair-amf/
COPY . /openair-amf
COPY ./build/scripts /openair-amf/build/scripts
COPY ./build/amf/CMakeLists.txt /openair-amf/build/amf/CMakeLists.txt
COPY ./build/cmake_modules /openair-amf/cmake_modules
# Installing all the needed libraries/packages to build and run AMF
WORKDIR /openair-amf/build/scripts
......@@ -60,6 +62,8 @@ RUN ./build_amf --install-deps --force && \
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM oai-amf-base as oai-amf-builder
# Copying source code
COPY . /openair-amf
# Building AMF
WORKDIR /openair-amf/build/scripts
RUN ldconfig && \
......
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