diff --git a/Jenkinsfile b/Jenkinsfile index 338cabed39..7cb22b71bd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,17 +1,11 @@ pipeline { agent none - options { - buildDiscarder(logRotator(numToKeepStr: '10')) - timeout(time: 60, unit: 'MINUTES') - timestamps() - } stages { - stage('Quality Checks') { agent { docker { image 'px4io/px4-dev-base:2017-10-23' - args '--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true' + args '--env CI=true' } } steps { @@ -24,22 +18,22 @@ pipeline { script { def builds = [:] - // nuttx default targets that are archived and uploaded to s3 - for (def option in ["px4fmu-v2", "px4fmu-v3", "px4fmu-v4", "px4fmu-v4pro", "px4fmu-v5", "aerocore2", "aerofc-v1", "auav-x21", "crazyflie", "mindpx-v2", "tap-v1", "nxphlite-v3"]) { - def node_name = "${option}" + // nuttx default targets that are archived and uploaded to s3 + for (def node_name in ["px4fmu-v4", "px4fmu-v4pro", "px4fmu-v5", "aerofc-v1"]) { builds["${node_name}"] = { node { stage("Build Test ${node_name}") { - docker.image('px4io/px4-dev-nuttx:2017-10-23').inside("--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true") { + docker.image('px4io/px4-dev-nuttx:2017-10-23').inside('-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw') { stage("${node_name}") { checkout scm sh "make clean" sh "ccache -z" sh "git fetch --tags" sh "make nuttx_${node_name}_default" + sh "make nuttx_${node_name}_rtps" sh "ccache -s" - archive 'build/*/*.px4' + archiveArtifacts(artifacts: 'build/*/*.px4', fingerprint: true) } } } @@ -47,20 +41,45 @@ pipeline { } } - // 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}" + // special case for fmu-v2/fmu-v3 + builds["px4fmu-v2"] = { + node { + stage("Build Test ${node_name}") { + docker.image('px4io/px4-dev-nuttx:2017-10-23').inside('-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw') { + stage("${node_name}") { + checkout scm + sh "make clean" + sh "ccache -z" + sh "git fetch --tags" + sh "make nuttx_px4io-v2_default" + sh "make nuttx_px4fmu-v2_default" + sh "make nuttx_px4fmu-v2_lpe" + sh "make nuttx_px4fmu-v3_default" + sh "make nuttx_px4fmu-v3_rtps" + sh "ccache -s" + archiveArtifacts(artifacts: 'build/*/*.px4', fingerprint: true) + } + } + } + } + } + + + // nuttx default targets that are archived and uploaded to s3 + for (def node_name in ["aerocore2", "auav-x21", "crazyflie", "mindpx-v2", "nxphlite-v3", "tap-v1"]) { builds["${node_name}"] = { node { stage("Build Test ${node_name}") { - docker.image('px4io/px4-dev-nuttx:2017-10-23').inside("--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true") { + docker.image('px4io/px4-dev-nuttx:2017-10-23').inside('-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw') { stage("${node_name}") { checkout scm sh "make clean" sh "ccache -z" + sh "git fetch --tags" sh "make nuttx_${node_name}_default" sh "ccache -s" + archiveArtifacts(artifacts: 'build/*/*.px4', fingerprint: true) } } } @@ -68,19 +87,18 @@ pipeline { } } - // nuttx non default targets - for (def option in ["px4fmu-v2_lpe", "px4fmu-v3_rtps", "px4fmu-v4_rtps", "px4fmu-v4pro_rtps", "px4fmu-v5_rtps"]) { - def node_name = "${option}" + // other nuttx default targets + for (def node_name in ["px4-same70xplained-v1", "px4-stm32f4discovery", "px4cannode-v1", "px4esc-v1", "px4nucleoF767ZI-v1", "s2740vc-v1"]) { builds["${node_name}"] = { node { stage("Build Test ${node_name}") { - docker.image('px4io/px4-dev-nuttx:2017-10-23').inside("--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true") { + docker.image('px4io/px4-dev-nuttx:2017-10-23').inside('-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw') { stage("${node_name}") { checkout scm sh "make clean" sh "ccache -z" - sh "make nuttx_${node_name}" + sh "make nuttx_${node_name}_default" sh "ccache -s" } } @@ -89,14 +107,13 @@ pipeline { } } - // raspberry pi and bebop (armhf) - for (def option in ["rpi_cross", "bebop_default"]) { - def node_name = "${option}" + // raspberry pi and bebop (armhf) + for (def node_name in ["rpi_cross", "bebop_default"]) { builds["${node_name}"] = { node { stage("Build Test ${node_name}") { - docker.image('px4io/px4-dev-raspi:2017-10-23').inside("--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true") { + docker.image('px4io/px4-dev-raspi:2017-10-23').inside('-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw') { stage("${node_name}") { checkout scm sh "make clean" @@ -110,14 +127,13 @@ pipeline { } } - // other armhf (to be merged with raspi and bebop) - for (def option in ["ocpoc_ubuntu"]) { - def node_name = "${option}" + // other armhf (to be merged with raspi and bebop) + for (def node_name in ["ocpoc_ubuntu"]) { builds["${node_name}"] = { node { stage("Build Test ${node_name}") { - docker.image('px4io/px4-dev-armhf:2017-10-23').inside("--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true") { + docker.image('px4io/px4-dev-armhf:2017-10-23').inside('-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw') { stage("${node_name}") { checkout scm sh "make clean" @@ -131,17 +147,17 @@ pipeline { } } - // GCC7 tests - for (def option in ["posix_sitl_default", "nuttx_px4fmu-v5_default"]) { - def node_name = "${option}" + // GCC7 tests + for (def node_name in ["posix_sitl_default", "nuttx_px4fmu-v5_default"]) { builds["${node_name} (GCC7)"] = { node { stage("Build Test ${node_name} (GCC7)") { - docker.image('px4io/px4-dev-base-archlinux:2017-12-08').inside("--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true") { + docker.image('px4io/px4-dev-base-archlinux:2017-12-08').inside('-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw') { stage("${node_name}") { checkout scm sh "make clean" + sh "ccache -z" sh "make ${node_name}" sh "ccache -s" } @@ -164,7 +180,7 @@ pipeline { // agent { // docker { // image 'px4io/px4-dev-clang:2017-10-23' - // args '--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true' + // args '-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw' // } // } // steps { @@ -177,7 +193,7 @@ pipeline { agent { docker { image 'px4io/px4-dev-base:2017-10-23' - args '--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true' + args '-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw' } } steps { @@ -192,7 +208,7 @@ pipeline { // agent { // docker { // image 'px4io/px4-dev-base:2017-10-23' - // args '--env CCACHE_DIR=/tmp/ccache --volume=/tmp/ccache:/tmp/ccache:rw --env CI=true' + // args '-e CCACHE_BASEDIR=$WORKSPACE -e CCACHE_DIR=/tmp/ccache -v /tmp/ccache:/tmp/ccache:rw' // } // } // steps { @@ -214,34 +230,62 @@ pipeline { } stage('Generate Metadata') { - agent { - docker { - image 'px4io/px4-dev-base:2017-10-23' + + parallel { + + stage('airframe') { + agent { + docker { image 'px4io/px4-dev-base:2017-10-23' } + } + steps { + sh 'make airframe_metadata' + archiveArtifacts(artifacts: 'airframes.md, airframes.xml', fingerprint: true) + } + } + + stage('parameter') { + agent { + docker { image 'px4io/px4-dev-base:2017-10-23' } + } + steps { + sh 'make parameters_metadata' + archiveArtifacts(artifacts: 'parameters.md, parameters.xml', fingerprint: true) + } + } + + stage('module') { + agent { + docker { image 'px4io/px4-dev-base:2017-10-23' } + } + steps { + sh 'make module_documentation' + archiveArtifacts(artifacts: 'modules/*.md', fingerprint: true) + } } - } - steps { - sh 'make airframe_metadata' - archive 'airframes.md, airframes.xml' - sh 'make parameters_metadata' - archive 'parameters.md, parameters.xml' - sh 'make module_documentation' - archive 'modules/*.md' } } stage('S3 Upload') { agent { - docker { - image 'px4io/px4-dev-base:2017-10-23' - } + docker { image 'px4io/px4-dev-base:2017-10-23' } } + when { - branch '*/master|*/beta|*/stable' + anyOf { + branch 'master' + branch 'beta' + branch 'stable' + } } + steps { sh 'echo "uploading to S3"' } } + } + options { + buildDiscarder(logRotator(numToKeepStr: '5')) + timeout(time: 60, unit: 'MINUTES') } }