Add autotools jobs for ric-plt/sdl 02/3602/17
authorLott, Christopher (cl778h) <cl778h@att.com>
Thu, 14 May 2020 12:32:13 +0000 (08:32 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Wed, 20 May 2020 18:47:13 +0000 (14:47 -0400)
Use new global-jjb templates to verify, stage and analyze with sonar.
Split into separate packagecloud-stage jobs for deb and rpm packages.

Drop docker-based CI jobs that built and published to PackageCloud.

Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: I2ccb26b82b64069d6ef95e442c6c76be6a3fd507

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

index ea198f4..13481a2 100644 (file)
     jobs:
       - gerrit-info-yaml-verify
 
-- sdl_docker_common: &sdl_docker_common
-    # values apply to all ric-plt/sdl docker projects
-    name: sdl-docker-common
+- sdl_common: &sdl_common
+    # values apply to all ric-plt/sdl projects
+    name: sdl-common
     # git repo
     project: ric-plt/sdl
     # jenkins job name prefix
     project-name: ric-plt-sdl
-    # maven settings file has docker credentials
+    # maven settings file has credentials
     mvn-settings: ric-plt-sdl-settings
 
+# compile code and run tests
 - project:
-    <<: *sdl_docker_common
-    name: ric-plt-sdl
-    # use host network to clone from our gerrit
-    docker-build-args: '--network=host -f ci/Dockerfile'
-    # image name
-    docker-name: '{name}'
-    # image tag, use a fixed value
-    container-tag-method: latest
+    <<: *sdl_common
+    name: ric-plt-sdl-lib
+    pre-build: !include-raw-escape: setup-sdl-build-deb.sh
+    build-node: ubuntu1804-builder-2c-2g
+    make-opts: -j 2 test
     jobs:
-      - gerrit-docker-verify
-      - oran-gerrit-docker-ci-pc-merge
+      - gerrit-autotools-verify
     stream:
       - master:
           branch: master
 
+# common settings for building DEB and RPM packages
+- sdl_pkg_common: &sdl_pkg_common
+    name: ric-plt-pkg-cmn
+    pre-build: !include-raw-escape: setup-sdl-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:
+    <<: *sdl_common
+    <<: *sdl_pkg_common
+    name: ric-plt-sdl-deb
+    project-name: '{name}'
+    configure-opts: --with-deb-dir={build-dir}
+    make-opts: -j4 deb-pkg
+
+# build RPM package files
 - project:
+    <<: *sdl_common
+    <<: *sdl_pkg_common
+    name: ric-plt-sdl-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:
+    <<: *sdl_common
+    name: ric-plt-lib-sdl-sonarqube
+    pre-build: !include-raw-escape: setup-sdl-build-deb.sh
+    build-node: ubuntu1804-docker-4c-4g
+    # set appropriate CXXFLAGS
+    configure-opts: --with-gcov-report-dir=gcov_report
+    # use all cores
+    make-opts: -j4 test_gcov
+    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:
+    <<: *sdl_common
     name: ric-plt-sdl-release
-    project: ric-plt/sdl
-    project-name: ric-plt-sdl
-    build-node: centos7-builder-1c-1g
     jobs:
       - gerrit-packagecloud-release-verify
       - gerrit-packagecloud-release-merge
diff --git a/jjb/ric-plt-sdl/setup-sdl-build-deb.sh b/jjb/ric-plt-sdl/setup-sdl-build-deb.sh
new file mode 100644 (file)
index 0000000..2c1c3ad
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+##############################################################################
+#
+#   Copyright (c) 2020 AT&T Intellectual Property.
+#   Copyright (c) 2020 Nokia.
+#
+#   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
+autoreconf --install
+
+echo "--> setup-sdl-build-deb.sh ends"