From 8e2b8749df0aa46cf6690f3972689ad989dcd64d Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Fri, 4 Oct 2024 15:57:16 -0400 Subject: [PATCH] WIP: jjb: Kernel dev jobs Change-Id: I8889b7ccab5d1b4ec2f26153ff9d73a9ec175f72 --- jobs/linux.yml | 59 ++++++++++++++++++++++++++ pipelines/linux/pipeline.groovy.j2 | 68 ++++++++++++++++++++++++++++++ pipelines/linux/watcher.groovy.j2 | 15 +++++++ 3 files changed, 142 insertions(+) create mode 100644 jobs/linux.yml create mode 100644 pipelines/linux/pipeline.groovy.j2 create mode 100644 pipelines/linux/watcher.groovy.j2 diff --git a/jobs/linux.yml b/jobs/linux.yml new file mode 100644 index 0000000..24f07f0 --- /dev/null +++ b/jobs/linux.yml @@ -0,0 +1,59 @@ +--- + +- defaults: + name: linux-kernel + description: | +

Job is managed by Jenkins Job Builder

+ # As the source code doesn't contain a Jenkinsfile, multibranch pipelines don't work + project-type: pipeline + sandbox: true + dsl: + !include-jinja2: pipelines/linux/pipeline.groovy.j2 + # Vars used by pipeline and/or projects + cc: 'gcc' + cxx: 'g++' + github_user: '' + github_project: 'linux' + github_branch_pattern: 'ci/*' + stable_mirror: 'git://git-mirror.internal.efficios.com/git/linux-all.git' + email_to: '' + default_label: 'deb12-amd64' + +## Anchors + +## Job templates + +- job-template: + name: '{job_prefix}linux_kernel_pipeline' + defaults: linux-kernel + +- job-template: + name: '{job_prefix}branch_watcher' + dsl: + !include-jinja2: pipelines/linux/watcher.groovy.j2 +## Views + +- view-template: + name: 'Linux Kernel' + view-type: list + regex: '.*[-_]?linux_kernel[-_].*' + +## Projects + +- project: + name: 'compudj' + job_prefix: 'dev_compudj_' + email_to: 'mathieu.desnoyers@efficios.com' + github_user: 'compudj' + jobs: + - '{job_prefix}linux_kernel_pipeline': + github_project: 'linux-dev' + - '{job_prefix}linux_kernel_pipeline': + job_prefix: 'dev_kstewart' + github_user: 'kienanstewart' + email_to: '' + +- project: + name: linux-views + views: + - 'Linux Kernel' diff --git a/pipelines/linux/pipeline.groovy.j2 b/pipelines/linux/pipeline.groovy.j2 new file mode 100644 index 0000000..dbde92c --- /dev/null +++ b/pipelines/linux/pipeline.groovy.j2 @@ -0,0 +1,68 @@ +pipeline { + agent none + + options { + skipDefaultCheckout(true) + buildDiscarder(logRotator(daysToKeepStr: '7')) + } + + triggers { + pollSCM('H * * * *') + } + + stages { + stage('Checkout') { + agent { + label "{{default_label}}" + } + + steps { + dir('src/linux') { + checkout([ + $class: 'GitSCM', + branches: [[name: '{{github_branch_pattern}}']], + userRemoteConfigs: [[ + url: 'https://github.com/{{github_user}}/{{github_project}}' + ]], + extensions: [ + [$class: 'CloneOption', depth: 1,], + [$class: 'CleanCheckout'], + ], + ]) + + // Do any steps that are pretty generic, like linting or check + // project config. + // The '.git' won't be stashed, so any operations that depend + // on git information should be done now. + sh ( + label: 'Check patch', + script: """\n +git remote add stable {{stable_mirror}} +git fetch stable +git branch -u stable/master +OUTPUT_DIR=\$(mktemp -d) +FAILURE=0 +for patch_file in "\$(ls "\$OUTPUT_DIR/*.patch")" ; do + echo \$patch_file + cat \$patch_file | scripts/checkpatch.pl -q --terse --no-summary --mailback --showfile || FAILURE=1 +done +rm -rf "\${OUTPUT_DIR}" +if [[ "\${FAILURE}" == "1" ]] ; then + exit 1 +fi +""", + ) + } + + + stash(name: 'linux', includes: 'src/linux/**') + } + } + + // parallel (arch) { + + // } + + // Future: parallel (arch, platform) runtime tests + } +} diff --git a/pipelines/linux/watcher.groovy.j2 b/pipelines/linux/watcher.groovy.j2 new file mode 100644 index 0000000..93bd726 --- /dev/null +++ b/pipelines/linux/watcher.groovy.j2 @@ -0,0 +1,15 @@ +pipeline { + agent none + + parameters { + + } + + triggers { + pollScm('H * * * *') + } + + stages { + stage( + } +} -- 2.34.1