summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Touzet <joant@atypical.net>2017-05-26 05:27:15 -0400
committerJoan Touzet <wohali@users.noreply.github.com>2017-05-28 21:28:01 -0400
commit5596496fc7a5ffea3a9117b06e95139150e1392a (patch)
tree823a4a081d29ef456a3a72f0e8f730e91364ed1f
parentbfad30ad01daa72074fd80d734950d63c8838364 (diff)
downloadcouchdb-5596496fc7a5ffea3a9117b06e95139150e1392a.tar.gz
New Jenkinsfile for multibranch pipeline build
-rw-r--r--Jenkinsfile306
-rwxr-xr-xbuild-aux/logfile-uploader.py5
2 files changed, 308 insertions, 3 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 000000000..0ef6ddefd
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,306 @@
+#!groovy
+/*
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+*/
+pipeline {
+ /* no top-level agent; agents must be declared for each stage */
+ agent none
+
+ environment {
+ COUCHAUTH = credentials('couchdb_vm2_couchdb')
+ recipient = 'notifications@couchdb.apache.org'
+ }
+
+ stages {
+ stage('Build') {
+ agent {
+ docker {
+ /* This image has the oldest Erlang we support, 16B03 */
+ image 'couchdbdev/ubuntu-14.04-erlang-default'
+ /* We need the jenkins user mapped inside of the image */
+ args '-v /etc/passwd:/etc/passwd -v /etc/group:/etc/group'
+ }
+ }
+ steps {
+ timeout(time: 15, unit: "MINUTES") {
+ /* npm config cache below is required because /home/jenkins doesn't
+ ACTUALLY exist in the image */
+ /* sh 'git clone --depth 10 https://github.com/apache/couchdb .' */
+ sh '''
+ export npm_config_cache=$(mktemp -d)
+ ./configure --with-curl
+ make dist
+ '''
+ stash includes: 'apache-couchdb-*.tar.gz', name: 'tarball'
+ archiveArtifacts artifacts: 'apache-couchdb-*.tar.gz', fingerprint: true
+ deleteDir()
+ }
+ }
+ }
+
+ /* TODO rework this once JENKINS-41334 is released
+ https://issues.jenkins-ci.org/browse/JENKINS-41334 */
+ /* The builddir stuff is to prevent all 10 builds from live syncing
+ their build results to each other during the build. Moving the
+ build outside of the workdir should speed up the build process too,
+ though it does mean we pollute /tmp whenever a build fails. */
+ stage('Test') {
+ steps {
+ parallel(centos6erlang183: {
+ node(label: 'ubuntu') {
+ timeout(time: 45, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/centos-6-erlang-18.3'
+ withDockerContainer(image: 'couchdbdev/centos-6-erlang-18.3', args: '-e LD_LIBRARY_PATH=/usr/local/bin --user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ centos7erlangdefault: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/centos-7-erlang-default'
+ withDockerContainer(image: 'couchdbdev/centos-7-erlang-default', args: '-e LD_LIBRARY_PATH=/usr/local/bin --user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ centos7erlang183: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/centos-7-erlang-18.3'
+ withDockerContainer(image: 'couchdbdev/centos-7-erlang-18.3', args: '-e LD_LIBRARY_PATH=/usr/local/bin --user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ ubuntu1204erlang183: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/ubuntu-12.04-erlang-18.3'
+ withDockerContainer(image: 'couchdbdev/ubuntu-12.04-erlang-18.3', args: '--user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ ubuntu1404erlangdefault: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/ubuntu-14.04-erlang-default'
+ withDockerContainer(image: 'couchdbdev/ubuntu-14.04-erlang-default', args: '--user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ ubuntu1404erlang183: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/ubuntu-14.04-erlang-18.3'
+ withDockerContainer(image: 'couchdbdev/ubuntu-14.04-erlang-18.3', args: '--user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ ubuntu1604erlangdefault: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/ubuntu-16.04-erlang-default'
+ withDockerContainer(image: 'couchdbdev/ubuntu-16.04-erlang-default', args: '--user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ ubuntu1604erlang183: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/ubuntu-16.04-erlang-18.3'
+ withDockerContainer(image: 'couchdbdev/ubuntu-16.04-erlang-18.3', args: '--user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ debian8erlangdefault: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/debian-8-erlang-default'
+ withDockerContainer(image: 'couchdbdev/debian-8-erlang-default', args: '--user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ },
+ debian8erlang183: {
+ node(label: 'ubuntu') {
+ timeout(time: 30, unit: "MINUTES") {
+ sh 'rm *.tar.gz || true'
+ unstash 'tarball'
+ sh 'docker pull couchdbdev/debian-8-erlang-18.3'
+ withDockerContainer(image: 'couchdbdev/debian-8-erlang-18.3', args: '--user 0:0') {
+ sh '''
+ cwd=$(pwd)
+ builddir=$(mktemp -d)
+ cd $builddir
+ tar -xf $cwd/apache-couchdb-*.tar.gz
+ cd apache-couchdb-*
+ ./configure --with-curl
+ make all
+ make check || (build-aux/logfile-uploader.py && false)
+ '''
+ } // withDocker
+ } // timeout
+ } // node
+ }
+ ) // parallel
+ } // steps
+ } // stage
+
+ stage('Publish') {
+ when {
+ branch '*(master|2.0.x|2.1.x)'
+ }
+ agent any
+ steps {
+ /* Push it somewhere useful other than Jenkins, maybe? */
+ /* echo 'Publishing tarball...'
+ unstash 'tarball' */
+ echo 'Triggering Debian .deb builds...'
+ echo 'Triggering Ubuntu .deb builds...'
+ echo 'Triggering Ubuntu snap builds...'
+ echo 'Triggering CentOS .rpm builds...'
+ echo 'Cleaning workspace...'
+ sh 'rm -rf * .[a-zA-Z]*'
+ }
+ }
+ }
+
+ post {
+ success {
+ mail to: "${env.recipient}",
+ subject: "[Jenkins] SUCCESS: ${currentBuild.fullDisplayName}",
+ replyTo: "${env.recipient}",
+ body: "Yay, we passed. ${env.BUILD_URL}"
+ }
+ failure {
+ mail to: "${env.recipient}",
+ subject: "[Jenkins] FAILURE: ${currentBuild.fullDisplayName}",
+ replyTo: "${env.recipient}",
+ body: "Boo, we failed. ${env.BUILD_URL}"
+ }
+ }
+}
diff --git a/build-aux/logfile-uploader.py b/build-aux/logfile-uploader.py
index 7218b587b..27a5c94b0 100755
--- a/build-aux/logfile-uploader.py
+++ b/build-aux/logfile-uploader.py
@@ -59,9 +59,8 @@ def build_ci_doc():
doc['builder'] = 'jenkins'
doc['build_id'] = os.environ['BUILD_NUMBER']
doc['url'] = os.environ['BUILD_URL']
- doc['branch'] = os.environ['GIT_BRANCH']
- doc['commit'] = os.environ['GIT_COMMIT']
- doc['repo'] = os.environ['GIT_URL']
+ doc['branch'] = os.environ['BRANCH_NAME']
+ doc['repo'] = 'https://github.com/apache/couchdb'
else:
doc['builder'] = 'manual'
# TODO: shell out to get correct repo, commit, branch info?