summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2020-04-09 14:29:13 +0800
committerfengweihao <[email protected]>2020-04-09 14:29:13 +0800
commit398907290e9a98711206dafb456d45f534ac4668 (patch)
treec9a75140b05ee5061eed613d719b2f4a26eb2abb
parent821ff22eeb32f165287b661f910769d1d6d6d3b0 (diff)
增加CI构建,关闭YUM仓库上传v20.04
-rw-r--r--.gitignore44
-rw-r--r--.gitlab-ci.yml110
-rw-r--r--ci/get-nprocessors.sh48
-rw-r--r--ci/perpare_pulp3_netrc.sh3
-rw-r--r--ci/travis.sh59
-rw-r--r--common/syslogd/src/logging.cpp4
-rw-r--r--program/include/cert_session.h3
-rw-r--r--program/src/cert_conf.cpp2
-rw-r--r--program/src/cert_session.cpp13
9 files changed, 279 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..76c9938
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,44 @@
+# Created by https://www.gitignore.io/api/c++,clion
+
+### C++ ###
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+*.smod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+
+# CMake
+cmake-build-*/
+
+# Clion
+.idea/
+
+# Vscode
+.vscode/*
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..daaa239
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,110 @@
+image: "git.mesalab.cn:7443/mesa_platform/build-env:master"
+
+variables:
+ GIT_STRATEGY: "clone"
+ BUILD_PADDING_PREFIX: /tmp/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX/
+ INSTALL_PREFIX: "/home/tsg/certstore"
+ TESTING_VERSION_BUILD: 0
+
+stages:
+- build
+
+.build_by_travis:
+ before_script:
+ - mkdir -p $BUILD_PADDING_PREFIX/$CI_PROJECT_NAMESPACE/
+ - ln -s $CI_PROJECT_DIR $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
+ - cd $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
+ - chmod +x ./ci/travis.sh
+ script:
+ - yum makecache
+ - ./ci/travis.sh
+ tags:
+ - share
+
+branch_build_debug:
+ stage: build
+ extends: .build_by_travis
+ variables:
+ BUILD_TYPE: Debug
+ except:
+ - /^develop-.*$/i
+ - /^release-.*$/i
+ - tags
+
+branch_build_release:
+ stage: build
+ variables:
+ BUILD_TYPE: RelWithDebInfo
+ extends: .build_by_travis
+ except:
+ - /^develop-.*$/i
+ - /^release-.*$/i
+ - tags
+
+develop_build_debug:
+ stage: build
+ extends: .build_by_travis
+ variables:
+ TESTING_VERSION_BUILD: 1
+ UPLOAD_SYMBOL_FILES: 1
+ BUILD_TYPE: Debug
+ PACKAGE: 1
+ PULP3_REPO_NAME: certstore-testing-x86_64.el7
+ PULP3_DIST_NAME: certstore-testing-x86_64.el7
+ artifacts:
+ name: "certstore-develop-$CI_COMMIT_REF_NAME-debug"
+ paths:
+ - build/*.rpm
+ only:
+ - /^develop-.*$/i
+ - /^release-.*$/i
+
+develop_build_release:
+ stage: build
+ extends: .build_by_travis
+ variables:
+ TESTING_VERSION_BUILD: 1
+ UPLOAD_SYMBOL_FILES: 1
+ BUILD_TYPE: RelWithDebInfo
+ PACKAGE: 1
+ PULP3_REPO_NAME: certstore-testing-x86_64.el7
+ PULP3_DIST_NAME: certstore-testing-x86_64.el7
+ artifacts:
+ name: "certstore-develop-$CI_COMMIT_REF_NAME-release"
+ paths:
+ - build/*.rpm
+ only:
+ - /^develop-.*$/i
+ - /^release-.*$/i
+
+release_build_debug:
+ stage: build
+ variables:
+ UPLOAD_SYMBOL_FILES: 1
+ BUILD_TYPE: Debug
+ PACKAGE: 1
+ PULP3_REPO_NAME: certstore-stable-x86_64.el7
+ PULP3_DIST_NAME: certstore-stable-x86_64.el7
+ extends: .build_by_travis
+ artifacts:
+ name: "certstore-install-$CI_COMMIT_REF_NAME-debug"
+ paths:
+ - build/*.rpm
+ only:
+ - tags
+
+release_build_release:
+ stage: build
+ variables:
+ BUILD_TYPE: RelWithDebInfo
+ UPLOAD_SYMBOL_FILES: 1
+ PACKAGE: 1
+ PULP3_REPO_NAME: certstore-stable-x86_64.el7
+ PULP3_DIST_NAME: certstore-stable-x86_64.el7
+ extends: .build_by_travis
+ artifacts:
+ name: "certstore-install-$CI_COMMIT_REF_NAME-release"
+ paths:
+ - build/*.rpm
+ only:
+ - tags
diff --git a/ci/get-nprocessors.sh b/ci/get-nprocessors.sh
new file mode 100644
index 0000000..43635e7
--- /dev/null
+++ b/ci/get-nprocessors.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# Copyright 2017 Google Inc.
+# All Rights Reserved.
+#
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This file is typically sourced by another script.
+# if possible, ask for the precise number of processors,
+# otherwise take 2 processors as reasonable default; see
+# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
+if [ -x /usr/bin/getconf ]; then
+ NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
+else
+ NPROCESSORS=2
+fi
+
+# as of 2017-09-04 Travis CI reports 32 processors, but GCC build
+# crashes if parallelized too much (maybe memory consumption problem),
+# so limit to 4 processors for the time being.
+if [ $NPROCESSORS -gt 4 ] ; then
+ echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
+ NPROCESSORS=4
+fi
diff --git a/ci/perpare_pulp3_netrc.sh b/ci/perpare_pulp3_netrc.sh
new file mode 100644
index 0000000..8414bbb
--- /dev/null
+++ b/ci/perpare_pulp3_netrc.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+set -evx
+echo "machine ${PULP3_SERVER_URL}\nlogin ${PULP3_SERVER_LOGIN}\npassword ${PULP3_SERVER_PASSWORD}\n" > ~/.netrc
diff --git a/ci/travis.sh b/ci/travis.sh
new file mode 100644
index 0000000..8065b10
--- /dev/null
+++ b/ci/travis.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env sh
+set -evx
+
+chmod +x ci/get-nprocessors.sh
+. ci/get-nprocessors.sh
+
+# if possible, ask for the precise number of processors,
+# otherwise take 2 processors as reasonable default; see
+# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
+if [ -x /usr/bin/getconf ]; then
+ NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
+else
+ NPROCESSORS=2
+fi
+
+# as of 2017-09-04 Travis CI reports 32 processors, but GCC build
+# crashes if parallelized too much (maybe memory consumption problem),
+# so limit to 4 processors for the time being.
+if [ $NPROCESSORS -gt 4 ] ; then
+ echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
+ NPROCESSORS=4
+fi
+
+# Tell make to use the processors. No preceding '-' required.
+MAKEFLAGS="j${NPROCESSORS}"
+export MAKEFLAGS
+
+env | sort
+
+# Set default values to OFF for these variables if not specified.
+: "${NO_EXCEPTION:=OFF}"
+: "${NO_RTTI:=OFF}"
+: "${COMPILER_IS_GNUCXX:=OFF}"
+
+# Install dependency from YUM
+yum install -y mrzcpd framework numactl-devel zlib-devel librdkafka-devel systemd-devel
+mkdir build || true
+cd build
+
+cmake3 -DCMAKE_CXX_FLAGS=$CXX_FLAGS \
+ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
+ -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
+ -DTFE_VERSION_DAILY_BUILD=$TESTING_VERSION_BUILD \
+ ..
+
+make
+#make test
+
+if [ -n "${PACKAGE}" ]; then
+ make package
+ #cp ~/rpm_upload_tools.py ./
+ #python3 rpm_upload_tools.py ${PULP3_REPO_NAME} ${PULP3_DIST_NAME} *.rpm
+fi
+
+if [ -n "${UPLOAD_SYMBOL_FILES}" ]; then
+ rpm -i certstore*debuginfo*.rpm
+ #cp /usr/lib/debug/opt/tsg/tfe/bin/tfe.debug /tmp/tfe.debuginfo.${CI_COMMIT_SHORT_SHA}
+ #sentry-cli upload-dif -t elf /tmp/tfe.debuginfo.${CI_COMMIT_SHORT_SHA}
+fi
diff --git a/common/syslogd/src/logging.cpp b/common/syslogd/src/logging.cpp
index d85bb71..afbc29e 100644
--- a/common/syslogd/src/logging.cpp
+++ b/common/syslogd/src/logging.cpp
@@ -19,8 +19,8 @@
#include "rt_time.h"
#include "rt_string.h"
#include "logging.h"
-#include "MESA_prof_load.h"
-#include "MESA_handle_logger.h"
+#include <MESA/MESA_prof_load.h>
+#include <MESA/MESA_handle_logger.h>
RTLogInit2Data logging_sc_lid;
diff --git a/program/include/cert_session.h b/program/include/cert_session.h
index f858fc3..c73a03f 100644
--- a/program/include/cert_session.h
+++ b/program/include/cert_session.h
@@ -9,7 +9,8 @@
#define _CERT_SESSION_H
#include <event2/event_compat.h>
-#include "MESA_list_queue.h"
+#include <MESA/MESA_list_queue.h>
+
#include "rt_sync.h"
diff --git a/program/src/cert_conf.cpp b/program/src/cert_conf.cpp
index a235ec2..326e503 100644
--- a/program/src/cert_conf.cpp
+++ b/program/src/cert_conf.cpp
@@ -16,7 +16,7 @@
#include "cert_conf.h"
#include "logging.h"
-#include "MESA_prof_load.h"
+#include <MESA/MESA_prof_load.h>
struct config_bucket_t certConfig;
diff --git a/program/src/cert_session.cpp b/program/src/cert_session.cpp
index 6c54347..1262cf2 100644
--- a/program/src/cert_session.cpp
+++ b/program/src/cert_session.cpp
@@ -39,7 +39,7 @@
#include <async.h>
#include <MESA/Maat_rule.h>
-#include <field_stat2.h>
+#include <MESA/field_stat2.h>
#include <MESA/MESA_prof_load.h>
#include <MESA/MESA_htable.h>
@@ -1126,8 +1126,15 @@ static int x509_online_append(struct x509_object_ctx *def, struct tfe_http_reque
{
if (1==is_valid) pxy_obj = get_obj_for_id(1);
if (0==is_valid) pxy_obj = get_obj_for_id(0);
- assert(pxy_obj!=NULL);
- mesa_runtime_log(RLOG_LV_DEBUG, MODULE_NAME, "Certificate issued by table id %d", keyring_id);
+ if (pxy_obj == NULL)
+ {
+ mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "Get the default keypair failed, EXIT!!!");
+ exit(0);
+ }
+ else
+ {
+ mesa_runtime_log(RLOG_LV_DEBUG, MODULE_NAME, "Certificate issued by table id %d", keyring_id);
+ }
}
else
{