This change adds the job to trigger sonar scans on the ric-plt-dbaas 63/5063/2
authorAlok Bhatt <alok_bh@hcl.com>
Fri, 13 Nov 2020 22:35:49 +0000 (22:35 +0000)
committerAlok Bhatt <alok_bh@hcl.com>
Fri, 13 Nov 2020 18:14:13 +0000 (18:14 +0000)
Issue-ID: RIC-692
Signed-off-by: Alok Bhatt <alok_bh@hcl.com>
Change-Id: Ib47fe3e96ff2687ea11bec91a65cf9d4f4c87f87

jjb/ric-plt-dbaas/ric-plt-dbaas.yaml
jjb/ric-plt-dbaas/setup-dbaas-build-deb.sh [new file with mode: 0644]

index cc525c4..6b49119 100644 (file)
     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 (file)
index 0000000..6b89a09
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash\r
+##############################################################################\r
+#\r
+#   Copyright (c) 2020 HCL Technology.\r
+#\r
+#   Licensed under the Apache License, Version 2.0 (the "License");\r
+#   you may not use this file except in compliance with the License.\r
+#   You may obtain a copy of the License at\r
+#\r
+#       http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+#   Unless required by applicable law or agreed to in writing, software\r
+#   distributed under the License is distributed on an "AS IS" BASIS,\r
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+#   See the License for the specific language governing permissions and\r
+#   limitations under the License.\r
+#\r
+##############################################################################\r
+\r
+# Installs prerequisites needed to compile & test SDL code\r
+# and build RPM/DEB packages on a Debian/Ubuntu machine.\r
+\r
+echo "--> setup-sdl-build-deb.sh"\r
+\r
+# Ensure we fail the job if any steps fail.\r
+set -eux -o pipefail\r
+\r
+# install prereqs\r
+sudo apt-get update && sudo apt-get -q -y install \\r
+  autoconf-archive libhiredis-dev rpm valgrind \\r
+  libboost-filesystem-dev libboost-program-options-dev libboost-system-dev\r
+\r
+# generate configure script\r
+cd redismodule\r
+autoreconf --install\r
+cd ..\r
+curl -L https://github.com/cpputest/cpputest/releases/download/v3.8/cpputest-3.8.tar.gz | \\r
+    tar --strip-components=1 -xzf -\r
+cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_COVERAGE=ON -DMEMORY_LEAK_DETECTION=OFF .\r
+sudo make install\r
+echo "--> setup-sdl-build-deb.sh ends"
\ No newline at end of file