From c83311ff8f2722af9b42bc0d21e171ad9c4c2349 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Wed, 6 Mar 2019 08:46:31 +0100 Subject: [PATCH] linux-blackfinn: Add Jenkinsfile Signed-off-by: Thomas Klaehn --- Jenkinsfile | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f988f73 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,116 @@ +pipeline { + agent none + stages { + stage('Checkout') { + agent { + label 'oe-buildenv' + } + steps { + script { + sh """#!/bin/bash + repo init -u https://git.blackfinn.de/yocto/linux-blackfinn.git + repo sync + """ + stage('Fetch') { + script { + if(params.MACHINE == 'beaglebone-yocto') { + echo "Fetch for beaglebone-yocto" + sh """#!/bin/bash + source bbb-init-build-env + bitbake console-image --runall=fetch + """ + } + else if(params.MACHINE == 'raspberrypi3-64') { + echo "Fetch for raspberrypi3-64" + sh """#!/bin/bash + source rpi-init-build-env + bitbake console-image --runall=fetch + """ + } + } + } + stage('Build') { + script { + if(params.MACHINE == 'beaglebone-yocto') { + echo "Build for beaglebone-yocto" + sh """#!/bin/bash + source bbb-init-build-env + bitbake console-image + """ + } + else if(params.MACHINE == 'raspberrypi3-64') { + echo "Build for raspberrypi3-64" + sh """#!/bin/bash + source rpi-init-build-env + bitbake console-image + """ + } + } + stash name: "download_bz2", includes: "**/build/downloads/*.tar.bz2", excludes: "**/build/downloads/*.tar.bz2.*" + stash name: "download_gz", includes: "**/build/downloads/*.tar.gz", excludes: "**/build/downloads/*.tar.gz.*" + stash name: "download_xz", includes: "**/build/downloads/*.tar.xz", excludes: "**/build/downloads/*.tar.xz.*" + + stash name: "deploy_ipk", includes: "**/build/tmp/deploy/ipk/**" + stash name: "deploy_images", includes: "**/build/tmp/deploy/images/**" + } + } + } + } + stage('Deploy downloads') { + agent { + label 'deploy' + } + steps { + unstash "download_bz2" + unstash "download_gz" + unstash "download_xz" + sh "mkdir -p /srv/files.blackfinn.de/data/mirror/sources" + sh "rsync -zv build/downloads/* /srv/files.blackfinn.de/data/mirror/sources/ || exit 0" + } + } + stage('Deploy packages') { + agent { + label 'deploy' + } + steps { + unstash "deploy_ipk" + sh "mkdir -p /srv/files.blackfinn.de/data/ipk/${params.BRANCH}" + sh "rsync -avz build/tmp/deploy/ipk/ /srv/files.blackfinn.de/data/ipk/${params.BRANCH} || exit 0" + sh "ipkindex /srv/files.blackfinn.de/data/ipk/${params.BRANCH}" + } + } + stage('Deploy images') { + agent { + label 'deploy' + } + steps { + unstash "deploy_images" + sh "mkdir -p /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}" + script { + if(params.MACHINE == 'beaglebone-yocto') { + sh "cp build/tmp/deploy/images/${params.MACHINE}/zImage--*-${params.MACHINE}-*.bin /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}/zImage" + sh "cp build/tmp/deploy/images/${params.MACHINE}/console-image-${params.MACHINE}-*.rootfs.wic /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}/console-image.rootfs.wic" + sh "cp build/tmp/deploy/images/${params.MACHINE}/console-image-${params.MACHINE}-*.rootfs.tar.bz2 /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}/console-image.rootfs.tar.bz2" + sh "cp build/tmp/deploy/images/${params.MACHINE}/am335x-boneblack--*-${params.MACHINE}-*.dtb /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}/am335-boneblack.dtb" + } + else if(params.MACHINE == 'raspberrypi3-64') { + sh "mv build/tmp/deploy/images/${params.MACHINE}/Image /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}" + sh "mv build/tmp/deploy/images/${params.MACHINE}/*.dtbo /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}" + sh "mv build/tmp/deploy/images/${params.MACHINE}/console-image-${params.MACHINE}.rpi-sdimg /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}" + sh "mv build/tmp/deploy/images/${params.MACHINE}/console-image-${params.MACHINE}.tar.bz2 /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}" + } + } + sh "mv build/tmp/deploy/images/${params.MACHINE}/*.dtb /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}" + sh "mv build/tmp/deploy/images/${params.MACHINE}/console-image-${params.MACHINE}.manifest /srv/files.blackfinn.de/data/images/${params.BRANCH}/${params.MACHINE}" + + } + } + } +// post { +// failure { +// mail to: 'tkl@blackfinn.de', +// subject: "${currentBuild.currentResult}: ${env.JOB_NAME}", +// body: "${env.JOB_NAME} didn't succeeds. See: ${env.BUILD_URL}" +// } +// } +}