Add autotools jobs & pre-build script for com/log 96/3996/2
authorLott, Christopher (cl778h) <cl778h@att.com>
Thu, 4 Jun 2020 13:13:18 +0000 (09:13 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Thu, 4 Jun 2020 13:49:25 +0000 (09:49 -0400)
Use global-jjb autotools jobs 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: I7158cfa04f02f32c22388dfed6fbf5ba74a46809

jjb/com-log/com-log.yaml
jjb/com-log/setup-com-log-build-deb.sh [new file with mode: 0644]

index 7915ffc..e5876e6 100644 (file)
     jobs:
       - gerrit-info-yaml-verify
 
-- log_docker_common: &log_docker_common
-    # values apply to all com/log docker projects
-    name: log-docker-common
+- com_log_common: &com_log_common
+    # values apply to all com/log projects
+    name: com-log-common
     # git repo
     project: com/log
     # jenkins job name prefix
     project-name: com-log
     # maven settings file has docker credentials
     mvn-settings: com-log-settings
+    # verify/merge/package/sonar all require this
+    pre-build: !include-raw-escape: setup-com-log-build-deb.sh
 
+# compile code and run tests
 - project:
-    <<: *log_docker_common
-    name: com-log
-    # 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
+    <<: *com_log_common
+    name: com-log-lib
+    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
+- com_log_pkg_common: &com_log_pkg_common
+    name: com-log-pkg-common
+    # 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:
+    <<: *com_log_common
+    <<: *com_log_pkg_common
+    name: com-log-deb
+    project-name: '{name}'
+    configure-opts: --with-deb-dir={build-dir}
+    make-opts: -j4 deb-pkg
+
+# build RPM package files
+- project:
+    <<: *com_log_common
+    <<: *com_log_pkg_common
+    name: com-log-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:
+    <<: *com_log_common
+    name: com-log-sonarqube
+    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:
+    <<: *com_log_common
+    # these templates ignore the pre-build script
     name: com-log-release
-    project: com/log
-    project-name: com-log
-    build-node: centos7-builder-1c-1g
     jobs:
       - gerrit-packagecloud-release-verify
       - gerrit-packagecloud-release-merge
+
diff --git a/jjb/com-log/setup-com-log-build-deb.sh b/jjb/com-log/setup-com-log-build-deb.sh
new file mode 100644 (file)
index 0000000..d952b32
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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 com/log code
+# and build RPM/DEB packages on a Debian/Ubuntu machine.
+
+echo "--> setup-com-log-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 libjsoncpp-dev rpm valgrind
+
+# generate configure script
+autoreconf --install
+
+echo "--> setup-com-log-build-deb.sh ends"