diff options
author | Guillaume Tucker <guillaume.tucker@collabora.com> | 2018-10-22 17:40:45 +0100 |
---|---|---|
committer | Matt Hart <github@blacklabsystems.com> | 2018-11-14 18:40:42 +0000 |
commit | da83f4f52b981b057464261ba7b34a03c5accf45 (patch) | |
tree | 1be4b58d9d4171678cb13d89df1a9f2ce91c5baa /jenkins/bisect.jpl | |
parent | 1ee933cd8de8abf3e738312916477e121ba21e85 (diff) |
bisect.jpl: use Docker
* add DOCKER_BASE and COMPILER parameters like for build.jpl
* pull Docker image to run all the job as specified by the
DOCKER_BASE, COMPILER and ARCH parameters like for build.jpl
* move all the bisection logic into a bisection() function and run it
inside a top-level try-catch clause
* run everything on the same node which needs to have both "docker"
and "bisection" labels (bisection jobs still use a build lock)
* make only one clone of kernelci-core now that a single Docker image
can be used to both build the kernels and run LAVA jobs
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Diffstat (limited to 'jenkins/bisect.jpl')
-rw-r--r-- | jenkins/bisect.jpl | 241 |
1 files changed, 123 insertions, 118 deletions
diff --git a/jenkins/bisect.jpl b/jenkins/bisect.jpl index 85e7bfb..12893fa 100644 --- a/jenkins/bisect.jpl +++ b/jenkins/bisect.jpl @@ -43,6 +43,8 @@ DEFCONFIG (defconfig) Name of the Linux kernel defconfig TARGET Name of the device type to test (typically LAVA device type name) +COMPILER (gcc-7) + Name and version number of the compiler LAB Name of the lab in which to run the bisection tests PLAN (boot) @@ -59,6 +61,8 @@ KCI_CORE_URL (https://github.com/kernelci/kernelci-core.git) URL of the kernelci-core repository KCI_CORE_BRANCH (master) Name of the branch to use in the kernelci-core repository +DOCKER_BASE (kernelci/build-) + Dockerhub base address used for the build images LAVA_CALLBACK (kernel-ci-callback) Description of the LAVA auth token to look up and use in LAVA callbacks LAVA_PRIORITY (low) @@ -295,7 +299,7 @@ def runTest(kci_core, describe, expected=0, runs=0) { status = getResult(kci_core, hook) if (status != expected) - break; + break } return status @@ -401,13 +405,9 @@ def runCheck(kdir, kci_core, git_commit, name, run_status, runs=0) { def describe = gitDescribe(kdir) - node("kernel-boot-v2") { - timeout(time: 120, unit: 'MINUTES') { - def kci_core_boot = env.WORKSPACE + '/kernelci-core' - cloneKciCore(kci_core_boot) - def status = runTest(kci_core_boot, describe, run_status, runs) - check = (status == run_status ? true : false) - } + timeout(time: 120, unit: 'MINUTES') { + def status = runTest(kci_core, describe, run_status, runs) + check = (status == run_status ? true : false) } removeTag(kdir, tag) @@ -424,13 +424,110 @@ def checkAbort(passed, message) { return passed } -node("bisection") { +def bisection(kci_core, kdir, checks) { + def check = null + + stage("Init") { + timeout(time: 30, unit: 'MINUTES') { + parallel( + kci_core: { cloneKciCore(kci_core) }, + kdir: { cloneLinux(kdir) }, + ) + } + } + + stage("Check pass") { + check = runCheck(kdir, kci_core, params.GOOD_COMMIT, 'pass', 0) + } + if (!checkAbort(check, "Good revision check failed")) + return + + stage("Check fail") { + check = runCheck(kdir, kci_core, params.BAD_COMMIT, 'fail', 2) + } + if (!checkAbort(check, "Bad revision check failed")) + return + + stage("Start") { + timeout(time: 5, unit: 'MINUTES') { + check = bisectStart(kdir) + } + } + if (!checkAbort(check, + "Failed to start bisection, commits range may be invalid.")) + return + + def previous = params.GOOD_COMMIT + def current = getSHA(kdir) + def iteration = 1 + + while (previous != current) { + def tag = createTag(kdir, iteration) + def status = null + + echo "Iteration #${iteration}: ${tag}" + + lock("${env.NODE_NAME}-build-lock") { + stage("Build ${iteration}") { + timeout(time: 60, unit: 'MINUTES') { + try { + buildKernel(kdir, kci_core) + status = 0 + } catch (error) { + status = 1 + } + } + } + } + + if (status == 0) { + def describe = gitDescribe(kdir) + + stage("Test ${iteration}") { + timeout(time: 120, unit: 'MINUTES') { + status = runTest(kci_core, describe) + } + } + } + + removeTag(kdir, tag) + + stage("Next") { + timeout(time: 5, unit: 'MINUTES') { + bisectNext(kdir, status) + } + } + + previous = current + current = getSHA(kdir) + iteration += 1 + } + + stage("Verify") { + check = runCheck(kdir, kci_core, 'refs/bisect/bad', 'verify', 2,3) + checks['verify'] = check ? 'PASS' : 'FAIL' + } + if (!checkAbort(check, "Result check failed")) + return + + stage("Revert") { + dir(kdir) { + sh(script: "git revert refs/bisect/bad") + } + check = runCheck(kdir, kci_core, 'HEAD', 'revert', 0, 3) + checks['revert'] = check ? 'PASS' : 'FAIL' + } + if (!check) + echo "Warning: revert check failed" +} + +node("docker && bisection") { /* Global pipeline constants */ env._BUILD_JSON = "build-data.json" + def docker_image = "${params.DOCKER_BASE}${params.COMPILER}_${params.ARCH}" def kci_core = env.WORKSPACE + '/kernelci-core' def kdir = env.WORKSPACE + '/linux' - def check = null def checks = [:] def params_summary = """\ @@ -473,123 +570,31 @@ ${params_summary}""" } } - try { - stage("Init") { - timeout(time: 30, unit: 'MINUTES') { - parallel( - kci_core: { cloneKciCore(kci_core) }, - kdir: { cloneLinux(kdir) }, - ) - } - } - - stage("Check pass") { - check = runCheck(kdir, kci_core, params.GOOD_COMMIT, 'pass', 0) - } - if (!checkAbort(check, "Good revision check failed")) - return - - stage("Check fail") { - check = runCheck(kdir, kci_core, params.BAD_COMMIT, 'fail', 2) - } - if (!checkAbort(check, "Bad revision check failed")) - return - - stage("Start") { - timeout(time: 5, unit: 'MINUTES') { - check = bisectStart(kdir) - } - } - if (!checkAbort(check, - "Failed to start bisection, commits range may be invalid.")) - return - - def previous = params.GOOD_COMMIT - def current = getSHA(kdir) - def iteration = 1 - - while (previous != current) { - def tag = createTag(kdir, iteration) - def status = null - - echo "Iteration #${iteration}: ${tag}" - - lock("${env.NODE_NAME}-build-lock") { - stage("Build ${iteration}") { - timeout(time: 60, unit: 'MINUTES') { - try { - buildKernel(kdir, kci_core) - status = 0 - } catch (error) { - status = 1 - } - } - } - } - - if (status == 0) { - def describe = gitDescribe(kdir) - - node("kernel-boot-v2") { - stage("Test ${iteration}") { - timeout(time: 120, unit: 'MINUTES') { - def kci_core_boot = env.WORKSPACE + '/kernelci-core' - cloneKciCore(kci_core_boot) - status = runTest(kci_core_boot, describe) - } - } - } - } - - removeTag(kdir, tag) - - stage("Next") { - timeout(time: 5, unit: 'MINUTES') { - bisectNext(kdir, status) - } - } - - previous = current - current = getSHA(kdir) - iteration += 1 - } + def img = docker.image(docker_image) + img.pull() + img.inside() { + try { + bisection(kci_core, kdir, checks) + } catch (err) { + currentBuild.result = "FAILURE" - stage("Verify") { - check = runCheck(kdir, kci_core, 'refs/bisect/bad', 'verify', 2,3) - checks['verify'] = check ? 'PASS' : 'FAIL' - } - if (!checkAbort(check, "Result check failed")) - return - - stage("Revert") { - dir(kdir) { - sh(script: "git revert refs/bisect/bad") - } - check = runCheck(kdir, kci_core, 'HEAD', 'revert', 0, 3) - checks['revert'] = check ? 'PASS' : 'FAIL' - } - if (!check) - echo "Warning: revert check failed" - - } catch (err) { - currentBuild.result = "FAILURE" - - def tree_branch = "${params.KERNEL_TREE}/${params.KERNEL_BRANCH}" - def subject = "bisection error: #${env.BUILD_NUMBER} \ + def tree_branch = "${params.KERNEL_TREE}/${params.KERNEL_BRANCH}" + def subject = "bisection error: #${env.BUILD_NUMBER} \ ${tree_branch} ${params.LAB} ${params.TARGET}" - def body = """\ + def body = """\ ${env.BUILD_URL} ${params_summary} ${err} """ - emailext(subject: subject, body: body, to: params.EMAIL_RECIPIENTS) + emailext(subject: subject, body: body, to: params.EMAIL_RECIPIENTS) - throw err - } + throw err + } - stage("Report") { - pushResults(kci_core, kdir, checks, params_summary) + stage("Report") { + pushResults(kci_core, kdir, checks, params_summary) + } } } |