From: Alok Bhatt Date: Fri, 13 Nov 2020 22:35:49 +0000 (+0000) Subject: This change adds the job to trigger sonar scans on the ric-plt-dbaas X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F5063%2F2;p=ci-management.git This change adds the job to trigger sonar scans on the ric-plt-dbaas Issue-ID: RIC-692 Signed-off-by: Alok Bhatt Change-Id: Ib47fe3e96ff2687ea11bec91a65cf9d4f4c87f87 --- diff --git a/jjb/ric-plt-dbaas/ric-plt-dbaas.yaml b/jjb/ric-plt-dbaas/ric-plt-dbaas.yaml index cc525c4a..6b49119f 100644 --- a/jjb/ric-plt-dbaas/ric-plt-dbaas.yaml +++ b/jjb/ric-plt-dbaas/ric-plt-dbaas.yaml @@ -13,36 +13,91 @@ jobs: - gerrit-info-yaml-verify -- dbaas_docker_common: &dbaas_docker_common - # values apply to all dbaas docker projects - name: dbaas-docker-common +- dbaas_common: &dbaas_common + # values apply to all ric-plt/dbaas projects + name: dbaas-common # git repo project: ric-plt/dbaas # jenkins job name prefix project-name: ric-plt-dbaas - # maven settings file has docker credentials + # maven settings file has credentials mvn-settings: ric-plt-dbaas-settings +# compile code and run tests - project: - <<: *dbaas_docker_common - name: ric-plt-dbaas - # image name - docker-name: 'o-ran-sc/{name}' - # Specify docker file and host network - docker-build-args: '--network=host -f docker/Dockerfile.redis' - # source of docker tag - container-tag-method: yaml-file + <<: *dbaas_common + name: ric-plt-dbaas-lib + pre-build: !include-raw-escape: setup-dbaas-build-deb.sh + build-node: ubuntu1804-builder-2c-2g + make-opts: -j 2 test jobs: - - '{project-name}-gerrit-docker-jobs' + - gerrit-autotools-verify stream: - master: branch: master +# common settings for building DEB and RPM packages +- dbaas_pkg_common: &dbaas_pkg_common + name: ric-plt-pkg-cmn + pre-build: !include-raw-escape: setup-dbaas-build-deb.sh + # directory with package files + build-dir: pkg + # docker image has the package_cloud gem + build-node: ubuntu1804-docker-4c-4g + jobs: + - gerrit-autotools-packagecloud-stage + stream: + - master: + branch: master + +# build DEB package files +- project: + <<: *dbaas_common + <<: *dbaas_pkg_common + name: ric-plt-dbaas-deb + project-name: '{name}' + configure-opts: --with-deb-dir={build-dir} + make-opts: -j4 deb-pkg + +# build RPM package files +- project: + <<: *dbaas_common + <<: *dbaas_pkg_common + name: ric-plt-dbaas-rpm + project-name: '{name}' + configure-opts: --with-rpm-dir={build-dir} + # parallel jobs (option -j) fail on rpm build + # https://bugzilla.redhat.com/show_bug.cgi?id=1398405 + make-opts: rpm-pkg + +# analyze C code and test coverage +- project: + <<: *dbaas_common + name: ric-plt-lib-dbaas-sonarqube + pre-build: !include-raw-escape: setup-dbaas-build-deb.sh + build-node: ubuntu1804-docker-4c-4g + # set appropriate CXXFLAGS + configure-opts: --build=i686-pc-linux-gnu + # use all cores + make-opts: -j4 all + sonar-project-file: "" + sonar-properties: | + sonar.login={sonarcloud_api_token} + sonar.projectKey={sonarcloud_project_organization}_{project-name} + sonar.projectName={project-name} + sonar.organization={sonarcloud_project_organization} + sonar.build.sourceEncoding=UTF-8 + sonar.sources=src + sonar.cfamily.build-wrapper-output=$WORKSPACE/bw-output + sonar.cfamily.cache.enabled=false + sonar.cfamily.gcov.reportsPath=gcov_report + sonar.cfamily.threads=4 + jobs: + - gerrit-autotools-sonarqube + - project: - <<: *dbaas_docker_common + <<: *dbaas_common name: ric-plt-dbaas-release - # maven release requires sigul which requires centos - # container release requires docker - build-node: centos7-docker-2c-8g jobs: - - '{project-name}-gerrit-release-jobs' + - gerrit-packagecloud-release-verify + - gerrit-packagecloud-release-merge diff --git a/jjb/ric-plt-dbaas/setup-dbaas-build-deb.sh b/jjb/ric-plt-dbaas/setup-dbaas-build-deb.sh new file mode 100644 index 00000000..6b89a091 --- /dev/null +++ b/jjb/ric-plt-dbaas/setup-dbaas-build-deb.sh @@ -0,0 +1,41 @@ +#!/bin/bash +############################################################################## +# +# Copyright (c) 2020 HCL Technology. +# +# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 +# +# 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. +# +############################################################################## + +# Installs prerequisites needed to compile & test SDL code +# and build RPM/DEB packages on a Debian/Ubuntu machine. + +echo "--> setup-sdl-build-deb.sh" + +# Ensure we fail the job if any steps fail. +set -eux -o pipefail + +# install prereqs +sudo apt-get update && sudo apt-get -q -y install \ + autoconf-archive libhiredis-dev rpm valgrind \ + libboost-filesystem-dev libboost-program-options-dev libboost-system-dev + +# generate configure script +cd redismodule +autoreconf --install +cd .. +curl -L https://github.com/cpputest/cpputest/releases/download/v3.8/cpputest-3.8.tar.gz | \ + tar --strip-components=1 -xzf - +cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_COVERAGE=ON -DMEMORY_LEAK_DETECTION=OFF . +sudo make install +echo "--> setup-sdl-build-deb.sh ends" \ No newline at end of file