aboutsummaryrefslogtreecommitdiff
path: root/jenkins/bisect.jpl
diff options
context:
space:
mode:
Diffstat (limited to 'jenkins/bisect.jpl')
-rw-r--r--jenkins/bisect.jpl145
1 files changed, 96 insertions, 49 deletions
diff --git a/jenkins/bisect.jpl b/jenkins/bisect.jpl
index f8eb68d..b0eae35 100644
--- a/jenkins/bisect.jpl
+++ b/jenkins/bisect.jpl
@@ -53,8 +53,10 @@ BUILD_ENVIRONMENT
Name of the build environment
LAB
Name of the lab in which to run the bisection tests
-PLAN (boot)
- Name of the test plan
+TEST_PLAN
+ Name of the KernelCI test plan (e.g. baseline)
+TEST_PLAN_VARIANT:
+ Name of the KernelCI test plan variant (e.g. baseline_qemu)
TEST_RUNS (1)
Number of LAVA jobs to run before considering pass or fail.
KCI_API_URL (https://api.kernelci.org)
@@ -84,7 +86,6 @@ TREES_WHITELIST
@Library('kernelci') _
-import org.kernelci.build.Kernel
import org.kernelci.util.Job
/* Working around some seemingly broken Python set-up... */
@@ -210,7 +211,8 @@ git symbolic-ref HEAD refs/heads/${params.KERNEL_BRANCH}
def buildKernel(kdir, kci_core) {
def output = "${kdir}/build-${params.ARCH}-${params.BUILD_ENVIRONMENT}"
dir(kci_core) {
- sh(script: "rm -f ${env._BUILD_JSON}")
+ sh(script: "rm -f ${env._BMETA_JSON}")
+ sh(script: "rm -f ${env._DTBS_JSON}")
sh(script: """\
for d in \$(find ${kdir} -name "build-*" -type d); do
@@ -262,14 +264,10 @@ push_kernel \
""")
}
- sh(script: """\
-./kci_build \
-publish_kernel \
---kdir=${kdir} \
---json-path=${env._BUILD_JSON} \
-""")
-
- stash(name: env._BUILD_JSON, includes: env._BUILD_JSON)
+ dir("${kdir}/_install_") {
+ stash(name: env._BMETA_JSON, includes: env._BMETA_JSON)
+ stash(name: env._DTBS_JSON, includes: env.DTBS_JSON)
+ }
}
}
@@ -284,41 +282,68 @@ def buildRevision(kdir, kci_core, git_rev, name) {
* kernel test with LAVA v2
*/
-def submitJob(kci_core, describe, hook) {
+def fetchLabInfo(kci_core) {
dir(kci_core) {
- sh(script: "rm -rf ${env._BUILD_JSON}; rm -rf data; mkdir data")
- unstash(env._BUILD_JSON)
- sh(script: """
-./lava-v2-jobs-from-api.py \
+ def token = "${params.LAB}-lava-api"
+
+ withCredentials([string(credentialsId: token, variable: 'SECRET')]) {
+ sh(script: """\
+./kci_test \
+get_lab_info \
--lab=${params.LAB} \
---builds=${env._BUILD_JSON} \
---storage=${params.KCI_STORAGE_URL} \
---plans=${params.PLAN} \
---jobs=data \
---arch=${params.ARCH} \
---tree=${params.KERNEL_TREE} \
---describe=${describe} \
---branch=${params.KERNEL_BRANCH} \
---defconfig_full=${params.DEFCONFIG} \
---priority=${params.LAVA_PRIORITY} \
---callback=${params.LAVA_CALLBACK} \
---callback-url=${hook.getURL()} \
---callback-dataset=results \
---callback-type=custom \
---targets=${params.TARGET}
+--lab-json=${env._LAB_JSON} \
+--user=kernel-ci \
+--token=${SECRET} \
""")
+ }
+ stash(name: env._LAB_JSON, includes: env._LAB_JSON)
+ }
+}
+
+def submitJob(kci_core, describe, hook) {
+ dir(kci_core) {
+ sh(script: """\
+rm -f ${env._BMETA_JSON} \
+rm -f ${env._DTBS_JSON} \
+rm -f ${env._LAB_JSON} \
+rm -rf data; mkdir data \
+""")
+ unstash(env._BMETA_JSON)
+ unstash(env._DTBS_JSON)
+ unstash(env._LAB_JSON)
def egg_cache = eggCache()
def token = "${params.LAB}-lava-api"
+ /* ToDo: deal with params.LAVA_PRIORITY or drop it */
+
withCredentials([string(credentialsId: token, variable: 'SECRET')]) {
- sh(script: """
-PYTHON_EGG_CACHE=${egg_cache} \
-./lava-v2-submit-jobs.py \
---username=kernel-ci \
+ sh(script: """ \
+./kci_test \
+generate \
+--bmeta-json=${env._BMETA_JSON} \
+--dtbs-json=${env._DTBS_JSON} \
+--lab-json=${env._LAB_JSON} \
+--storage=${params.KCI_STORAGE_URL} \
+--lab=${params.LAB} \
+--user=kernel-ci \
--token=${SECRET} \
+--output=data \
+--callback-id=${params.LAVA_CALLBACK} \
+--callback-url=${hook.getURL()} \
+--callback-dataset=results \
+--callback-type=custom \
+--target=${params.TARGET} \
+--plan=${params.TEST_PLAN_VARIANT} \
+""")
+
+ sh(script: """ \
+./kci_test \
+submit \
--lab=${params.LAB} \
---jobs=data
+--user=kernel-ci \
+--token=${SECRET} \
+--jobs=data/* \
""")
}
}
@@ -381,7 +406,7 @@ def runTest(kci_core, describe, expected=0, runs=0) {
* bisection
*/
-def findMergeBase(kdir, good, bad) {
+def findMergeBase(kdir, kci_core, good, bad) {
def base = good
dir(kdir) {
@@ -390,16 +415,32 @@ def findMergeBase(kdir, good, bad) {
script: "git merge-base --is-ancestor ${base} HEAD")
if (good_base != 0) {
- def ref = "${params.REF_KERNEL_TREE}/${params.REF_KERNEL_BRANCH}"
+ def ref_url = params.REF_KERNEL_URL
+ def ref_tree = params.REF_KERNEL_TREE
+ def ref_branch = params.REF_KERNEL_BRANCH
+
+ if (!(ref_url && ref_tree && ref_branch)) {
+ dir(kci_core) {
+ ref_config = sh(script: """\
+ ./kci_build get_reference --tree-name ${params.KERNEL_TREE} \
+ --branch ${params.KERNEL_BRANCH}""", returnStdout: true).trim().tokenize("\n")
+ if (ref_config.size() > 0) {
+ ref_url = ref_config[0]
+ ref_tree = ref_config[1]
+ ref_branch = ref_config[2]
+ }
+ }
+ }
+ def ref = "${ref_tree}/${ref_branch}"
print("Good commit not in current branch, finding base in ${ref}")
print("""\
Reference:
- Tree: ${params.REF_KERNEL_TREE}
- URL: ${params.REF_KERNEL_URL}
- Branch: ${params.REF_KERNEL_BRANCH}""")
+ Tree: ${ref_tree}
+ URL: ${ref_url}
+ Branch: ${ref_branch}""")
- setRemote(kdir, params.REF_KERNEL_TREE, params.REF_KERNEL_URL)
+ setRemote(kdir, ref_tree, ref_url)
base = sh(script: "git merge-base ${bad} ${ref}",
returnStdout: true).trim()
print("Merge base: ${base}")
@@ -451,7 +492,9 @@ def bisectNext(kdir, status) {
*/
def pushResults(kci_core, kdir, checks, params_summary) {
- def subject = "${params.KERNEL_TREE}/${params.KERNEL_BRANCH} ${params.PLAN} bisection: ${params.KERNEL_NAME} on ${params.TARGET}"
+ def subject = "\
+${params.KERNEL_TREE}/${params.KERNEL_BRANCH} bisection: \
+${params.TEST_PLAN} on ${params.TARGET}"
dir(kci_core) {
withCredentials([string(credentialsId: params.KCI_TOKEN_ID,
@@ -536,10 +579,11 @@ def bisection(kci_core, kdir, checks) {
kci_core: { cloneKciCore(kci_core) },
kdir: { cloneLinux(kdir) },
)
+ fetchLabInfo(kci_core)
}
bad = params.BAD_COMMIT
- good = findMergeBase(kdir, params.GOOD_COMMIT, bad)
+ good = findMergeBase(kdir, kci_core, params.GOOD_COMMIT, bad)
}
stage("Check pass") {
@@ -631,7 +675,9 @@ def bisection(kci_core, kdir, checks) {
node("docker && bisection") {
/* Global pipeline constants */
- env._BUILD_JSON = "build-data.json"
+ env._BMETA_JSON = "bmeta.json"
+ env._DTBS_JSON = "dtbs.json"
+ env._LAB_JSON = "lab-info.json"
def j = new Job()
def kci_core = "${env.WORKSPACE}/kernelci-core"
@@ -648,14 +694,15 @@ node("docker && bisection") {
Lab: ${params.LAB}
Defconfig: ${params.DEFCONFIG}
Compiler: ${params.BUILD_ENVIRONMENT}
- Plan: ${params.PLAN}"""
+ Plan: ${params.TEST_PLAN}
+ Variant: ${params.TEST_PLAN_VARIANT}"""
print("""\
Good: ${params.GOOD_COMMIT}
Bad: ${params.BAD_COMMIT}
${params_summary}""")
- if ((params.PLAN != 'boot') && (params.PLAN != 'simple')) {
- echo "Only doing boot and simple plans for now, aborting."
+ if (params.TEST_PLAN != 'boot') {
+ echo "Only doing boot bisections for now, aborting."
currentBuild.result = 'ABORTED'
return
}