From f3d8604b477b84631d624aed305afdd944ffa5c6 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 4 Feb 2016 13:58:48 -0500 Subject: [PATCH] Replace modules and kernel jobs with new design --- jobs/inc/kernel-versions.yaml.inc | 725 --------------------- jobs/kernel.yaml | 79 --- jobs/lttng-modules.yaml | 156 ++++- scripts/lttng-modules/master-ubuntu.groovy | 182 ++++++ scripts/lttng-modules/master.groovy | 269 ++++++++ scripts/lttng-modules/param-build.sh | 106 +++ 6 files changed, 693 insertions(+), 824 deletions(-) delete mode 100644 jobs/inc/kernel-versions.yaml.inc delete mode 100644 jobs/kernel.yaml create mode 100644 scripts/lttng-modules/master-ubuntu.groovy create mode 100644 scripts/lttng-modules/master.groovy create mode 100644 scripts/lttng-modules/param-build.sh diff --git a/jobs/inc/kernel-versions.yaml.inc b/jobs/inc/kernel-versions.yaml.inc deleted file mode 100644 index 6cfa8a1..0000000 --- a/jobs/inc/kernel-versions.yaml.inc +++ /dev/null @@ -1,725 +0,0 @@ -- 2.6.36 -- 2.6.36.1 -- 2.6.36.2 -- 2.6.36.3 -- 2.6.36.4 -- 2.6.37 -- 2.6.37.1 -- 2.6.37.2 -- 2.6.37.3 -- 2.6.37.4 -- 2.6.37.5 -- 2.6.37.6 -- 2.6.38 -- 2.6.38.1 -- 2.6.38.2 -- 2.6.38.3 -- 2.6.38.4 -- 2.6.38.5 -- 2.6.38.6 -- 2.6.38.7 -- 2.6.38.8 -- 2.6.39 -- 2.6.39.1 -- 2.6.39.2 -- 2.6.39.3 -- 2.6.39.4 -- '3.0' -- 3.0.1 -- 3.0.2 -- 3.0.3 -- 3.0.4 -- 3.0.5 -- 3.0.6 -- 3.0.7 -- 3.0.8 -- 3.0.9 -- 3.0.10 -- 3.0.11 -- 3.0.12 -- 3.0.13 -- 3.0.14 -- 3.0.15 -- 3.0.16 -- 3.0.17 -- 3.0.18 -- 3.0.19 -- 3.0.20 -- 3.0.21 -- 3.0.22 -- 3.0.23 -- 3.0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 3.10.2 -- 3.10.3 -- 3.10.4 -- 3.10.5 -- 3.10.6 -- 3.10.7 -- 3.10.8 -- 3.10.9 -- 3.10.10 -- 3.10.11 -- 3.10.12 -- 3.10.13 -- 3.10.14 -- 3.10.15 -- 3.10.16 -- 3.10.17 -- 3.10.18 -- 3.10.19 -- 3.10.20 -- 3.10.21 -- 3.10.22 -- 3.10.23 -- 3.10.24 -- 3.10.25 -- 3.10.26 -- 3.10.27 -- 3.10.28 -- 3.10.29 -- 3.10.30 -- 3.10.31 -- 3.10.32 -- 3.10.33 -- 3.10.34 -- 3.10.35 -- 3.10.36 -- 3.10.37 -- 3.10.38 -- 3.10.39 -- 3.10.40 -- 3.10.41 -- 3.10.42 -- 3.10.43 -- 3.10.44 -- 3.10.45 -- 3.10.46 -- 3.10.47 -- 3.10.48 -- 3.10.49 -- 3.10.50 -- 3.10.51 -- 3.10.52 -- 3.10.53 -- 3.10.54 -- 3.10.55 -- 3.10.56 -- 3.10.57 -- 3.10.58 -- 3.10.59 -- 3.10.60 -- 3.10.61 -- 3.10.62 -- 3.10.63 -- 3.10.64 -- 3.10.65 -- 3.10.66 -- 3.10.67 -- 3.10.68 -- 3.10.69 -- 3.10.70 -- 3.10.71 -- 3.10.72 -- 3.10.73 -- 3.10.74 -- 3.10.75 -- 3.10.76 -- 3.10.77 -- 3.10.78 -- 3.10.79 -- 3.10.80 -- 3.10.81 -- 3.10.82 -- 3.10.83 -- 3.10.84 -- 3.10.85 -- 3.10.86 -- 3.10.87 -- 3.10.88 -- 3.10.89 -- 3.10.90 -- 3.10.91 -- 3.10.92 -- 3.10.93 -- 3.10.94 -- '3.11' -- 3.11.1 -- 3.11.2 -- 3.11.3 -- 3.11.4 -- 3.11.5 -- 3.11.6 -- 3.11.7 -- 3.11.8 -- 3.11.9 -- 3.11.10 -- '3.12' -- 3.12.1 -- 3.12.2 -- 3.12.3 -- 3.12.4 -- 3.12.5 -- 3.12.6 -- 3.12.7 -- 3.12.8 -- 3.12.9 -- 3.12.10 -- 3.12.11 -- 3.12.12 -- 3.12.13 -- 3.12.14 -- 3.12.15 -- 3.12.16 -- 3.12.17 -- 3.12.18 -- 3.12.19 -- 3.12.20 -- 3.12.21 -- 3.12.22 -- 3.12.23 -- 3.12.24 -- 3.12.25 -- 3.12.26 -- 3.12.27 -- 3.12.28 -- 3.12.29 -- 3.12.30 -- 3.12.31 -- 3.12.32 -- 3.12.33 -- 3.12.34 -- 3.12.35 -- 3.12.36 -- 3.12.37 -- 3.12.38 -- 3.12.39 -- 3.12.40 -- 3.12.41 -- 3.12.42 -- 3.12.43 -- 3.12.44 -- 3.12.45 -- 3.12.46 -- 3.12.47 -- 3.12.48 -- 3.12.49 -- 3.12.50 -- 3.12.51 -- '3.13' -- 3.13.1 -- 3.13.2 -- 3.13.3 -- 3.13.4 -- 3.13.5 -- 3.13.6 -- 3.13.7 -- 3.13.8 -- 3.13.9 -- 3.13.10 -- 3.13.11 -- '3.14' -- 3.14.1 -- 3.14.2 -- 3.14.3 -- 3.14.4 -- 3.14.5 -- 3.14.6 -- 3.14.7 -- 3.14.8 -- 3.14.9 -- 3.14.10 -- 3.14.11 -- 3.14.12 -- 3.14.13 -- 3.14.14 -- 3.14.15 -- 3.14.16 -- 3.14.17 -- 3.14.18 -- 3.14.19 -- 3.14.20 -- 3.14.21 -- 3.14.22 -- 3.14.23 -- 3.14.24 -- 3.14.25 -- 3.14.26 -- 3.14.27 -- 3.14.28 -- 3.14.29 -- 3.14.30 -- 3.14.31 -- 3.14.32 -- 3.14.33 -- 3.14.34 -- 3.14.35 -- 3.14.36 -- 3.14.37 -- 3.14.38 -- 3.14.39 -- 3.14.40 -- 3.14.41 -- 3.14.42 -- 3.14.43 -- 3.14.44 -- 3.14.45 -- 3.14.46 -- 3.14.47 -- 3.14.48 -- 3.14.49 -- 3.14.50 -- 3.14.51 -- 3.14.52 -- 3.14.53 -- 3.14.54 -- 3.14.55 -- 3.14.56 -- 3.14.57 -- 3.14.58 -- '3.15' -- 3.15.1 -- 3.15.2 -- 3.15.3 -- 3.15.4 -- 3.15.5 -- 3.15.6 -- 3.15.7 -- 3.15.8 -- 3.15.9 -- 3.15.10 -- '3.16' -- 3.16.1 -- 3.16.2 -- 3.16.3 -- 3.16.4 -- 3.16.5 -- 3.16.6 -- 3.16.7 -- '3.17' -- 3.17.1 -- 3.17.2 -- 3.17.3 -- 3.17.4 -- 3.17.5 -- 3.17.6 -- 3.17.7 -- 3.17.8 -- '3.18' -- 3.18.1 -- 3.18.2 -- 3.18.3 -- 3.18.4 -- 3.18.5 -- 3.18.6 -- 3.18.7 -- 3.18.8 -- 3.18.9 -- 3.18.10 -- 3.18.11 -- 3.18.12 -- 3.18.13 -- 3.18.14 -- 3.18.15 -- 3.18.16 -- 3.18.17 -- 3.18.18 -- 3.18.19 -- 3.18.20 -- 3.18.21 -- 3.18.22 -- 3.18.23 -- 3.18.24 -- 3.18.25 -- '3.19' -- 3.19.1 -- 3.19.2 -- 3.19.3 -- 3.19.4 -- 3.19.5 -- 3.19.6 -- 3.19.7 -- 3.19.8 -- '4.0' -- 4.0.1 -- 4.0.2 -- 4.0.3 -- 4.0.4 -- 4.0.5 -- 4.0.6 -- 4.0.7 -- 4.0.8 -- 4.0.9 -- '4.1' -- 4.1.1 -- 4.1.2 -- 4.1.3 -- 4.1.4 -- 4.1.5 -- 4.1.6 -- 4.1.7 -- 4.1.8 -- 4.1.9 -- 4.1.10 -- 4.1.11 -- 4.1.12 -- 4.1.13 -- 4.1.14 -- 4.1.15 -- '4.2' -- 4.2.1 -- 4.2.2 -- 4.2.3 -- 4.2.4 -- 4.2.5 -- 4.2.6 -- 4.2.7 -- 4.2.8 -- '4.3' -- 4.3.1 -- 4.3.2 -- 4.3.3 -- 4.4-rc6 - diff --git a/jobs/kernel.yaml b/jobs/kernel.yaml deleted file mode 100644 index 6b542e3..0000000 --- a/jobs/kernel.yaml +++ /dev/null @@ -1,79 +0,0 @@ ---- -- defaults: - name: kernel - description: | - Prepare kernel tree for OOT build of lttng-modules - -

Job is managed by Jenkins Job Builder.

- - project-type: freestyle - - logrotate: - daysToKeep: -1 - numToKeep: 2 - artifactDaysToKeep: -1 - artifactNumToKeep: -1 - - wrappers: - - workspace-cleanup - - timestamps - - ansicolor - - #scm: - # - git: - # url: git://artifacts.internal.efficios.com/git/linux-stable.git - # branches: - # - refs/tags/v{kversion} - # shallow-clone: true - # skip-tag: true - # fastpoll: true - # basedir: linux - # reference-repo: $HOME/gitcache/linux-stable.git/ - - properties: - - throttle: - max-per-node: 0 - max-total: 0 - option: category - categories: - - 'lttng-module-linux' - - -## Templates -- job-template: - name: kernel_{kversion}_{buildtype} - defaults: kernel - - project-type: matrix - node: 'master' # Applies only to matrix flyweight task - axes: - - axis: - type: slave - name: arch - values: '{obj:arch}' - - builders: - - shell: | - git clone --depth=1 -b "v{kversion}" --reference $HOME/gitcache/linux-stable.git/ git://artifacts.internal.efficios.com/git/linux-stable.git linux - - shell: - !include-raw-escape: scripts/kernel/build.sh - - publishers: - - archive: - artifacts: 'build/**' - allow-empty: false - - workspace-cleanup - - -## Project -- project: - name: kernel - kversion: - !include: jobs/inc/kernel-versions.yaml.inc - jobs: - - 'kernel_{kversion}_{buildtype}': - buildtype: build - arch: !!python/tuple [x86-32, x86-64] - #- 'kernel_{kversion}_{buildtype}': - # buildtype: portbuild - # arch: !!python/tuple [armhf, powerpc] diff --git a/jobs/lttng-modules.yaml b/jobs/lttng-modules.yaml index 7bacd31..c2743a4 100644 --- a/jobs/lttng-modules.yaml +++ b/jobs/lttng-modules.yaml @@ -10,10 +10,7 @@ project-type: freestyle logrotate: - daysToKeep: -1 numToKeep: 2 - artifactDaysToKeep: -1 - artifactNumToKeep: -1 wrappers: - workspace-cleanup @@ -24,7 +21,7 @@ - git: url: git://github.com/lttng/lttng-modules.git browser: githubweb - browser-url: https://github.com/efficios/lttng-modules + browser-url: https://github.com/lttng/lttng-modules branches: - "{mversion}" shallow-clone: true @@ -38,13 +35,7 @@ properties: - github: - url: https://github.com/efficios/lttng-modules - - throttle: - max-per-node: 0 - max-total: 0 - option: category - categories: - - 'lttng-module-linux' + url: https://github.com/lttng/lttng-modules ## Templates @@ -79,6 +70,132 @@ allow-empty: false - workspace-cleanup +- job-template: + name: lttng-modules_{mversion}_build-vanilla + defaults: lttng-modules + + node: 'master' + + parameters: + - string: + name: 'mversion' + default: '{mversion}' + description: 'The lttng-modules branch to build.' + - string: + name: 'maxConcurrentBuild' + default: '4' + description: 'The maximum number of concurrent child build to run.' + - string: + name: 'kverfloor' + default: 'v2.6.36' + description: 'The lowest kernel version to build.' + - string: + name: 'kgitrepo' + default: 'git://artifacts.internal.efficios.com/git/linux-stable.git' + description: 'The linux kernel git repository url.' + - string: + name: 'kbuildjob' + default: 'lttng-modules_VERSION_param-build' + description: 'The parametrized job to use for child builds.' + + builders: + - system-groovy: + command: + !include-raw-escape: scripts/lttng-modules/master.groovy + + publishers: + - workspace-cleanup + +- job-template: + name: lttng-modules_{mversion}_build-{uversion} + defaults: lttng-modules + + node: 'master' + + parameters: + - string: + name: 'mversion' + default: '{mversion}' + description: 'The lttng-modules branch to build.' + - string: + name: 'maxConcurrentBuild' + default: '4' + description: 'The maximum number of concurrent child build to run.' + - string: + name: 'uversion' + default: '{uversion}' + description: 'The lowest kernel version to build.' + - string: + name: 'kgitrepo' + default: 'git://artifacts.internal.efficios.com/git/ubuntu-{uversion}.git' + description: 'The linux kernel git repository url.' + - string: + name: 'kbuildjob' + default: 'lttng-modules_VERSION_param-build' + description: 'The parametrized job to use for child builds.' + + builders: + - system-groovy: + command: + !include-raw-escape: scripts/lttng-modules/master-ubuntu.groovy + + publishers: + - workspace-cleanup + +- job-template: + name: lttng-modules_VERSION_param-build + defaults: lttng-modules + description: | + This is a parametrized job used by 'master' jobs to build any combinations + of lttng-modules and linux kernel versions. + +

Job is managed by Jenkins Job Builder.

+ + project-type: matrix + node: 'master' # Applies only to matrix flyweight task + axes: + - axis: + type: slave + name: arch + values: '{obj:arch}' + + parameters: + - string: + name: 'mversion' + default: 'master' + description: 'The lttng-modules branch to build.' + - string: + name: 'kversion' + default: '' + description: 'The linux kernel git tag to build against.' + - string: + name: 'kgitrepo' + default: 'git://artifacts.internal.efficios.com/git/linux-stable.git' + description: 'The linux kernel git repository url.' + + concurrent: true + logrotate: + daysToKeep: -1 + + scm: + - git: + url: git://github.com/lttng/lttng-modules.git + browser: githubweb + browser-url: https://github.com/lttng/lttng-modules + branches: + - "${{mversion}}" + skip-tag: true + basedir: lttng-modules + + builders: + - shell: | + git clone --depth=1 -b "$kversion" --reference $HOME/gitcache/linux-stable.git/ "$kgitrepo" linux + - shell: + !include-raw-escape: scripts/lttng-modules/param-build.sh + + publishers: + - workspace-cleanup + - job-template: name: lttng-modules_{mversion}_coverity defaults: lttng-modules @@ -92,7 +209,7 @@ - git: url: git://github.com/lttng/lttng-modules.git browser: githubweb - browser-url: https://github.com/efficios/lttng-modules + browser-url: https://github.com/lttng/lttng-modules branches: - "{mversion}" @@ -126,7 +243,7 @@ - git: url: git://github.com/lttng/lttng-modules.git browser: githubweb - browser-url: https://github.com/efficios/lttng-modules + browser-url: https://github.com/lttng/lttng-modules branches: - "{mversion}" @@ -152,15 +269,14 @@ name: lttng-modules mversion: !include: jobs/inc/lttng-modules-versions.yaml.inc - kversion: - !include: jobs/inc/kernel-versions.yaml.inc jobs: - - 'lttng-modules_{mversion}_{kversion}_{buildtype}': - buildtype: build + - 'lttng-modules_{mversion}_build-vanilla' + - 'lttng-modules_{mversion}_build-{uversion}': + uversion: + - trusty + - xenial + - 'lttng-modules_VERSION_param-build': arch: !!python/tuple [x86-32, x86-64] - #- 'lttng-modules_{mversion}_{kversion}_{buildtype}': - # buildtype: portbuild - # arch: !!python/tuple [armhf, powerpc] - 'lttng-modules_{mversion}_cppcheck' - 'lttng-modules_{mversion}_coverity': mversion: master diff --git a/scripts/lttng-modules/master-ubuntu.groovy b/scripts/lttng-modules/master-ubuntu.groovy new file mode 100644 index 0000000..8dca9cd --- /dev/null +++ b/scripts/lttng-modules/master-ubuntu.groovy @@ -0,0 +1,182 @@ +/** + * Copyright (C) 2016 - Michael Jeanson + * + * 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 . + */ + +import hudson.model.* +import hudson.AbortException +import hudson.console.HyperlinkNote +import java.util.concurrent.CancellationException +import org.eclipse.jgit.api.Git +import org.eclipse.jgit.lib.Ref + + +// Retrieve parameters of the current build +def mversion = build.buildVariableResolver.resolve('mversion') +def maxConcurrentBuild = build.buildVariableResolver.resolve('maxConcurrentBuild') +def kgitrepo = build.buildVariableResolver.resolve('kgitrepo') +def uversion = build.buildVariableResolver.resolve('uversion') +def job = Hudson.instance.getJob(build.buildVariableResolver.resolve('kbuildjob')) + +// Get the out variable +def config = new HashMap() +def bindings = getBinding() +config.putAll(bindings.getVariables()) +def out = config['out'] + +def jlc = new jenkins.model.JenkinsLocationConfiguration() +def jenkinsUrl = jlc.url + +// Get tags from git repository +def refs = Git.lsRemoteRepository().setTags(true).setRemote(kgitrepo).call(); + +// Get kernel versions to build +def kversions = [] + +def matchStrs = [] + +switch (uversion) { + case 'xenial': + matchStrs = [ + ~/^refs\/tags\/(Ubuntu-4\.4\.0-[\d\.]+)$/, + ~/^refs\/tags\/(Ubuntu-lts-.*_16\.04\.\d+)$/, + ] + break + + case 'trusty': + matchStrs = [ + ~/^refs\/tags\/(Ubuntu-3\.13\.0-[\d\.]+)$/, + ~/^refs\/tags\/(Ubuntu-lts-.*_14\.04\.\d+)$/, + ] + break + + default: + println 'Unsupported Ubuntu version: ${uversion}' + throw new InterruptedException() + break +} + +for (ref in refs) { + for (matchStr in matchStrs) { + def match = ref.getName() =~ matchStr + + if (match) { + kversions.add(match.group(1)) + } + } +} + +kversions.sort() + +// Debug +println "Building the following kernel versions:" +for (k in kversions) { + println k +} + +// Debug: Stop build here +//throw new InterruptedException() + +def joburl = HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName) + +def allBuilds = [] +def ongoingBuild = [] +def failedRuns = [] +def isFailed = false + +// Loop while we have kernel versions remaining or jobs running +while ( kversions.size() != 0 || ongoingBuild.size() != 0 ) { + + if(ongoingBuild.size() < maxConcurrentBuild.toInteger() && kversions.size() != 0) { + def kversion = kversions.pop() + def job_params = [ + new StringParameterValue('mversion', mversion), + new StringParameterValue('kversion', kversion), + new StringParameterValue('kgitrepo', kgitrepo), + ] + + // Launch the parametrized build + def param_build = job.scheduleBuild2(0, new Cause.UpstreamCause(build), new ParametersAction(job_params)) + println "triggering ${joburl} for the ${mversion} branch on kernel ${kversion}" + + // Add it to the ongoing build queue + ongoingBuild.push(param_build) + + } else { + + println "Waiting... Queued: " + kversions.size() + " Running: " + ongoingBuild.size() + try { + Thread.sleep(5000) + } catch(e) { + if (e in InterruptedException) { + build.setResult(hudson.model.Result.ABORTED) + throw new InterruptedException() + } else { + throw(e) + } + } + + def i = ongoingBuild.iterator() + while ( i.hasNext() ) { + currentBuild = i.next() + if ( currentBuild.isCancelled() || currentBuild.isDone() ) { + // Remove from queue + i.remove() + + // Print results + def matrixParent = currentBuild.get() + allBuilds.add(matrixParent) + def kernelStr = matrixParent.buildVariableResolver.resolve("kversion") + println "${matrixParent.fullDisplayName} (${kernelStr}) completed with status ${matrixParent.result}" + + // Process child runs of matrixBuild + def childRuns = matrixParent.getRuns() + for ( childRun in childRuns ) { + println "\t${childRun.fullDisplayName} (${kernelStr}) completed with status ${childRun.result}" + if (childRun.result != Result.SUCCESS) { + failedRuns.add(childRun) + isFailed = true + } + } + } + } + } +} + +// Get log of failed runs +for (failedRun in failedRuns) { + println "---START---" + failedRun.writeWholeLogTo(out) + println "---END---" +} + +println "---Build report---" +for (b in allBuilds) { + def kernelStr = b.buildVariableResolver.resolve("kversion") + println "${b.fullDisplayName} (${kernelStr}) completed with status ${b.result}" +} + +// Clean all builds +// TODO: Delete only builds generated from this job run +for (b in job.getBuilds()) { + b.delete() +} + +// Mark this build failed if any child build has failed +if (isFailed) { + build.getExecutor().interrupt(Result.FAILURE) +} + +// EOF diff --git a/scripts/lttng-modules/master.groovy b/scripts/lttng-modules/master.groovy new file mode 100644 index 0000000..74d885c --- /dev/null +++ b/scripts/lttng-modules/master.groovy @@ -0,0 +1,269 @@ +/** + * Copyright (C) 2016 - Michael Jeanson + * + * 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 . + */ + +import hudson.model.* +import hudson.AbortException +import hudson.console.HyperlinkNote +import java.util.concurrent.CancellationException +import org.eclipse.jgit.api.Git +import org.eclipse.jgit.lib.Ref + + +class kVersion implements Comparable { + + Integer major = 0; + Integer majorB = 0; + Integer minor = 0; + Integer patch = 0; + Integer rc = Integer.MAX_VALUE; + + kVersion() {} + + kVersion(version) { + this.parse(version) + } + + def parse(version) { + this.major = 0 + this.majorB = 0 + this.minor = 0 + this.patch = 0 + this.rc = Integer.MAX_VALUE + + def match = version =~ /^v(\d+)\.(\d+)(\.(\d+))?(\.(\d+))?(-rc(\d+))?$/ + if (!match) { + throw new Exception("Invalid kernel version: ${version}") + } + + Integer offset = 0; + + // Major + this.major = Integer.parseInt(match.group(1)) + if (this.major <= 2) { + offset = 2 + this.majorB = Integer.parseInt(match.group(2)) + } + + // Minor + if (match.group(2 + offset) != null) { + this.minor = Integer.parseInt(match.group(2 + offset)) + } + + // Patch level + if (match.group(4 + offset) != null) { + this.patch = Integer.parseInt(match.group(4 + offset)) + } + + // RC + if (match.group(8) != null) { + this.rc = Integer.parseInt(match.group(8)) + } + } + + // Return true if this version is a release candidate + Boolean isRC() { + return this.rc != Integer.MAX_VALUE + } + + @Override int compareTo(kVersion o) { + if (this.major != o.major) { + return Integer.compare(this.major, o.major); + } + if (this.majorB != o.majorB) { + return Integer.compare(this.majorB, o.majorB); + } + 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.rc != o.rc) { + return Integer.compare(this.rc, o.rc); + } + + // Same version + return 0; + } + + String toString() { + String vString = "v${this.major}" + + if (this.majorB > 0) { + vString = vString.concat(".${this.majorB}") + } + + vString = vString.concat(".${this.minor}") + + if (this.patch > 0) { + vString = vString.concat(".${this.patch}") + } + + if (this.rc > 0 && this.rc < Integer.MAX_VALUE) { + vString = vString.concat("-rc${this.rc}") + } + return vString + } +} + + +// Retrieve parameters of the current build +def mversion = build.buildVariableResolver.resolve('mversion') +def maxConcurrentBuild = build.buildVariableResolver.resolve('maxConcurrentBuild') +def kgitrepo = build.buildVariableResolver.resolve('kgitrepo') +def kverfloor = new kVersion(build.buildVariableResolver.resolve('kverfloor')) +def job = Hudson.instance.getJob(build.buildVariableResolver.resolve('kbuildjob')) + +// Get the out variable +def config = new HashMap() +def bindings = getBinding() +config.putAll(bindings.getVariables()) +def out = config['out'] + +def jlc = new jenkins.model.JenkinsLocationConfiguration() +def jenkinsUrl = jlc.url + +// Get tags from git repository +def refs = Git.lsRemoteRepository().setTags(true).setRemote(kgitrepo).call(); + +// Get kernel versions to build +def kversions = [] +def kversionsRC = [] +for (ref in refs) { + def match = ref.getName() =~ /^refs\/tags\/(v[\d\.]+(-rc(\d+))?)$/ + + if (match) { + def v = new kVersion(match.group(1)) + + if (v >= kverfloor) { + if (v.isRC()) { + kversionsRC.add(v) + } else { + kversions.add(v) + } + } + } +} + +kversions.sort() +kversionsRC.sort() + +// If the last RC version is newer than the last stable, add it to the build list +if (kversionsRC.last() > kversions.last()) { + kversions.add(kversionsRC.last()) +} + +// Debug +println "Building the following kernel versions:" +for (k in kversions) { + println k +} + +// Debug: Stop build here +//throw new InterruptedException() + +def joburl = HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName) + +def allBuilds = [] +def ongoingBuild = [] +def failedRuns = [] +def isFailed = false + +// Loop while we have kernel versions remaining or jobs running +while ( kversions.size() != 0 || ongoingBuild.size() != 0 ) { + + if(ongoingBuild.size() < maxConcurrentBuild.toInteger() && kversions.size() != 0) { + def kversion = kversions.pop() + def job_params = [ + new StringParameterValue('mversion', mversion), + new StringParameterValue('kversion', kversion.toString()), + new StringParameterValue('kgitrepo', kgitrepo), + ] + + // Launch the parametrized build + def param_build = job.scheduleBuild2(0, new Cause.UpstreamCause(build), new ParametersAction(job_params)) + println "triggering ${joburl} for the ${mversion} branch on kernel ${kversion}" + + // Add it to the ongoing build queue + ongoingBuild.push(param_build) + + } else { + + println "Waiting... Queued: " + kversions.size() + " Running: " + ongoingBuild.size() + try { + Thread.sleep(5000) + } catch(e) { + if (e in InterruptedException) { + build.setResult(hudson.model.Result.ABORTED) + throw new InterruptedException() + } else { + throw(e) + } + } + + def i = ongoingBuild.iterator() + while ( i.hasNext() ) { + currentBuild = i.next() + if ( currentBuild.isCancelled() || currentBuild.isDone() ) { + // Remove from queue + i.remove() + + // Print results + def matrixParent = currentBuild.get() + allBuilds.add(matrixParent) + def kernelStr = matrixParent.buildVariableResolver.resolve("kversion") + println "${matrixParent.fullDisplayName} (${kernelStr}) completed with status ${matrixParent.result}" + + // Process child runs of matrixBuild + def childRuns = matrixParent.getRuns() + for ( childRun in childRuns ) { + println "\t${childRun.fullDisplayName} (${kernelStr}) completed with status ${childRun.result}" + if (childRun.result != Result.SUCCESS) { + failedRuns.add(childRun) + isFailed = true + } + } + } + } + } +} + +// Get log of failed runs +for (failedRun in failedRuns) { + println "---START---" + failedRun.writeWholeLogTo(out) + println "---END---" +} + +println "---Build report---" +for (b in allBuilds) { + def kernelStr = b.buildVariableResolver.resolve("kversion") + println "${b.fullDisplayName} (${kernelStr}) completed with status ${b.result}" +} + +// Clean all builds +// TODO: Delete only builds generated from this job run +for (b in job.getBuilds()) { + b.delete() +} + +// Mark this build failed if any child build has failed +if (isFailed) { + build.getExecutor().interrupt(Result.FAILURE) +} + +// EOF diff --git a/scripts/lttng-modules/param-build.sh b/scripts/lttng-modules/param-build.sh new file mode 100644 index 0000000..d14f49d --- /dev/null +++ b/scripts/lttng-modules/param-build.sh @@ -0,0 +1,106 @@ +#!/bin/sh -exu +# +# Copyright (C) 2016 - Michael Jeanson +# +# 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 . + +# Kernel version compare functions +verlte() { + [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | head -n1`" ] +} + +verlt() { + [ "$1" = "$2" ] && return 1 || verlte $1 $2 +} + +vergte() { + [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | tail -n1`" ] +} + +vergt() { + [ "$1" = "$2" ] && return 1 || vergte $1 $2 +} + +# Use all CPU cores +NPROC=$(nproc) + +SRCDIR="${WORKSPACE}/lttng-modules" +BUILDDIR="${WORKSPACE}/build" +LNXSRCDIR="${WORKSPACE}/linux" +LNXBUILDDIR="${WORKSPACE}/linux-build" + +# Create build directory +mkdir -p "${BUILDDIR}" "${LNXBUILDDIR}" + +# Enter linux source dir +cd "${LNXSRCDIR}" + +# Prepare linux sources for modules OOT build +make O="${LNXBUILDDIR}" defconfig + +# Enable CONFIG_KALLSYMS_ALL +sed -i "s/# CONFIG_KALLSYMS_ALL is not set/CONFIG_KALLSYMS_ALL=y/g" "${LNXBUILDDIR}"/.config + +# Build to out of tree dir +make O="${LNXBUILDDIR}" modules_prepare + +case "$kversion" in + Ubuntu*) + #fakeroot debian/rules clean + #fakeroot debian/rules genconfigs + #cp CONFIGS/amd64-config.flavour.generic .config + + # Add Ubuntu ABI number to kernel headers, this is normally done by the packaging code + ABINUM=$(echo $kversion | grep -P -o 'Ubuntu-(lts-)?.*-\K\d+(?=\..*)') + echo "#define UTS_UBUNTU_RELEASE_ABI $ABINUM" >> ${LNXBUILDDIR}/include/generated/utsrelease.h + ;; +esac + +# Get kernel version from source tree +cd "${LNXBUILDDIR}" +KVERSION=$(make kernelversion) + +# Enter source dir +cd "${SRCDIR}" + +# kernels 3.10 to 3.10.13 and 3.11 to 3.11.2 introduce a deadlock in the +# timekeeping subsystem. We want those build to fail. +if { vergte "$KVERSION" "3.10" && verlte "$KVERSION" "3.10.13"; } || \ + { vergte "$KVERSION" "3.11" && verlte "$KVERSION" "3.11.2"; }; then + + set +e + + # Build modules + make -j${NPROC} -C "${LNXBUILDDIR}" M="$(pwd)" V=1 CONFIG_LTTNG=m + + # We expect this build to fail, if it doesn't, fail the job. + if [ "$?" -eq 0 ]; then + exit 1 + fi + + # We have to publish at least one file or the build will fail + echo "This kernel is broken, there is a deadlock in the timekeeping subsystem." > "${BUILDDIR}/BROKEN.txt" + + set -e + +else # Regular build + + # Build modules + make -j${NPROC} -C "${LNXBUILDDIR}" M="$(pwd)" V=1 CONFIG_LTTNG=m + + # Install modules to build dir + make INSTALL_MOD_PATH="${BUILDDIR}" -C "${LNXBUILDDIR}" M="$(pwd)" modules_install +fi + +# EOF -- 2.34.1