jjb: lttng-tools: Add rootbuild gerrit jobs
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 13 Aug 2020 21:10:32 +0000 (17:10 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Fri, 14 Aug 2020 14:07:36 +0000 (10:07 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
jobs/lttng-tools.yaml
scripts/common/override-build-std.sh [new file with mode: 0755]
scripts/lttng-tools/build.sh
scripts/lttng-tools/gerrit-build-override.sh [deleted file]
scripts/lttng-tools/gerrit-depends-on.sh

index 4635e91704be94b1481db8d54daf171e34fd60f3..7f72f6a92eef06d368891eb49e932501cc524adb 100644 (file)
@@ -1,28 +1,40 @@
+---
 ## SCM Anchors
-- lttng-tools_git:
-    name: 'lttng-tools_git'
+- lttng-tools_default_git:
+    name: 'lttng-tools_default_git'
     scm:
-      - git: &lttng-tools_git
+      - git: &lttng-tools_default_git
           url: git://github.com/{github_user}/lttng-tools.git
           browser: githubweb
           browser-url: https://github.com/{github_user}/lttng-tools
           branches:
-            - origin/{version}
+            - '{version}'
           basedir: src/lttng-tools
           skip-tag: true
 
-- lttng-modules_git:
-    name: 'lttng-modules_git'
+- lttng-modules_default_git:
+    name: 'lttng-modules_default_git'
     scm:
-      - git: &lttng-modules_git
+      - git: &lttng-modules_default_git
           url: git://github.com/{github_user}/lttng-modules.git
           browser: githubweb
           browser-url: https://github.com/{github_user}/lttng-modules
           branches:
-            - origin/{version}
+            - '{version}'
           basedir: src/lttng-modules
           skip-tag: true
 
+- lttng-tools_gerrit_git:
+    name: 'lttng-tools_gerrit_git'
+    scm:
+      - git: &lttng-tools_gerrit_git
+          url: https://review.lttng.org/lttng-tools
+          refspec: 'refs/changes/*:refs/changes/*'
+          branches:
+            - '$GERRIT_REFSPEC'
+          basedir: src/lttng-tools
+          skip-tag: true
+
 
 ## Defaults
 - defaults:
@@ -49,7 +61,7 @@
             - failure: false
 
     scm:
-      - git: *lttng-tools_git
+      - git: *lttng-tools_default_git
 
     triggers:
       - pollscm:
          name: test_type
          values: '{obj:testtype}'
 
+- lttng-tools_build_axes_rootbuild: &lttng-tools_build_axes_rootbuild
+    name: 'lttng-tools_build_axes_rootbuild'
+    project-type: matrix
+    node: 'master' # Applies only to matrix flyweight task
+    execution-strategy:
+      combination-filter: '{filter}'
+    axes:
+      - axis:
+         type: slave
+         name: node
+         values:
+           - 'amd64-rootnode'
+      - axis:
+         type: user-defined
+         name: arch
+         values: '{obj:arch}'
+      - axis:
+         type: user-defined
+         name: conf
+         values: '{obj:conf}'
+      - axis:
+         type: user-defined
+         name: liburcu_version
+         values: '{obj:urcuversion}'
+      - axis:
+         type: user-defined
+         name: babeltrace_version
+         values: '{obj:babelversion}'
+      - axis:
+         type: user-defined
+         name: build
+         values: '{obj:build}'
+      - axis:
+         type: user-defined
+         name: test_type
+         values: '{obj:testtype}'
+
 
 ## Builders Anchors
 - lttng-tools_build_builders_defaults: &lttng-tools_build_builders_defaults
                 filter: 'build/**'
                 target: 'deps'
                 do-not-fingerprint: true
-            - copyartifact:
-                project: lttng-ust_{ustversion}_{buildtype}/liburcu_version=${{liburcu_version}},arch=${{arch}},conf=std,build=std
-                which-build: last-successful
-                stable: false
-                filter: 'build/**'
-                target: 'deps'
-                do-not-fingerprint: true
       - conditional-step:
           condition-kind: regex-match
           label: '$conf'
                 filter: 'build/**'
                 target: 'deps'
                 do-not-fingerprint: true
-            - copyartifact:
-                project: lttng-ust_${{GERRIT_BRANCH}}_{buildtype}/liburcu_version=${{liburcu_version}},arch=${{arch}},conf=std,build=std
-                which-build: last-successful
-                stable: false
-                filter: 'build/**'
-                target: 'deps'
-                do-not-fingerprint: true
       - conditional-step:
           condition-kind: regex-match
           label: '$conf'
           steps:
             - shell:
                !include-raw-escape:
-                   - scripts/lttng-tools/gerrit-build-override.sh
+                   - scripts/common/override-build-std.sh
                    - scripts/lttng-ust/build.sh
       - shell:
          !include-raw-escape: scripts/lttng-tools/gerrit-install-deps.sh
 - job-template:
     name: lttng-tools_{version}_rootbuild
     defaults: lttng-tools
-    project-type: matrix
-    node: 'master' # Applies only to matrix flyweight task
-    execution-strategy:
-      combination-filter: '{filter}'
-    axes:
-      - axis:
-         type: slave
-         name: node
-         values:
-           - 'amd64-rootnode'
-      - axis:
-         type: user-defined
-         name: arch
-         values: '{obj:arch}'
-      - axis:
-         type: user-defined
-         name: conf
-         values: '{obj:conf}'
-      - axis:
-         type: user-defined
-         name: liburcu_version
-         values: '{obj:urcuversion}'
-      - axis:
-         type: user-defined
-         name: babeltrace_version
-         values: '{obj:babelversion}'
-      - axis:
-         type: user-defined
-         name: build
-         values: '{obj:build}'
-      - axis:
-         type: user-defined
-         name: test_type
-         values: '{obj:testtype}'
 
     scm:
-      - git: *lttng-tools_git
-      - git: *lttng-modules_git
+      - git: *lttng-tools_default_git
+      - git: *lttng-modules_default_git
 
     wrappers:
       - ansicolor
           type: no-activity
       - timestamps
 
+    <<: *lttng-tools_build_axes_rootbuild
     <<: *lttng-tools_build_builders_defaults
     <<: *lttng-tools_build_publishers_prod
 
     concurrent: true
 
     scm:
-      - git:
-          url: https://review.lttng.org/lttng-tools
-          refspec: 'refs/changes/*:refs/changes/*'
-          branches:
-            - '$GERRIT_REFSPEC'
-          basedir: src/lttng-tools
-          skip-tag: true
+      - git: *lttng-tools_gerrit_git
 
     triggers:
       - gerrit:
           clean-if:
             - failure: false
 
+- job-template:
+    name: dev_gerrit_lttng-tools_rootbuild
+    defaults: lttng-tools
+    concurrent: true
+
+    scm:
+      - git: *lttng-tools_gerrit_git
+      - git:
+          <<: *lttng-modules_default_git
+          branches:
+            - '$GERRIT_BRANCH'
+
+    triggers:
+      - gerrit:
+          trigger-on:
+            - comment-added-event:
+                approval-category: 'CI-Build'
+                approval-value: 1
+          projects:
+            - project-compare-type: 'PLAIN'
+              project-pattern: 'lttng-tools'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**'
+          trigger-for-unreviewed-patches: true
+
+    properties:
+      - inject:
+          properties-content: |
+            PROJECT_NAME=lttng-tools
+      - build-discarder:
+          days-to-keep: 1
+      - throttle:
+          option: 'category'
+          categories:
+            - 'gerrit-{buildtype}'
+
+    <<: *lttng-tools_build_axes_rootbuild
+    <<: *lttng-tools_build_builders_gerrit
+
+    publishers:
+      - tap:
+          results: 'tap/**/*.*'
+          fail-if-no-results: true
+          failed-tests-mark-build-as-failure: true
+          todo-is-failure: false
+      - warnings:
+          console-log-parsers:
+            - 'GNU Make + GNU C Compiler (gcc)'
+          total-thresholds:
+            unstable:
+              total-all: 0
+              total-high: 0
+              total-normal: 0
+              total-low: 0
+      - archive:
+          artifacts: 'build/**,deps/**,tap/**'
+          allow-empty: false
+      - workspace-cleanup:
+          clean-if:
+            - failure: false
+
 - job-template:
     name: lttng-tools_{version}_release
     defaults: lttng-tools
           babelversion: !!python/tuple [stable-1.5]
           testtype: !!python/tuple [base]
           filter: ''
+      - 'dev_gerrit_lttng-tools_rootbuild':
+          buildtype: build
+          arch: !!python/tuple [amd64]
+          build: !!python/tuple [std]
+          conf: !!python/tuple [agents]
+          urcuversion: !!python/tuple [stable-0.12]
+          babelversion: !!python/tuple [stable-2.0]
+          testtype: !!python/tuple [base]
+          filter: ''
 
 - project:
     name: lttng-tools-views
diff --git a/scripts/common/override-build-std.sh b/scripts/common/override-build-std.sh
new file mode 100755 (executable)
index 0000000..003ee7a
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash -exu
+#
+# Copyright (C) 2020 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This file should be used as a jenkins job builder RAW import allowing the
+# override of the "build" variable on shell builder execution.
+
+# shellcheck disable=SC2034
+build=std
index 4458a0ce5fd822ea235dd714561f28a976133290..b44dd2c82098f470440890973a9ce5fed8b77288 100755 (executable)
@@ -290,6 +290,8 @@ fi
 # Most build configs require the python bindings
 CONF_OPTS=("--prefix=$PREFIX" "--enable-python-bindings")
 
+DIST_CONF_OPTS=()
+
 # Set configure options and environment variables for each build
 # configuration.
 case "$conf" in
@@ -302,6 +304,7 @@ static)
 no-ust)
     echo "Build without UST support"
     CONF_OPTS+=("$NO_UST")
+    DIST_CONF_OPTS+=("$NO_UST")
     ;;
 
 agents)
@@ -355,7 +358,7 @@ dist)
 
     # Run configure and generate the tar file
     # in the source directory
-    ./configure
+    ./configure "${DIST_CONF_OPTS[@]}"
     $MAKE dist
 
     # Create and enter a temporary build directory
@@ -378,7 +381,7 @@ oot-dist)
     cd "$builddir"
 
     # Run configure out of tree and generate the tar file
-    "$SRCDIR/configure"
+    "$SRCDIR/configure" "${DIST_CONF_OPTS[@]}"
     $MAKE dist
 
     dist_srcdir="$(mktemp -d)"
diff --git a/scripts/lttng-tools/gerrit-build-override.sh b/scripts/lttng-tools/gerrit-build-override.sh
deleted file mode 100755 (executable)
index 003ee7a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash -exu
-#
-# Copyright (C) 2020 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# This file should be used as a jenkins job builder RAW import allowing the
-# override of the "build" variable on shell builder execution.
-
-# shellcheck disable=SC2034
-build=std
index 4003dfc1fb164183e46df22c71dbd99b29cffb8b..7b47b9341f250e46878dc983f28bc36ea713eef2 100755 (executable)
@@ -25,7 +25,7 @@ gerrit_url="https://${GERRIT_NAME}"
 gerrit_query="?o=CURRENT_REVISION&o=DOWNLOAD_COMMANDS"
 gerrit_json_query=".revisions[.current_revision].ref"
 
-possible_depends_on="lttng-ust"
+possible_depends_on="lttng-ust|lttng-modules"
 re="Depends-on: (${possible_depends_on}): ([^'$'\n'']*)"
 property_file="${WORKSPACE}/gerrit_custom_dependencies.properties"
 
@@ -55,6 +55,17 @@ git rev-list --format=%B --max-count=1 HEAD | while read -r line; do
         continue
     fi
 
+    if [ "$project" = "lttng-modules" ]; then
+        if [ -d "$WORKSPACE/src/lttng-modules" ]; then
+            # Remove the regular modules sources to replace them with those
+           # from the gerrit change
+            rm -rf "$WORKSPACE/src/lttng-modules"
+        else
+            # This job does not require modules sources
+            continue
+       fi
+    fi
+
     # Export the GERRIT_DEP_... into the property file for further jenkins usage
     echo "GERRIT_DEP_${project_sanitize^^}=${gerrit_id}" >> "$property_file"
 
This page took 0.029711 seconds and 4 git commands to generate.