jjb: Build lttng-modules against SLE kernels
authorKienan Stewart <kstewart@efficios.com>
Tue, 5 Mar 2024 16:32:47 +0000 (11:32 -0500)
committerKienan Stewart <kstewart@efficios.com>
Fri, 8 Mar 2024 19:15:28 +0000 (14:15 -0500)
Change-Id: I44d825fb2faab4724e7e7150180e180b49c04e13
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
jobs/lttng-modules.yaml
scripts/lttng-modules/master.groovy
scripts/lttng-modules/param-build.sh

index 22c1e3050672a60c74ebcda5ecf05bd659a08af0..bc60dfacf8e6d216ff8a190f4d949f397e740887 100644 (file)
           default: 'lttng-modules_PARAM_build'
           description: 'The parametrized job to use for child builds.'
 
+- _lttng-modules_build_parameters_ubuntu: &lttng-modules_build_parameters_sles
+    name: 'lttng-modules_build_parameters_sles'
+    parameters:
+      - string:
+          name: 'maxConcurrentBuild'
+          default: '20'
+          description: 'The maximum number of concurrent child build to run.'
+      - string:
+          name: 'kverfloor'
+          default: '{kverfloor}'
+          description: 'The lowest kernel version to build.'
+      - string:
+          name: 'kverceil'
+          default: '{kverceil}'
+          description: 'The highest kernel version to build. (excluded)'
+      - string:
+          name: 'kverfilter'
+          default: '{kverfilter}'
+          description: 'Kernel versions list filtering strategy.'
+      - string:
+          name: 'kverrc'
+          default: 'false'
+          description: 'Add latest RC to kernel versions list.'
+      - string:
+          name: 'kgitrepo'
+          default: 'git://git-mirror.internal.efficios.com/git/sles.git'
+          description: 'The linux kernel git repository url.'
+      - string:
+          name: 'kbuildjob'
+          default: 'lttng-modules_PARAM_{parambuildtype}'
+          description: 'The parametrized job to use for child builds.'
+      - string:
+          name: 'slesversion'
+          default: '{slesversion}'
+          description: 'The SLES release (eg. sles15sp4)'
+
 - _lttng-modules_build_parameters_ubuntu: &lttng-modules_build_parameters_ubuntu
     name: 'lttng-modules_build_parameters_ubuntu'
     parameters:
     publishers:
       - workspace-cleanup
 
+- job-template:
+    name: 'dev_review_lttng-modules_{mversion}_build-{slesversion}'
+    defaults: lttng-modules
+    concurrent: true
+
+    node: 'master'
+
+    scm:
+      - git:
+          url: https://review.lttng.org/lttng-modules
+          refspec: 'refs/changes/*:refs/changes/*'
+          branches:
+            - '$GERRIT_REFSPEC'
+          basedir: src/lttng-modules
+          skip-tag: true
+
+    triggers:
+      - gerrit:
+          trigger-on:
+            - comment-added-event:
+                approval-category: 'CI-Build'
+                approval-value: 1
+          projects:
+            - project-compare-type: 'PLAIN'
+              project-pattern: 'lttng-modules'
+              branches:
+                - branch-compare-type: 'PLAIN'
+                  branch-pattern: '{mversion}'
+
+    properties:
+      - build-discarder:
+          days-to-keep: 1
+      - throttle:
+          option: 'category'
+          categories:
+            - 'gerrit-build'
+
+    <<: *lttng-modules_build_parameters_sles
+    <<: *lttng-modules_build_builders_defaults
+
+    publishers:
+      - workspace-cleanup
+
 - job-template:
     name: lttng-modules_{mversion}_fullbuild-vanilla
     defaults: lttng-modules
       - pollscm:
           cron: "0 0 * * 5"
 
+- job-template:
+    name: lttng-modules_{mversion}_{buildtype}-{slesversion}
+    defaults: lttng-modules
+    description: |
+      The LTTng modules provide Linux kernel tracing capability to the LTTng
+      2.0 tracer toolset.
+
+      This job will the {mversion} branch against SLES {slesversion} released
+      kernels.
+
+      <p>Job is managed by Jenkins Job Builder.</p>
+
+    node: 'master'
+    triggers:
+      - pollscm:
+          cron: "@hourly"
+      - timed: "H 0 * * 6"
+    <<: *lttng-modules_build_parameters_sles
+    <<: *lttng-modules_build_builders_defaults
+
 - job-template:
     name: lttng-modules_{mversion}_{buildtype}-{uversion}
     defaults: lttng-modules
           kverceil: ''
           kverfilter: stable-head
 
+# SLES normal builders
+      - 'lttng-modules_{mversion}_{buildtype}-{slesversion}':
+          mversion:
+            - master
+            - stable-2.13
+            - stable-2.12
+          slesversion:
+            - sles15sp4
+          buildtype: build
+          parambuildtype: build
+          kverfloor: ''
+          kverceil: ''
+          kverfilter: stable-head
+
 # Ubuntu normal builds
       - 'lttng-modules_{mversion}_{buildtype}-{uversion}':
           mversion:
           kverfloor: v3.0
           kverceil: v5.18
           kverfilter: lts-head
+      - 'dev_review_lttng-modules_{mversion}_build-{slesversion}':
+          mversion:
+            - master
+            - stable-2.13
+            - stable-2.12
+          slesversion:
+            - sles15sp4
+          buildtype: build
+          parambuildtype: build
+          kverfloor: ''
+          kverceil: ''
+          kverfilter: stable-head
 
 - project:
     name: lttng-modules-dev-mjeanson
index 5989673b1b06170b933001727df529eaaa3a7f31..92fb0c355755e384e4ba7609aaf908008f050116 100644 (file)
@@ -163,6 +163,120 @@ class VanillaKVersion implements Comparable<VanillaKVersion> {
   }
 }
 
+class SlesKVersion implements Comparable<SlesKVersion> {
+  Integer major = 0
+  Integer minor = 0
+  Integer patch = 0
+  Integer slesrelease = 0
+  Integer slesmajor = 0
+  Integer slesminor = 0
+
+  SlesKVersion() {}
+
+  SlesKVersion(version) {
+    this.parse(version)
+  }
+
+  static SlesKVersion minKVersion() {
+    return new SlesKVersion("rpm-0.0.0-0.0.0")
+  }
+
+  static SlesKVersion maxKVersion() {
+    return new SlesKVersion("rpm-" + Integer.MAX_VALUE + ".0.0-0.0.0")
+  }
+
+  static SlesKVersion factory(version) {
+    return new SlesKVersion(version)
+  }
+
+  def parse(version) {
+    this.major = 0
+    this.minor = 0
+    this.patch = 0
+    this.slesrelease = 0
+    this.slesmajor = 0
+    this.slesminor = 0
+
+    if (!version) {
+      throw new EmptyKVersionException("Empty kernel version")
+    }
+
+    // Eg. 5.14.21-150400.22
+    // Eg. 5.14.21-150400.24.100.2
+    // From tag: rpm-5.14.21-150400.24.100 -> 5.14.21-150400.24.100
+    def match = version =~ /^(rpm-)??(\d+)\.(\d+)\.(\d+)-(\d+)\.(\d+)(\.\d+)??$/
+    if (!match) {
+      throw new InvalidKVersionException("Invalid kernel version: ${version}")
+    }
+
+    this.major = Integer.parseInt(match.group(2))
+    this.minor = Integer.parseInt(match.group(3))
+    this.patch = Integer.parseInt(match.group(4))
+    this.slesrelease = Integer.parseInt(match.group(5))
+    this.slesmajor = Integer.parseInt(match.group(6))
+
+    if (match.group(7) != null) {
+      this.slesminor = Integer.parseInt(match.group(7).drop(1))
+    }
+  }
+
+  Boolean isRC() {
+    return false
+  }
+
+  Boolean isSameStable(SlesKVersion o) {
+    if (this.major != o.major) {
+      return false
+    }
+    if (this.minor != o.minor) {
+      return false
+    }
+    if (this.patch != o.patch) {
+      return false
+    }
+    if (this.slesrelease != o.slesrelease) {
+      return false
+    }
+    if (this.slesmajor != o.slesmajor) {
+      return false
+    }
+    if (this.slesminor != o.slesminor) {
+      return false
+    }
+    return true
+  }
+
+  @Override int compareTo(SlesKVersion o) {
+    if (this.major != o.major) {
+      return Integer.compare(this.major, o.major)
+    }
+    if (this.minor != o.minor) {
+      return Integer.compare(this.minor, o.minor)
+    }
+    if (this.patch != o.patch) {
+      return Integer.compare(this.patch, o.patch)
+    }
+    if (this.slesrelease != o.slesrelease) {
+      return Integer.compare(this.slesrelease, o.slesrelease)
+    }
+    if (this.slesmajor != o.slesmajor) {
+      return Integer.compare(this.slesmajor, o.slesmajor)
+    }
+    if (this.slesminor != o.slesminor) {
+      return Integer.compare(this.slesminor, o.slesminor)
+    }
+    return 0
+  }
+
+  String toString() {
+    String vString = "rpm-${this.major}.${this.minor}.${patch}-${this.slesrelease}.${this.slesmajor}"
+    if (this.slesminor != 0) {
+      vString = vString.concat(".${this.slesminor}")
+    }
+    return vString
+  }
+}
+
 class UbuntuKVersion implements Comparable<UbuntuKVersion> {
 
   Integer major = 0
@@ -316,6 +430,7 @@ def kverfloor_raw = build.buildVariableResolver.resolve('kverfloor')
 def kverceil_raw = build.buildVariableResolver.resolve('kverceil')
 def kverfilter = build.buildVariableResolver.resolve('kverfilter')
 def kverrc = build.buildVariableResolver.resolve('kverrc')
+def slesversion = build.buildVariableResolver.resolve('slesversion')
 def uversion = build.buildVariableResolver.resolve('uversion')
 def job = Hudson.instance.getJob(build.buildVariableResolver.resolve('kbuildjob'))
 def currentJobName = build.project.getFullDisplayName()
@@ -342,7 +457,27 @@ def matchStrs = []
 def blacklist = []
 def kversionFactory = ""
 
-if (uversion != null) {
+if (slesversion != null) {
+  kversionFactory = new SlesKVersion()
+  switch (slesversion) {
+    case 'sles15sp4':
+      matchStrs = [
+        ~/^refs\/tags\/(rpm-5.14.21-150400\.22(\.\d+)?(\.\d+)?)$/,
+        ~/^refs\/tags\/(rpm-5.14.21-150400\.24(\.\d+)?(\.\d+)?)$/,
+      ]
+      blacklist = [
+        // "Retracted", @see https://www.suse.com/support/kb/doc/?id=000019587#SLE15SP4
+        'rpm-5.14.21-150400.24.49',
+        'rpm-5.14.21-150400.24.84',
+      ]
+      break
+
+    default:
+      println "Unsupported SLES version: ${slesversion}"
+      throw new InterruptedException()
+      break
+  }
+} else if (uversion != null) {
   kversionFactory = new UbuntuKVersion()
   switch (uversion) {
     case 'jammy':
index 2b29e78e8159a07b97c68871fff857b4e51393cb..5ee567175d130117c232638bf83abb52ee5b1d2d 100644 (file)
@@ -375,6 +375,38 @@ build_linux_kernel() {
         scripts/config --disable CONFIG_KVM_BOOK3S_64_HV
     fi
 
+    if [ -f "init/Kconfig.suse" ] ; then
+        # Get values from git tag, eg. 'rpm-5.14.21-150400.24.108'
+        # Note: the "150400" type of SUSE major version is only present on tags
+        # from 2022 and newer (about half-way through SLE15SP3).
+        # This will not work as expected on earlier tags.
+        SLES_RELEASE="$(echo "${ktag}" | cut -d '-' -f 3 | cut -d'.' -f 1)"
+        scripts/config --set-val CONFIG_SUSE_VERSION $((10#"$(echo "${SLES_RELEASE}" | head -c 2)"))
+        scripts/config --set-val CONFIG_SUSE_PATCHLEVEL $((10#"$(echo "${SLES_RELEASE}" | head -c 4 | tail -c 2)"))
+
+        # Disable the renesas clk driver that has build issues,
+        # eg. drivers/clk/renesas/renesas-rzg2l-cpg.c:185:17: error: ‘clk’ undeclared (first use in this function)
+        scripts/config --disable CONFIG_CLK_RENESAS
+
+        # From drives/spi/spi-atmel.c
+        # ./include/linux/gpio/consumer.h:141:49: note: expected ‘struct gpio_desc *’ but argument is of type 'int'
+        scripts/config --disable CONFIG_SPI_ATMEL
+        scripts/config --disable CONFIG_SPI_AT91_USART
+        scripts/config --disable CONFIG_SPI_ATMEL_QUADSPI
+
+        # drivers/net/wireless/mediatek/mt76/mt7915/testmode.c: In function ‘mt7915_tm_set_wmm_qid’:
+        # drivers/net/wireless/mediatek/mt76/mt7915/testmode.c:176:30: error: ‘struct mt7915_vif’ has no member named ‘mt76’
+        scripts/config --disable CONFIG_WLAN_VENDOR_MEDIATEK
+
+        # drivers/net/wireless/microchip/wilc1000/cfg80211.c: In function ‘wilc_wfi_cfg_parse_ch_attr’:
+        # drivers/net/wireless/microchip/wilc1000/cfg80211.c:970:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
+        scripts/config --disable CONFIG_WLAN_VENDOR_MICROCHIP
+
+        # fs/f2fs/file.c: In function ‘punch_hole’:
+        # fs/f2fs/file.c:1093:49: error: ‘mapping’ undeclared (first use in this function)
+        scripts/config --disable CONFIG_F2FS_FS
+    fi
+
     # oldnoconfig was renamed in 4.19
     if vergte "$kversion" "4.19"; then
         update_conf_target="olddefconfig"
@@ -890,6 +922,14 @@ extract_distro_headers() {
         echo "#define UTS_UBUNTU_RELEASE_ABI $ABINUM" >> include/generated/utsrelease.h
         echo "#define UTS_UBUNTU_RELEASE_ABI $ABINUM" >> "${LINUX_HDROBJ_DIR}/include/generated/utsrelease.h"
         ;;
+      rpm-*)
+        # Update the definition of UTS_RELEASE to match something akin to '5.14.21-150400.24.108-default'
+        if [ -f "init/Kconfig.suse" ] ; then
+          SLESVERSION="$(echo "${ktag}" | cut -d'-' -f 3)-default"
+          sed -E -i "s%^(#define UTS_RELEASE \"[\.a-z0-9]+)(\")%\1-${SLESVERSION}\2%g" include/generated/utsrelease.h
+          sed -E -i "s%^(#define UTS_RELEASE \"[\.a-z0-9]+)(\")%\1-${SLESVERSION}\2%g" "${LINUX_HDROBJ_DIR}/include/generated/utsrelease.h"
+        fi
+        ;;
     esac
 }
 
This page took 0.039447 seconds and 4 git commands to generate.