diff options
author | Joan Touzet <joant@atypical.net> | 2019-12-12 02:10:38 -0500 |
---|---|---|
committer | Joan Touzet <wohali@apache.org> | 2019-12-16 13:51:31 -0800 |
commit | 728e6f6fe15d9065951ea13556d393a794647cb0 (patch) | |
tree | cb0bfb03426f23e68fe6576f711e8d888a42e8fb | |
parent | cda94302d7b1462061cc0ae14a1c714950b61d61 (diff) | |
download | couchdb-728e6f6fe15d9065951ea13556d393a794647cb0.tar.gz |
Rework CI setup
This commit:
* Removes Travis CI from the build (no more .travis.yml)
and our README file
* Moves Jenkinsfile to build-aux/Jenkinsfile.full and updates the version
of Erlang used in all steps to 20.3.8.24
* Introduces a new build-aux/Jenkinsfile.pr that just builds
CouchDB against the 3 most important versions of Erlang,
intended for use when building PRs
* Removes `make elixir` from `make check`. See email to dev@couchdb.a.o
for details.
TODO
====
1. Once DNS is updated & Jenkins is ready, move pointer in README for badge to
correct job in new Jenkins host
1. Finish setting up Jenkins for multibranch pipeline, correctly, so it builds
PRs, including PRs not from branches in the same repo (fork branches)
-rw-r--r-- | .travis.yml | 86 | ||||
-rw-r--r-- | README.rst | 5 | ||||
-rw-r--r-- | build-aux/Jenkinsfile.full (renamed from Jenkinsfile) | 16 | ||||
-rw-r--r-- | build-aux/Jenkinsfile.pr | 255 |
4 files changed, 263 insertions, 99 deletions
diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0e1a54a0e..000000000 --- a/.travis.yml +++ /dev/null @@ -1,86 +0,0 @@ -language: elixir -elixir: 1.7.4 -os: linux -dist: trusty - -otp_release: - - 22.0.5 - - 21.2.3 - - 20.3.8.5 - - 19.3 - -addons: - apt: - sources: - - deadsnakes - packages: - - build-essential - - curl - - libcurl4-openssl-dev - - libicu-dev - - libmozjs185-dev - - pkg-config - - python3.6 - - python3.6-dev - - python3.6-venv - - python3-requests - - python3-sphinx -# - sphinx-rtd-theme - - help2man - - shunit2 - -git: - depth: 10 - -# logfile uploader uses requests -cache: - - pip - -# logfile uploader credentials -env: - global: - - secure: "UdA/gKIlyuXaW+hUgRx40t1TYjLCGxMqHvM5Uw7UbUH2dqEkgJiLfhZGchS1JVzl8M01VKZUUzS7v2nvRLiHZN1kvaw5kfq31VRoafUah8jfmvqNWZVdLovHl3aw5UX/HRt0RkbWbhdbdknTfh6+YinSZ+Nb54jCErMg9nabXtM=" - - COUCHDB_IO_LOG_DIR=/tmp/couchjslogs - -# Enable this block if you want to build docs & fauxton too -#node_js: -# - 6 -#before_script: -# - ./configure -c - -# Then comment this section out -before_script: - - kerl list installations - - rm -rf /tmp/couchjslogs - - mkdir -p /tmp/couchjslogs - - ./configure -c --disable-docs --disable-fauxton - - python3.6 -m venv /tmp/.venv - - source /tmp/.venv/bin/activate - - pip install requests - -script: - - make check - -after_failure: - - build-aux/logfile-uploader.py - -# start a push build on master and release branches + PRs build on every branch -# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147) -branches: - only: - - master - - /^\d+\.x\.x$/ - - /^\d+\.\d+\.x$/ - -# Re-enable once test suite is reliable -#notifications: -# email: false -# irc: -# channels: -# "irc.freenode.org#couchdb-dev" -# on_success: change -# on_failure: always -# use_notice: true -# skip_join: true -# template: -# - %{repository_slug}/%{branch}: %{message} %{build_url}" diff --git a/README.rst b/README.rst index a03d6ec5a..3519009e1 100644 --- a/README.rst +++ b/README.rst @@ -2,14 +2,9 @@ Apache CouchDB README ===================== +--------------------------------+------------+ -| Travis CI master build status | |travisci| | -+--------------------------------+------------+ | Jenkins CI master build status | |jenkins| | +--------------------------------+------------+ -.. |travisci| image:: https://travis-ci.org/apache/couchdb.svg?branch=master - :target: https://travis-ci.org/apache/couchdb - .. |jenkins| image:: https://builds.apache.org/job/CouchDB/job/master/badge/icon :target: https://builds.apache.org/blue/organizations/jenkins/CouchDB/activity diff --git a/Jenkinsfile b/build-aux/Jenkinsfile.full index b98b47a10..8df8967bf 100644 --- a/Jenkinsfile +++ b/build-aux/Jenkinsfile.full @@ -77,7 +77,7 @@ pipeline { // npm config cache below is required because /home/jenkins doesn't // ACTUALLY exist in the image docker { - image 'couchdbdev/debian-stretch-erlang-19.3.6:latest' + image 'couchdbdev/debian-stretch-erlang-20.3.8.24-1:latest' alwaysPull true args '-e npm_config_cache=npm-cache -e HOME=. -v=/etc/passwd:/etc/passwd -v /etc/group:/etc/group' label 'ubuntu' @@ -156,7 +156,7 @@ pipeline { stage('CentOS 6') { agent { docker { - image 'couchdbdev/centos-6-erlang-19.3.6:latest' + image 'couchdbdev/centos-6-erlang-20.3.8.24-1:latest' alwaysPull true label 'ubuntu' // this keeps builds landing on the same host from clashing with each other @@ -204,7 +204,7 @@ pipeline { stage('CentOS 7') { agent { docker { - image 'couchdbdev/centos-7-erlang-19.3.6:latest' + image 'couchdbdev/centos-7-erlang-20.3.8.24-1:latest' alwaysPull true label 'ubuntu' customWorkspace pwd() + '/centos7' @@ -252,7 +252,7 @@ pipeline { stage('Ubuntu Xenial') { agent { docker { - image 'couchdbdev/ubuntu-xenial-erlang-19.3.6:latest' + image 'couchdbdev/ubuntu-xenial-erlang-20.3.8.24-1:latest' alwaysPull true label 'ubuntu' customWorkspace pwd() + '/xenial' @@ -299,7 +299,7 @@ pipeline { stage('Ubuntu Bionic') { agent { docker { - image 'couchdbdev/ubuntu-bionic-erlang-19.3.6:latest' + image 'couchdbdev/ubuntu-bionic-erlang-20.3.8.24-1:latest' alwaysPull true label 'ubuntu' customWorkspace pwd() + '/bionic' @@ -346,7 +346,7 @@ pipeline { stage('Debian Jessie') { agent { docker { - image 'couchdbdev/debian-jessie-erlang-19.3.6:latest' + image 'couchdbdev/debian-jessie-erlang-20.3.8.24-1:latest' alwaysPull true label 'ubuntu' customWorkspace pwd() + '/jessie' @@ -393,7 +393,7 @@ pipeline { stage('Debian Stretch x86_64') { agent { docker { - image 'couchdbdev/debian-stretch-erlang-19.3.6:latest' + image 'couchdbdev/debian-stretch-erlang-20.3.8.24-1:latest' alwaysPull true label 'ubuntu' customWorkspace pwd() + '/stretch' @@ -497,7 +497,7 @@ pipeline { agent { docker { - image 'couchdbdev/debian-stretch-erlang-19.3.6:latest' + image 'couchdbdev/debian-stretch-erlang-20.3.8.24-1:latest' alwaysPull true args '-e npm_config_cache=npm-cache -e HOME=. -v=/etc/passwd:/etc/passwd -v /etc/group:/etc/group' label 'ubuntu' diff --git a/build-aux/Jenkinsfile.pr b/build-aux/Jenkinsfile.pr new file mode 100644 index 000000000..a0ff5b1c2 --- /dev/null +++ b/build-aux/Jenkinsfile.pr @@ -0,0 +1,255 @@ +#!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. + +// DRYing out the Jenkinsfile... + +build_and_test = ''' +mkdir -p ${COUCHDB_IO_LOG_DIR} +rm -rf build +mkdir build +cd build +tar -xf ${WORKSPACE}/apache-couchdb-*.tar.gz +cd apache-couchdb-* +. /usr/local/kerl/${KERL_VER}/activate +./configure --with-curl +make check || (build-aux/logfile-uploader.py && false) +''' + +make_packages = ''' +git clone https://github.com/apache/couchdb-pkg +rm -rf couchdb +mkdir couchdb +cp ${WORKSPACE}/apache-couchdb-*.tar.gz couchdb +tar -xf ${WORKSPACE}/apache-couchdb-*.tar.gz -C couchdb +cd couchdb-pkg +make ${platform} PLATFORM=${platform} +''' + +cleanup_and_save = ''' +rm -rf ${WORKSPACE}/pkgs/${platform} +mkdir -p ${WORKSPACE}/pkgs/${platform} +mv ${WORKSPACE}/rpmbuild/RPMS/$(arch)/*rpm ${WORKSPACE}/pkgs/${platform} || true +mv ${WORKSPACE}/couchdb/*.deb ${WORKSPACE}/pkgs/${platform} || true +''' + + +pipeline { + + // no top-level agent; agents must be declared for each stage + agent any + + environment { + COUCHAUTH = credentials('couchdb_vm2_couchdb') + recipient = 'notifications@couchdb.apache.org' + COUCHDB_IO_LOG_DIR = '/tmp/couchjslogs' + // Following fix an issue with git <= 2.6.5 where no committer + // name or email are present for reflog, required for git clone + GIT_COMMITTER_NAME = 'Jenkins User' + GIT_COMMITTER_EMAIL = 'couchdb@apache.org' + LOW_ERLANG_VER = '20.3.8.11' + MID_ERLANG_VER = '20.3.8.24' + HIGH_ERLANG_VER = '22.2' + } + + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + // This fails the build immediately if any parallel step fails + parallelsAlwaysFailFast() + preserveStashes(buildCount: 10) + timeout(time: 3, unit: 'HOURS') + timestamps() + } + + stages { + stage('Build Release Tarball') { + agent { + // https://github.com/jenkins-infra/jenkins.io/blob/master/Jenkinsfile#64 + // We need the jenkins user mapped inside of the image + // npm config cache below is required because /home/jenkins doesn't + // ACTUALLY exist in the image + docker { + image 'couchdbdev/debian-buster-erlang-all:latest' + alwaysPull true + args '-e npm_config_cache=npm-cache -e HOME=. -v=/etc/passwd:/etc/passwd -v /etc/group:/etc/group' + customWorkspace pwd() + '/TARBALL' + } + } + options { + timeout(time: 15, unit: "MINUTES") + } + steps { + sh ''' + set + rm -rf apache-couchdb-* + . /usr/local/kerl/${LOW_ERLANG_VER}/activate + ./configure --with-curl + make dist + chmod -R a+w * . + ''' + } + post { + success { + stash includes: 'apache-couchdb-*.tar.gz', name: 'tarball' + archiveArtifacts artifacts: 'apache-couchdb-*.tar.gz', fingerprint: true + } + cleanup { + // UGH see https://issues.jenkins-ci.org/browse/JENKINS-41894 + sh 'rm -rf ${WORKSPACE}/*' + } + } + } // stage Build Release Tarball + + // TODO Rework once Improved Docker Pipeline Engine is released + // https://issues.jenkins-ci.org/browse/JENKINS-47962 + // https://issues.jenkins-ci.org/browse/JENKINS-48050 + + stage('make check') { + + parallel { + + stage("Low") { + agent { + docker { + image 'couchdbdev/debian-buster-erlang-all:latest' + alwaysPull true + customWorkspace pwd() + '/LOW' + } + } + environment { + KERL_VER = "${env.LOW_ERLANG_VER}" + } + options { + skipDefaultCheckout() + timeout(time: 90, unit: "MINUTES") + } + stages { + stage('Build from tarball & test') { + steps { + unstash 'tarball' + sh( script: build_and_test ) + } + post { + always { + junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml' + } + } + } + } // stages + post { + cleanup { + sh 'rm -rf ${WORKSPACE}/*' + } + } // post + } // stage + + stage("Mid") { + agent { + docker { + image 'couchdbdev/debian-buster-erlang-all:latest' + alwaysPull true + customWorkspace pwd() + '/MID' + } + } + environment { + KERL_VER = "${env.MID_ERLANG_VER}" + } + options { + skipDefaultCheckout() + timeout(time: 90, unit: "MINUTES") + } + stages { + stage('Build from tarball & test') { + steps { + unstash 'tarball' + sh( script: build_and_test ) + } + post { + always { + junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml' + } + } + } + } // stages + post { + cleanup { + sh 'rm -rf ${WORKSPACE}/*' + } + } // post + } // stage + + stage("High") { + agent { + docker { + image 'couchdbdev/debian-buster-erlang-all:latest' + alwaysPull true + customWorkspace pwd() + '/HIGH' + } + } + environment { + KERL_VER = "${env.HIGH_ERLANG_VER}" + } + options { + skipDefaultCheckout() + timeout(time: 90, unit: "MINUTES") + } + stages { + stage('Build from tarball & test') { + steps { + unstash 'tarball' + sh( script: build_and_test ) + } + post { + always { + junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml' + } + } + } + } // stages + post { + cleanup { + sh 'rm -rf ${WORKSPACE}/*' + } + } // post + } // stage + + } // parallel + } // stage "Make Check" + } // stages + + post { + success { + mail to: "${env.recipient}", + replyTo: "${env.recipient}", + subject: "[Jenkins] SUCCESS: ${currentBuild.fullDisplayName}", + body: "PR passed. ${env.RUN_DISPLAY_URL}" + } + unstable { + mail to: "${env.recipient}", + replyTo: "${env.recipient}", + subject: "[Jenkins] SUCCESS: ${currentBuild.fullDisplayName}", + body: "Eep! PR is unstable... ${env.RUN_DISPLAY_URL}" + } + failure { + mail to: "${env.recipient}", + replyTo: "${env.recipient}", + subject: "[Jenkins] FAILURE: ${currentBuild.fullDisplayName}", + body: "PR failed. ${env.RUN_DISPLAY_URL}" + } + cleanup { + sh 'rm -rf ${COUCHDB_IO_LOG_DIR}' + } + } + +} // pipeline |