Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3D05D200CD2 for ; Thu, 13 Jul 2017 03:30:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3B64F16A561; Thu, 13 Jul 2017 01:30:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5C62D16A567 for ; Thu, 13 Jul 2017 03:30:41 +0200 (CEST) Received: (qmail 5877 invoked by uid 500); 13 Jul 2017 01:30:40 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 5864 invoked by uid 99); 13 Jul 2017 01:30:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jul 2017 01:30:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0F8BAF54EB; Thu, 13 Jul 2017 01:30:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: busbey@apache.org To: commits@hbase.apache.org Date: Thu, 13 Jul 2017 01:30:41 -0000 Message-Id: <8942526e01ba481b970e43e787852820@git.apache.org> In-Reply-To: <40cea2fc2b0f465c979b7277254ec882@git.apache.org> References: <40cea2fc2b0f465c979b7277254ec882@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] hbase git commit: HBASE-18147 POC jenkinsfile for nightly checks. archived-at: Thu, 13 Jul 2017 01:30:42 -0000 HBASE-18147 POC jenkinsfile for nightly checks. * adds ruby tools to dockerfile * adds rubocop to dockerfile * adds ruby-lint to dockerfile * adds perlcritic to dockerfile * TODO branch with mulitple jdk versions * TODO verify flaky list is in use Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/13300585 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/13300585 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/13300585 Branch: refs/heads/HBASE-18147 Commit: 13300585f71111c8fc9814cc59990d16cb02250f Parents: 22df926 Author: Sean Busbey Authored: Tue Jul 4 15:12:38 2017 -0400 Committer: Sean Busbey Committed: Wed Jul 12 20:29:50 2017 -0500 ---------------------------------------------------------------------- dev-support/Jenkinsfile | 170 +++++++++++++++++++++++++++++++++++++ dev-support/docker/Dockerfile | 29 +++++++ 2 files changed, 199 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/13300585/dev-support/Jenkinsfile ---------------------------------------------------------------------- diff --git a/dev-support/Jenkinsfile b/dev-support/Jenkinsfile new file mode 100644 index 0000000..27538c7 --- /dev/null +++ b/dev-support/Jenkinsfile @@ -0,0 +1,170 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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 { + agent { + node { + label 'Hadoop' + } + } + // work around for YETUS-508, requires maven outside of the dockerfile + tools { + maven 'Maven (latest)' + } + triggers { + cron('@daily') + } + options { + buildDiscarder(logRotator(numToKeepStr: '30')) + timeout (time: 6, unit: 'HOURS') + timestamps() + } + environment { + TOOLS = "${env.WORKSPACE}/tools" + // BASEDIR must be here because otherwise it won't work in post + BASEDIR = "${env.WORKSPACE}/component" + YETUS_RELEASE = '0.4.0' + // OUTPUTDIR must be here because otherwise it won't work in post + OUTPUTDIR = "${env.WORKSPACE}/artifacts" + } + parameters { + booleanParam(name: 'USE_YETUS_PRERELEASE', defaultValue: false, description: '''Check to use the current HEAD of apache/yetus rather than our configured release. + + Should only be used manually when e.g. there is some non-work-aroundable issue in yetus we are checking a fix for.''') + } + stages { + stage ('yetus check') { + environment { + PROJECT = 'hbase' + PROJET_PERSONALITY = 'https://raw.githubusercontent.com/apache/hbase/master/dev-support/hbase-personality.sh' + // This section of the docs tells folks not to use the javadoc tag. older branches have our old version of the check for said tag. + AUTHOR_IGNORE_LIST = 'src/main/asciidoc/_chapters/developer.adoc,dev-support/test-patch.sh' + WHITESPACE_IGNORE_LIST = '.*/generated/.*' +// These tests currently have known failures. Once they burn down to 0, remove from here so that new problems will cause a failure. + TESTS_FILTER = 'cc,checkstyle,javac,javadoc,pylint,shellcheck,whitespace,perlcritic,ruby-lint,rubocop' + BRANCH_SPECIFIC_DOCKERFILE = "${env.BASEDIR}/dev-support/docker/Dockerfile" + EXCLUDE_TESTS_URL = 'https://builds.apache.org/job/HBase-Find-Flaky-Tests/lastSuccessfulBuild/artifact/excludes/' + } + steps { + // TODO we can move the yetus install into a different stage and then use stash to deploy it. + sh '''#!/usr/bin/env bash +printenv +echo "Ensure we have a copy of Apache Yetus." +if [[ true != "${USE_YETUS_PRERELEASE}" ]]; then + YETUS_DIR="${WORKSPACE}/yetus-${YETUS_RELEASE}" + echo "Checking for Yetus ${YETUS_RELEASE} in '${YETUS_DIR}'" + if [ ! -d "${YETUS_DIR}" ]; then + echo "New download of Apache Yetus version ${YETUS_RELEASE}." + rm -rf "${WORKSPACE}/.gpg" + mkdir -p "${WORKSPACE}/.gpg" + chmod -R 700 "${WORKSPACE}/.gpg" + + echo "install yetus project KEYS" + curl -L --fail -o "${WORKSPACE}/KEYS_YETUS" https://dist.apache.org/repos/dist/release/yetus/KEYS + gpg --homedir "${WORKSPACE}/.gpg" --import "${WORKSPACE}/KEYS_YETUS" + + echo "download yetus release ${YETUS_RELEASE}" + curl -L --fail -O "https://dist.apache.org/repos/dist/release/yetus/${YETUS_RELEASE}/yetus-${YETUS_RELEASE}-bin.tar.gz" + curl -L --fail -O "https://dist.apache.org/repos/dist/release/yetus/${YETUS_RELEASE}/yetus-${YETUS_RELEASE}-bin.tar.gz.asc" + echo "verifying yetus release" + gpg --homedir "${WORKSPACE}/.gpg" --verify "yetus-${YETUS_RELEASE}-bin.tar.gz.asc" + mv "yetus-${YETUS_RELEASE}-bin.tar.gz" yetus.tar.gz + else + echo "Reusing cached download of Apache Yetus version ${YETUS_RELEASE}." + fi +else + YETUS_DIR="${WORKSPACE}/yetus-git" + rm -rf "${YETUS_DIR}" + echo "downloading from github" + curl -L --fail https://api.github.com/repos/apache/yetus/tarball/HEAD -o yetus.tar.gz +fi +if [ ! -d "${YETUS_DIR}" ]; then + echo "unpacking yetus into '${YETUS_DIR}'" + mkdir -p "${YETUS_DIR}" + gunzip -c yetus.tar.gz | tar xpf - -C "${YETUS_DIR}" --strip-components 1 +fi + ''' + // TODO we can move the personality install into a different stage and then use stash to deploy it. + dir ("${env.TOOLS}") { + sh """#!/usr/bin/env bash +echo "Downloading Project personality." +curl -L -o personality.sh "${env.PROJET_PERSONALITY}" + """ + } + sh '''#!/usr/bin/env bash +YETUS_ARGS=() +YETUS_ARGS=("--multijdktests=compile,findbugs,unit" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--personality=${TOOLS}/personality.sh" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--basedir=${BASEDIR}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--archive-list=TEST-*.xml" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--console-urls" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--docker" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--dockerfile=${BRANCH_SPECIFIC_DOCKERFILE}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--empty-patch" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--html-report-file=${OUTPUTDIR}/console-report.html" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--jenkins" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--mvn-custom-repos" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--patch-dir=${OUTPUTDIR}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--project=${PROJECT}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--resetrepo" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--author-ignore-list=${AUTHOR_IGNORE_LIST}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--whitespace-eol-ignore-list=${WHITESPACE_IGNORE_LIST}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--whitespace-tabs-ignore-list=${WHITESPACE_IGNORE_LIST}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--sentinel" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--branch=${BRANCH_NAME}" "${YETUS_ARGS[@]}") +YETUS_ARGS=("--tests-filter=${TESTS_FILTER}" "${YETUS_ARGS[@]}") + +rm -rf "${OUTPUTDIR}" +mkdir -p "${OUTPUTDIR}" +if [[ true != "${USE_YETUS_PRERELEASE}" ]]; then + YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/shelldocs" "${YETUS_ARGS[@]}") + TESTPATCHBIN="${WORKSPACE}/yetus-${YETUS_RELEASE}/bin/test-patch" +else + YETUS_ARGS=("--shelldocs=${WORKSPACE}/yetus-git/shelldocs/shelldocs.py" "${YETUS_ARGS[@]}") + TESTPATCHBIN="${WORKSPACE}/yetus-git/precommit/test-patch.sh" +fi +echo "Launching yetus with command line:" +echo "${TESTPATCHBIN} ${YETUS_ARGS[@]}" + +/usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}" + ''' + } + } + } + post { + always { +// TODO junit test results + // gzip surefire reports. (copied from precommit job. Need to account for archive placing things in the outputdir.) +// sh """#!/bin/bash -e +//find '${env.BASEDIR}' -path '*/target/surefire-reports/*' | zip '${env.OUTPUTDIR}/test_logs.zip' -@ +//""" + archive "${env.OUTPUTDIR}/*,${env.OUTPUTDIR}/**/*,**/VERSION" + publishHTML target: [ + allowMissing: true, + keepAll: true, + alwaysLinkToLastBuild: true, + // has to be relative to WORKSPACE :( + reportDir: 'artifacts', + reportFiles: 'console-report.html', + reportName: 'Nightly Build Report' + ] + } + failure { + deleteDir() + } + } +} + http://git-wip-us.apache.org/repos/asf/hbase/blob/13300585/dev-support/docker/Dockerfile ---------------------------------------------------------------------- diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile index 2ecc42e..c654ded 100644 --- a/dev-support/docker/Dockerfile +++ b/dev-support/docker/Dockerfile @@ -47,6 +47,7 @@ RUN apt-get -q update && apt-get -q install --no-install-recommends -y \ libbz2-dev \ libcurl4-openssl-dev \ libfuse-dev \ + libperl-critic-perl \ libprotobuf-dev \ libprotoc-dev \ libsnappy-dev \ @@ -126,6 +127,34 @@ RUN pip install pylint #### RUN pip install python-dateutil +#### +# Install Ruby 2, based on Yetus 0.4.0 dockerfile +### +RUN echo 'gem: --no-rdoc --no-ri' >> /root/.gemrc +RUN apt-get -q install -y ruby2.0 +# +# on trusty, the above installs ruby2.0 and ruby (1.9.3) exes +# but update-alternatives is broken, so we need to do some work +# to make 2.0 actually the default without the system flipping out +# +# See https://bugs.launchpad.net/ubuntu/+source/ruby2.0/+bug/1310292 +# +RUN dpkg-divert --add --rename --divert /usr/bin/ruby.divert /usr/bin/ruby +RUN dpkg-divert --add --rename --divert /usr/bin/gem.divert /usr/bin/gemrc +RUN update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0 1 +RUN update-alternatives --install /usr/bin/gem gem /usr/bin/gem2.0 1 + + +#### +# Install rubocop +### +RUN gem install rubocop + +#### +# Install ruby-lint +### +RUN gem install ruby-lint + ### # Avoid out of memory errors in builds ###