Skip to content

Commit

Permalink
Jenkins cleanup build creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Mar 23, 2018
1 parent 01f5f88 commit 7546c16
Showing 1 changed file with 45 additions and 162 deletions.
207 changes: 45 additions & 162 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,16 @@ pipeline {
script {
def builds = [:]

def docker_base = "px4io/px4-dev-base:2017-12-30"
def docker_nuttx = "px4io/px4-dev-nuttx:2017-12-30"
def docker_rpi = "px4io/px4-dev-raspi:2017-12-30"
def docker_armhf = "px4io/px4-dev-armhf:2017-12-30"
def docker_arch = "px4io/px4-dev-base-archlinux:2017-12-30"

// nuttx default targets that are archived and uploaded to s3
for (def option in ["px4fmu-v4", "px4fmu-v4pro", "px4fmu-v5", "aerofc-v1"]) {
def node_name = "${option}"

builds["${node_name}"] = {
node {
stage("Build Test ${node_name}") {
docker.image('px4io/px4-dev-nuttx:2017-12-30').inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage("${node_name}") {
checkout scm
sh "export"
sh "make distclean"
sh "ccache -z"
sh "git fetch --tags"
sh "make nuttx_${node_name}_default"
// bloaty output and compare with last successful master
sh "bloaty -n 100 -d symbols -s file build/nuttx_${node_name}_default/nuttx_${node_name}_default.elf"
sh "bloaty -n 100 -d compileunits -s file build/nuttx_${node_name}_default/nuttx_${node_name}_default.elf"
sh "wget --no-verbose -N https://s3.amazonaws.com/px4-travis/Firmware/master/nuttx_${node_name}_default.elf"
sh "bloaty -d symbols -C full -s file build/nuttx_${node_name}_default/nuttx_${node_name}_default.elf -- nuttx_${node_name}_default.elf"
sh "make nuttx_${node_name}_rtps"
sh "make sizes"
sh "ccache -s"
archiveArtifacts(artifacts: 'build/*/*.px4', fingerprint: true)
archiveArtifacts(artifacts: 'build/*/*.elf', fingerprint: true)
}
}
}
}
}
builds[node_name] = createBuildNode(docker_nuttx, "nuttx_${node_name}_default")
}


Expand All @@ -61,6 +40,8 @@ pipeline {
sh "bloaty -d symbols -C full -s file build/nuttx_px4fmu-v2_default/nuttx_px4fmu-v2_default.elf -- nuttx_px4fmu-v2_default.elf"
sh "make nuttx_px4fmu-v2_lpe"
sh "make nuttx_px4fmu-v3_default"
sh "wget --no-verbose -N https://s3.amazonaws.com/px4-travis/Firmware/master/nuttx_px4fmu-v3_default.elf"
sh "bloaty -d symbols -C full -s file build/nuttx_px4fmu-v3_default/nuttx_px4fmu-v3_default.elf -- nuttx_px4fmu-v3_default.elf"
sh "make nuttx_px4fmu-v3_rtps"
sh "make sizes"
sh "ccache -s"
Expand All @@ -72,126 +53,25 @@ pipeline {
}
}


// nuttx default targets that are archived and uploaded to s3
for (def option in ["aerocore2", "auav-x21", "crazyflie", "mindpx-v2", "nxphlite-v3", "tap-v1"]) {
def node_name = "${option}"

builds["${node_name}"] = {
node {
stage("Build Test ${node_name}") {
docker.image('px4io/px4-dev-nuttx:2017-12-30').inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage("${node_name}") {
checkout scm
sh "export"
sh "make distclean"
sh "ccache -z"
sh "git fetch --tags"
sh "make nuttx_${node_name}_default"
sh "make sizes"
sh "ccache -s"
archiveArtifacts(artifacts: 'build/*/*.px4', fingerprint: true)
archiveArtifacts(artifacts: 'build/*/*.elf', fingerprint: true)
}
}
}
}
}
builds[node_name] = createBuildNode(docker_nuttx, "nuttx_${node_name}_default")
}


// other nuttx default targets
for (def option in ["px4-same70xplained-v1", "px4-stm32f4discovery", "px4cannode-v1", "px4esc-v1", "px4nucleoF767ZI-v1", "s2740vc-v1"]) {
def node_name = "${option}"

builds["${node_name}"] = {
node {
stage("Build Test ${node_name}") {
docker.image('px4io/px4-dev-nuttx:2017-12-30').inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage("${node_name}") {
checkout scm
sh "export"
sh "make distclean"
sh "ccache -z"
sh "make nuttx_${node_name}_default"
sh "make sizes"
sh "ccache -s"
}
}
}
}
}
builds[node_name] = createBuildNode(docker_nuttx, "nuttx_${node_name}_default")
}

builds["posix_sitl"] = createBuildNode(docker_base, "posix_sitl_default")
builds["posix_sitl_default (GCC 7)"] = createBuildNode(docker_arch, "posix_sitl_default")

// posix_sitl
for (def option in ["sitl_default", "sitl_rtps"]) {
def node_name = "${option}"

builds["${node_name}"] = {
node {
stage("Build Test ${node_name}") {
docker.image('px4io/px4-dev-base:2017-12-30').inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage("${node_name}") {
checkout scm
sh "export"
sh "make distclean"
sh "ccache -z"
sh "make posix_${node_name}"
sh "ccache -s"
}
}
}
}
}
}


// raspberry pi and bebop (armhf)
for (def option in ["rpi_cross", "bebop_default"]) {
def node_name = "${option}"

builds["${node_name}"] = {
node {
stage("Build Test ${node_name}") {
docker.image('px4io/px4-dev-raspi:2017-12-30').inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage("${node_name}") {
checkout scm
sh "export"
sh "make distclean"
sh "ccache -z"
sh "make posix_${node_name}"
sh "ccache -s"
}
}
}
}
}
}


// other armhf (to be merged with raspi and bebop)
for (def option in ["ocpoc_ubuntu"]) {
def node_name = "${option}"

builds["${node_name}"] = {
node {
stage("Build Test ${node_name}") {
docker.image('px4io/px4-dev-armhf:2017-12-30').inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage("${node_name}") {
checkout scm
sh "export"
sh "make distclean"
sh "ccache -z"
sh "make posix_${node_name}"
sh "ccache -s"
}
}
}
}
}
}
builds["rpi"] = createBuildNode(docker_rpi, "posix_rpi_cross")
builds["bebop"] = createBuildNode(docker_rpi, "posix_bebop_default")

builds["ocpoc"] = createBuildNode(docker_armhf, "posix_ocpoc_ubuntu")

// snapdragon eagle (posix + qurt)
for (def option in ["eagle_default"]) {
Expand All @@ -217,33 +97,10 @@ pipeline {
}
}


// GCC7 posix
for (def option in ["sitl_default"]) {
def node_name = "${option}"

builds["${node_name} (GCC7)"] = {
node {
stage("Build Test ${node_name} (GCC7)") {
docker.image('px4io/px4-dev-base-archlinux:2017-12-30').inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage("${node_name}") {
checkout scm
sh "export"
sh "make distclean"
sh "ccache -z"
sh "make posix_${node_name}"
sh "ccache -s"
}
}
}
}
}
}

parallel builds
}
}
}
} // script
} // steps
} // stage Builds

stage('Test') {
parallel {
Expand Down Expand Up @@ -588,6 +445,7 @@ pipeline {
docker { image 'px4io/px4-dev-base:2017-12-30' }
}
steps {
sh 'export'
sh 'make distclean'
sh 'make airframe_metadata'
archiveArtifacts(artifacts: 'airframes.md, airframes.xml', fingerprint: true)
Expand All @@ -599,6 +457,7 @@ pipeline {
docker { image 'px4io/px4-dev-base:2017-12-30' }
}
steps {
sh 'export'
sh 'make distclean'
sh 'make parameters_metadata'
archiveArtifacts(artifacts: 'parameters.md, parameters.xml', fingerprint: true)
Expand All @@ -610,6 +469,7 @@ pipeline {
docker { image 'px4io/px4-dev-base:2017-12-30' }
}
steps {
sh 'export'
sh 'make distclean'
sh 'make module_documentation'
archiveArtifacts(artifacts: 'modules/*.md', fingerprint: true)
Expand Down Expand Up @@ -656,7 +516,30 @@ pipeline {
CI = true
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 60, unit: 'MINUTES')
}
}

def createBuildNode(String docker_repo, String target) {
return {
node {
docker.image(docker_repo).inside('-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage(target) {
sh('export')
checkout scm
sh('make distclean')
sh('git fetch --tags')
sh('ccache -z')
sh('make ' + target)
sh('ccache -s')
sh('make sizes')
sh('bloaty -n 100 -d symbols -s file build/' + target + '/' + target + '.elf')
sh('bloaty -n 100 -d compileunits -s file build/' + target + '/' + target + '.elf')
archiveArtifacts(artifacts: 'build/*/*.px4', fingerprint: true)
archiveArtifacts(artifacts: 'build/*/*.elf', fingerprint: true)
}
}
}
}
}

0 comments on commit 7546c16

Please sign in to comment.