This is an automated email from the ASF dual-hosted git repository. mck pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cassandra-builds.git
The following commit(s) were added to refs/heads/master by this push: new 55a2d26 Add deb and rpm packaging to cassandra-artifacts.sh test script 55a2d26 is described below commit 55a2d2676ff5820fa638511734e45a8908ce5ca2 Author: Mick Semb Wever <m...@apache.org> AuthorDate: Tue Jun 2 18:23:44 2020 +0200 Add deb and rpm packaging to cassandra-artifacts.sh test script - extend the build-scripts/cassandra-*-packaging.sh scripts to build on SHAs (as well as tags and branches), - add support for building deb/rpm packages with jdk11, - add support for running the the build-scripts/cassandra-*-packaging.sh scripts concurrently, - include calling the cassandra-*-packaging.sh scripts from the cassandra-artifacts.sh scripts, - get prepare_release.sh script to re-use the cassandra-*-packaging.sh scripts, - have jenkins artifact jobs save the deb and rpm packages, so they are available as "nightlies" (along with the tar.gz files) patch by Mick Semb Wever; reviewed by Stefan Miklosovic for CASSANDRA-15830 --- build-scripts/cassandra-artifacts.sh | 24 ++++++++++++ build-scripts/cassandra-deb-packaging.sh | 48 ++++++++++++++++++----- build-scripts/cassandra-rpm-packaging.sh | 49 ++++++++++++++++++------ cassandra-release/prepare_release.sh | 31 ++++++--------- docker/build-debs.sh | 63 +++++++++++++++++++------------ docker/build-rpms.sh | 50 +++++++++++++++++------- docker/centos7-image.docker | 1 - jenkins-dsl/cassandra_job_dsl_seed.groovy | 42 ++++++++++----------- 8 files changed, 209 insertions(+), 99 deletions(-) diff --git a/build-scripts/cassandra-artifacts.sh b/build-scripts/cassandra-artifacts.sh index 7cdda72..5dae24e 100755 --- a/build-scripts/cassandra-artifacts.sh +++ b/build-scripts/cassandra-artifacts.sh @@ -6,6 +6,19 @@ # ################################ +# variables, with defaults +[ "x${cassandra_builds_dir}" != "x" ] || cassandra_builds_dir="cassandra-builds" + +# pre-conditions +command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be installed"; exit 1; } +command -v pip >/dev/null 2>&1 || { echo >&2 "pip needs to be installed"; exit 1; } +command -v virtualenv >/dev/null 2>&1 || { echo >&2 "virtualenv needs to be installed"; exit 1; } +command -v docker >/dev/null 2>&1 || { echo >&2 "docker needs to be installed"; exit 1; } +(docker info >/dev/null 2>&1) || { echo >&2 "docker needs to running"; exit 1; } +[ -f "build.xml" ] || { echo >&2 "build.xml must exist"; exit 1; } +[ -d "${cassandra_builds_dir}" ] || { echo >&2 "cassandra-builds directory must exist"; exit 1; } + + # Sphinx is needed for the gen-doc target virtualenv venv source venv/bin/activate @@ -27,6 +40,17 @@ for x in $(seq 1 3); do # Run eclipse-warnings if build was successful ant eclipse-warnings RETURN="$?" + if [ "${RETURN}" -eq "0" ]; then + set -e + # build debian and rpm packages + head_commit=`git log --pretty=oneline -1 | cut -d " " -f 1` + declare -x cassandra_builds_dir="${cassandra_builds_dir}" + declare -x CASSANDRA_GIT_URL="`git remote get-url origin`" + # debian + deb_dir="`pwd`/build" ${cassandra_builds_dir}/build-scripts/cassandra-deb-packaging.sh ${head_commit} + # rpm + rpm_dir="`pwd`/build" ${cassandra_builds_dir}/build-scripts/cassandra-rpm-packaging.sh ${head_commit} + fi break fi done diff --git a/build-scripts/cassandra-deb-packaging.sh b/build-scripts/cassandra-deb-packaging.sh index 4466ced..8b71697 100755 --- a/build-scripts/cassandra-deb-packaging.sh +++ b/build-scripts/cassandra-deb-packaging.sh @@ -1,16 +1,44 @@ #!/bin/bash -xe +# +# Builds (inside docker) the rpm packages for the provided git sha +# +# Called from build-scripts/cassandra-artifacts.sh or cassandra-release/prepare_release.sh -CASSANDRA_BUILDS_DIR="${WORKSPACE}/cassandra-builds" -CASSANDRA_GIT_URL=$1 -CASSANDRA_BRANCH=$2 +if [ "$#" -lt 1 ]; then + echo "$0 <branch|tag|sha> <java version>" + echo "if Java version is not set, it is set to 8 by default, choose from 8 or 11" + exit 1 +fi -# Create build images containing the build tool-chain, Java and an Apache Cassandra git working directory -docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL -f ${CASSANDRA_BUILDS_DIR}/docker/jessie-image.docker ${CASSANDRA_BUILDS_DIR}/docker/ +sha=$1 +java_version=$2 + +# required arguments +[ "x${sha}" != "x" ] || { echo >&2 "Missing argument <branch|tag|sha>"; exit 1; } + +# variables, with defaults +[ "x${deb_dir}" != "x" ] || deb_dir="." +[ "x${cassandra_builds_dir}" != "x" ] || cassandra_builds_dir="." +[ "x${CASSANDRA_GIT_URL}" != "x" ] || CASSANDRA_GIT_URL="https://gitbox.apache.org/repos/asf/cassandra.git" +[ "x${java_version}" != "x" ] || java_version="8" + +# pre-conditions +command -v docker >/dev/null 2>&1 || { echo >&2 "docker needs to be installed"; exit 1; } +(docker info >/dev/null 2>&1) || { echo >&2 "docker needs to running"; exit 1; } +[ -d "${cassandra_builds_dir}" ] || { echo >&2 "cassandra-builds directory must exist"; exit 1; } +[ -f "${cassandra_builds_dir}/docker/buster-image.docker" ] || { echo >&2 "docker/buster-image.docker must exist"; exit 1; } +[ -f "${cassandra_builds_dir}/docker/build-debs.sh" ] || { echo >&2 "docker/build-debs.sh must exist"; exit 1; } -# Create target directory for packages generated in docker run below -mkdir -p ${CASSANDRA_BUILDS_DIR}/dist -chmod 777 ${CASSANDRA_BUILDS_DIR}/dist +# remove any previous older built images +docker image prune -f --filter label=org.cassandra.buildenv=buster --filter "until=4h" + +pushd $cassandra_builds_dir + +# Create build images containing the build tool-chain, Java and an Apache Cassandra git working directory +docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL -t cassandra-artifacts-buster:${sha} -f docker/buster-image.docker docker/ -# Run build script through docker (specify branch, e.g. cassandra-3.0 and version, e.g. 3.0.11): -docker run --rm -v ${CASSANDRA_BUILDS_DIR}/dist:/dist `docker images -f label=org.cassandra.buildenv=jessie -q | awk 'NR==1'` /home/build/build-debs.sh $CASSANDRA_BRANCH +# Run build script through docker (specify branch, tag, or sha) +chmod 777 ${deb_dir} +docker run --rm -v ${deb_dir}:/dist cassandra-artifacts-buster:${sha} /home/build/build-debs.sh ${sha} ${java_version} +popd diff --git a/build-scripts/cassandra-rpm-packaging.sh b/build-scripts/cassandra-rpm-packaging.sh index 747d781..864b146 100755 --- a/build-scripts/cassandra-rpm-packaging.sh +++ b/build-scripts/cassandra-rpm-packaging.sh @@ -1,17 +1,44 @@ #!/bin/bash -xe +# +# Builds (inside docker) the rpm packages for the provided git sha +# +# Called from build-scripts/cassandra-artifacts.sh or cassandra-release/prepare_release.sh -CASSANDRA_BUILDS_DIR="${WORKSPACE}/cassandra-builds" -CASSANDRA_GIT_URL=$1 -CASSANDRA_BRANCH=$2 -CASSANDRA_VERSION=$3 +if [ "$#" -lt 1 ]; then + echo "$0 <branch|tag|sha> <java version>" + echo "if Java version is not set, it is set to 8 by default, choose from 8 or 11" + exit 1 +fi -# Create build images containing the build tool-chain, Java and an Apache Cassandra git working directory -docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL -f ${CASSANDRA_BUILDS_DIR}/docker/centos7-image.docker ${CASSANDRA_BUILDS_DIR}/docker/ +sha=$1 +java_version=$2 + +# required arguments +[ "x${sha}" != "x" ] || { echo >&2 "Missing argument <branch|tag|sha>"; exit 1; } + +# variables, with defaults +[ "x${rpm_dir}" != "x" ] || rpm_dir="." +[ "x${cassandra_builds_dir}" != "x" ] || cassandra_builds_dir="." +[ "x${CASSANDRA_GIT_URL}" != "x" ] || CASSANDRA_GIT_URL="https://gitbox.apache.org/repos/asf/cassandra.git" +[ "x${java_version}" != "x" ] || java_version="8" + +# pre-conditions +command -v docker >/dev/null 2>&1 || { echo >&2 "docker needs to be installed"; exit 1; } +(docker info >/dev/null 2>&1) || { echo >&2 "docker needs to running"; exit 1; } +[ -d "${cassandra_builds_dir}" ] || { echo >&2 "cassandra-builds directory must exist"; exit 1; } +[ -f "${cassandra_builds_dir}/docker/centos7-image.docker" ] || { echo >&2 "docker/centos7-image.docker must exist"; exit 1; } +[ -f "${cassandra_builds_dir}/docker/build-rpms.sh" ] || { echo >&2 "docker/build-rpms.sh must exist"; exit 1; } -# Create target directory for packages generated in docker run below -mkdir -p ${CASSANDRA_BUILDS_DIR}/dist -chmod 777 ${CASSANDRA_BUILDS_DIR}/dist +# remove any previous older built images +docker image prune -f --filter label=org.cassandra.buildenv=centos --filter "until=4h" + +pushd $cassandra_builds_dir + +# Create build images containing the build tool-chain, Java and an Apache Cassandra git working directory +docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL -t cassandra-artifacts-centos7:${sha} -f docker/centos7-image.docker docker/ -# Run build script through docker (specify branch, e.g. cassandra-3.0 and version, e.g. 3.0.11): -docker run --rm -v ${CASSANDRA_BUILDS_DIR}/dist:/dist `docker images -f label=org.cassandra.buildenv=centos -q | awk 'NR==1'` /home/build/build-rpms.sh $CASSANDRA_BRANCH $CASSANDRA_VERSION +# Run build script through docker (specify branch, tag, or sha) +chmod 777 ${rpm_dir} +docker run --rm -v ${rpm_dir}:/dist cassandra-artifacts-centos7:${sha} /home/build/build-rpms.sh ${sha} ${java_version} +popd diff --git a/cassandra-release/prepare_release.sh b/cassandra-release/prepare_release.sh index 4de3d78..fa3a042 100755 --- a/cassandra-release/prepare_release.sh +++ b/cassandra-release/prepare_release.sh @@ -16,8 +16,6 @@ mail_dir="$HOME/Mail" command -v svn >/dev/null 2>&1 || { echo >&2 "subversion needs to be installed"; exit 1; } command -v git >/dev/null 2>&1 || { echo >&2 "git needs to be installed"; exit 1; } command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be installed"; exit 1; } -command -v dpkg-buildpackage >/dev/null 2>&1 || { echo >&2 "dpkg needs to be installed"; exit 1; } -command -v dpatch >/dev/null 2>&1 || { echo >&2 "dpatch needs to be installed"; exit 1; } # can be removed after 2.2 EOL command -v debsign >/dev/null 2>&1 || { echo >&2 "devscripts needs to be installed"; exit 1; } command -v reprepro >/dev/null 2>&1 || { echo >&2 "reprepro needs to be installed"; exit 1; } command -v rpmsign >/dev/null 2>&1 || { echo >&2 "rpmsign needs to be installed"; exit 1; } @@ -166,7 +164,7 @@ execute() } current_dir=`pwd` -cassandra_builds_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." +declare -x cassandra_builds_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." tmp_dir=`mktemp -d` build_dir=${tmp_dir}/cassandra/build debian_package_dir="${tmp_dir}/debian" @@ -187,6 +185,7 @@ if [ $only_deb -eq 0 ] && [ $only_rpm -eq 0 ] then echo "Update debian changelog, please correct changelog, name, and email." read -n 1 -s -r -p "press any key to continue…" 1>&3 2>&4 + echo "" execute "dch -r -D unstable" echo "Prepare debian changelog for $release" > "_tmp_msg_" execute "git commit -F _tmp_msg_ debian/changelog" @@ -234,19 +233,16 @@ then execute "mkdir -p $debian_package_dir" execute "cd $debian_package_dir" - deb_dir=cassandra_${release}_debian + [ $fake_mode -eq 1 ] && echo ">> declare -x deb_dir=${debian_package_dir}/cassandra_${release}_debian" + declare -x deb_dir=${debian_package_dir}/cassandra_${release}_debian [ ! -e "$deb_dir" ] || rm -rf $deb_dir execute "mkdir $deb_dir" execute "cd $deb_dir" echo "Building debian package ..." 1>&3 2>&4 - execute "mkdir -p $build_dir" - execute "cp $tmp_dir/cassandra-dist-dev/${release}/apache-cassandra-$release-src.tar.gz ${build_dir}/" - execute "tar xvzf ${build_dir}/apache-cassandra-${release}-src.tar.gz" - execute "cd apache-cassandra-${release}-src" - execute "dpkg-buildpackage -rfakeroot -us -uc" - execute "cd .." + execute "${cassandra_builds_dir}/build-scripts/cassandra-deb-packaging.sh ${release}-tentative" + # Debsign might ask the passphrase on stdin so don't hide what he says even if no verbose # (I haven't tested carefully but I've also seen it fail unexpectedly with it's output redirected. execute "debsign -k$gpg_key cassandra_${deb_release}_amd64.changes" 1>&3 2>&4 @@ -289,17 +285,13 @@ then execute "mkdir -p $rpm_package_dir" execute "cd $rpm_package_dir" - rpm_dir=$rpm_package_dir/cassandra_${release}_rpm + [ $fake_mode -eq 1 ] && echo ">> declare -x rpm_dir=$rpm_package_dir/cassandra_${release}_rpm" + declare -x rpm_dir=$rpm_package_dir/cassandra_${release}_rpm [ ! -e "$rpm_dir" ] || rm -rf $rpm_dir execute "mkdir $rpm_dir" - execute "cd $cassandra_builds_dir" - if [[ $(docker images -f label=org.cassandra.buildenv=centos -q) ]] - then - execute "docker image rm -f `docker images -f label=org.cassandra.buildenv=centos -q`" - fi - execute "docker build -f docker/centos7-image.docker docker/" - execute "docker run --rm -v ${rpm_dir}:/dist `docker images -f label=org.cassandra.buildenv=centos -q` /home/build/build-rpms.sh ${release}-tentative" + execute "${cassandra_builds_dir}/build-scripts/cassandra-rpm-packaging.sh ${release}-tentative" + execute "rpmsign --addsign ${rpm_dir}/*.rpm" execute "mkdir $tmp_dir/cassandra-dist-dev/${release}/redhat" @@ -327,11 +319,12 @@ then [ $verbose -eq 1 ] || exec 1>&3 3>&- 2>&4 4>&- # Cleaning up + [ $fake_mode -eq 1 ] && echo ">> rm -rf $tmp_dir" rm -rf $tmp_dir ## Email templates ## - + [ $fake_mode -eq 1 ] && echo ">> rm -rf $mail_dir" [ ! -e "$mail_dir" ] || rm -rf $mail_dir mkdir $mail_dir mail_test_announce_file="$mail_dir/mail_stage_announce_$release" diff --git a/docker/build-debs.sh b/docker/build-debs.sh index 5aeec0a..9524c17 100755 --- a/docker/build-debs.sh +++ b/docker/build-debs.sh @@ -1,13 +1,19 @@ #!/bin/bash -x +# Expected to be run from inside cassandra-builds/docker/buster-image.docker set -e if [ "$#" -lt 1 ]; then - echo "$0 <branch> <java version>" + echo "$0 <branch|tag|sha> <java version>" echo "if Java version is not set, it is set to 8 by default, choose from 8 or 11" exit 1 fi -CASSANDRA_BRANCH=$1 +[ "x${DEB_DIST_DIR}" != "x" ] || { echo >&2 "DEB_DIST_DIR needs to be defined"; exit 1; } +[ -d "${DEB_DIST_DIR}" ] || { echo >&2 "Directory ${DEB_DIST_DIR} must exist"; exit 1; } +[ "x${CASSANDRA_DIR}" != "x" ] || { echo >&2 "CASSANDRA_DIR needs to be defined"; exit 1; } +[ -d "${CASSANDRA_DIR}" ] || { echo >&2 "Directory ${CASSANDRA_DIR} must exist"; exit 1; } + +CASSANDRA_SHA=$1 JAVA_VERSION=$2 if [ "$JAVA_VERSION" = "" ]; then @@ -23,7 +29,11 @@ fi cd $CASSANDRA_DIR git fetch -git checkout $CASSANDRA_BRANCH || exit 1 +git pull +# clear and refetch tags to account for re-tagging a new sha +git tag -d $(git tag) > /dev/null +git fetch --tags > /dev/null 2>&1 +git checkout $CASSANDRA_SHA || exit 1 # Used version for build will always depend on the git referenced used for checkout above # Branches will always be created as snapshots, while tags are releases @@ -31,13 +41,20 @@ tag=`git describe --tags --exact-match` 2> /dev/null || true branch=`git symbolic-ref -q --short HEAD` 2> /dev/null || true is_tag=false -is_branch=false git_version='' +# Parse version from build.xml so we can verify version against release tags and use the build.xml version +# for any branches. Truncate from snapshot suffix if needed. +buildxml_version=`grep 'property\s*name="base.version"' build.xml |sed -ne 's/.*value="\([^"]*\)".*/\1/p'` +regx_snapshot="([0-9.]+)-SNAPSHOT$" +if [[ $buildxml_version =~ $regx_snapshot ]]; then + buildxml_version=${BASH_REMATCH[1]} +fi + if [ "$tag" ]; then is_tag=true # Official release - regx_tag="cassandra-([0-9.]+)$" + regx_tag="cassandra-(([0-9.]+)(-(alpha|beta|rc)[0-9]+)?)$" # Tentative release regx_tag_tentative="([0-9.]+)-tentative$" if [[ $tag =~ $regx_tag ]] || [[ $tag =~ $regx_tag_tentative ]]; then @@ -46,47 +63,45 @@ if [ "$tag" ]; then echo "Error: could not recognize version from tag $tag">&2 exit 2 fi -elif [ "$branch" ]; then - # Dev branch - is_branch=true + CASSANDRA_VERSION=$git_version + CASSANDRA_REVISION='1' +else regx_branch="cassandra-([0-9.]+)$" if [[ $branch =~ $regx_branch ]]; then git_version=${BASH_REMATCH[1]} else - # This could be either trunk or any dev branch, so we won't be able to get the version + # This could be either trunk or any dev branch or SHA, so we won't be able to get the version # from the branch name. In this case, fall back to debian change log version. - git_version=$(dpkg-parsechangelog | sed -ne 's/^Version: \([^-|~|+]*\).*/\1/p') + git_version=$(dpkg-parsechangelog | sed -ne 's/^Version: \(.*\).*/\1/p' | sed 's/~/-/') if [ -z $git_version ]; then echo "Error: could not recognize version from branch $branch">&2 exit 2 else - echo "Warning: could not recognize version from branch, using dpkg version: $git_version" + echo "Warning: could not recognize version from branch. dpkg version is $git_version" fi fi -else - echo "Error: invalid git reference; must either be branch or tag">&2 - exit 1 + # if CASSANDRA_VERSION is -alphaN, -betaN, -rcN, then rpmbuild fails on the '-' char; replace with '~' + CASSANDRA_VERSION=${buildxml_version/-/\~} + dt=`date +"%Y%m%d"` + ref=`git rev-parse --short HEAD` + CASSANDRA_REVISION="${dt}git${ref}" + dch -D unstable -v "${CASSANDRA_VERSION}-${CASSANDRA_REVISION}" --package "cassandra" "TODO msg" fi # The version used for the deb build process will the current version in the debian/changelog file. # See debian/rules for how the value is read. The only thing left for us to do here is to check if # the changes file contains the correct version for the checked out git revision. The version value # has to be updated manually by a committer and we only warn and abort on mismatches here. -changelog_version=$(dpkg-parsechangelog | sed -ne 's/^Version: \([^~|+]*\).*/\1/p') -chl_expected="$git_version" -if $is_branch ; then - chl_expected="${git_version}[0-9.]*-SNAPSHOT" -fi +changelog_version=$(dpkg-parsechangelog | sed -ne 's/^Version: \(.*\).*/\1/p' | sed 's/~/-/') +chl_expected="${buildxml_version}" if [[ ! $changelog_version =~ $chl_expected ]]; then - echo "Error: changelog version seems to be missing -SNAPSHOT suffix for branch">&2 + echo "Error: changelog version (${changelog_version}) doesn't match expected (${chl_expected})">&2 exit 3 fi # Version (base.version) in build.xml must be set manually as well. Let's validate the set value. -buildxml_version=`grep 'property\s*name="base.version"' build.xml |sed -ne 's/.*value="\([^"]*\)".*/\1/p'` if [ $buildxml_version != $git_version ]; then - echo "Error: build.xml version ($buildxml_version) not matching git tag derived version ($git_version)">&2 - exit 4 + echo "Warning: build.xml version ($buildxml_version) not matching git/dpkg derived version ($git_version)">&2 fi if [ $JAVA_VERSION = "11" ]; then @@ -99,7 +114,7 @@ fi # Install build dependencies and build package echo "y" | sudo mk-build-deps --install -dpkg-buildpackage -uc -us +dpkg-buildpackage -rfakeroot -uc -us # Copy created artifacts to dist dir mapped to docker host directory (must have proper permissions) cp ../cassandra[-_]* $DEB_DIST_DIR diff --git a/docker/build-rpms.sh b/docker/build-rpms.sh index 80a94e0..1d96509 100755 --- a/docker/build-rpms.sh +++ b/docker/build-rpms.sh @@ -1,12 +1,33 @@ #!/bin/bash -x +# Expected to be run from inside cassandra-builds/docker/centos7-image.docker set -e -if [ "$#" -ne 1 ]; then - echo "$0 <branch>" +if [ "$#" -lt 1 ]; then + echo "$0 <branch|tag|sha> <java version>" + echo "if Java version is not set, it is set to 8 by default, choose from 8 or 11" exit 1 fi -CASSANDRA_BRANCH=$1 +[ "x${RPM_BUILD_DIR}" != "x" ] || { echo >&2 "RPM_BUILD_DIR needs to be defined"; exit 1; } +[ -d "${RPM_BUILD_DIR}/SOURCES" ] || { echo >&2 "Directory ${RPM_BUILD_DIR}/SOURCES must exist"; exit 1; } +[ "x${RPM_DIST_DIR}" != "x" ] || { echo >&2 "RPM_DIST_DIR needs to be defined"; exit 1; } +[ -d "${RPM_DIST_DIR}" ] || { echo >&2 "Directory ${RPM_DIST_DIR} must exist"; exit 1; } +[ "x${CASSANDRA_DIR}" != "x" ] || { echo >&2 "CASSANDRA_DIR needs to be defined"; exit 1; } +[ -d "${CASSANDRA_DIR}" ] || { echo >&2 "Directory ${CASSANDRA_DIR} must exist"; exit 1; } + +CASSANDRA_SHA=$1 +JAVA_VERSION=$2 + +if [ "$JAVA_VERSION" = "" ]; then + JAVA_VERSION=8 +fi + +regx_java_version="(8|11)" + +if [[ ! "$JAVA_VERSION" =~ $regx_java_version ]]; then + echo "Error: Java version is not set to 8 nor 11, it is set to $JAVA_VERSION" + exit 1 +fi cd $CASSANDRA_DIR git fetch @@ -14,7 +35,7 @@ git pull # clear and refetch tags to account for re-tagging a new sha git tag -d $(git tag) > /dev/null git fetch --tags > /dev/null 2>&1 -git checkout $CASSANDRA_BRANCH || exit 1 +git checkout $CASSANDRA_SHA || exit 1 # Used version for build will always depend on the git referenced used for checkout above # Branches will always be created as snapshots, while tags are releases @@ -22,7 +43,6 @@ tag=`git describe --tags --exact-match` 2> /dev/null || true branch=`git symbolic-ref -q --short HEAD` 2> /dev/null || true is_tag=false -is_branch=false git_version='' # Parse version from build.xml so we can verify version against release tags and use the build.xml version @@ -36,9 +56,9 @@ fi if [ "$tag" ]; then is_tag=true # Official release - regx_tag="cassandra-([0-9.].*)$" + regx_tag="cassandra-(([0-9.]+)(-(alpha|beta|rc)[0-9]+)?)$" # Tentative release - regx_tag_tentative="([0-9.].*)-tentative$" + regx_tag_tentative="([0-9.]+)-tentative$" if [[ $tag =~ $regx_tag ]] || [[ $tag =~ $regx_tag_tentative ]]; then git_version=${BASH_REMATCH[1]} else @@ -51,18 +71,22 @@ if [ "$tag" ]; then fi CASSANDRA_VERSION=$git_version CASSANDRA_REVISION='1' -elif [ "$branch" ]; then - # Dev branch - is_branch=true - # This could be either trunk or any dev branch, so we won't be able to get the version +else + # This could be either trunk or any dev branch or SHA, so we won't be able to get the version # from the branch name. In this case, fall back to version specified in build.xml. CASSANDRA_VERSION="${buildxml_version}" dt=`date +"%Y%m%d"` ref=`git rev-parse --short HEAD` CASSANDRA_REVISION="${dt}git${ref}" +fi + +if [ $JAVA_VERSION = "11" ]; then + sudo alternatives --set java $(alternatives --display java | grep 'family java-11-openjdk' | cut -d' ' -f1) + sudo alternatives --set javac $(alternatives --display javac | grep 'family java-11-openjdk' | cut -d' ' -f1) + export CASSANDRA_USE_JDK11=true + echo "Cassandra will be built with Java 11" else - echo "Error: invalid git reference; must either be branch or tag">&2 - exit 1 + echo "Cassandra will be built with Java 8" fi # javadoc target is broken in docker without this mkdir diff --git a/docker/centos7-image.docker b/docker/centos7-image.docker index 27b716e..01a2a2f 100644 --- a/docker/centos7-image.docker +++ b/docker/centos7-image.docker @@ -16,7 +16,6 @@ RUN yum -y install \ ant-junit \ epel-release \ git \ - java-1.7.0-openjdk-devel \ java-1.8.0-openjdk-devel \ java-11-openjdk-devel \ make \ diff --git a/jenkins-dsl/cassandra_job_dsl_seed.groovy b/jenkins-dsl/cassandra_job_dsl_seed.groovy index 65f2b63..b29718f 100644 --- a/jenkins-dsl/cassandra_job_dsl_seed.groovy +++ b/jenkins-dsl/cassandra_job_dsl_seed.groovy @@ -79,8 +79,8 @@ job('Cassandra-template-artifacts') { label(slaveLabel) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -104,7 +104,7 @@ job('Cassandra-template-artifacts') { shell("git clean -xdff ; git clone -b ${buildsBranch} ${buildsRepo}") } publishers { - archiveArtifacts('build/*.tar.gz, build/**/eclipse_compiler_checks.txt') + archiveArtifacts('build/apache-cassandra-*.tar.gz, build/apache-cassandra-*.jar, build/apache-cassandra-*.pom, build/cassandra*.deb, build/cassandra*.rpm, build/**/eclipse_compiler_checks.txt') archiveJavadoc { javadocDir 'build/javadoc' keepAll false @@ -154,8 +154,8 @@ job('Cassandra-template-test') { label(slaveLabel) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -217,8 +217,8 @@ job('Cassandra-template-dtest') { label(slaveLabel) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -274,8 +274,8 @@ matrixJob('Cassandra-template-cqlsh-tests') { concurrentBuild() compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -440,8 +440,8 @@ cassandraBranches.each { description(jobDescription) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } definition { cpsScm { @@ -480,8 +480,8 @@ job('Cassandra-devbranch-artifacts') { label(slaveLabel) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -536,8 +536,8 @@ testTargets.each { label(slaveLabel) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -604,8 +604,8 @@ job('Cassandra-devbranch-dtest') { label(slaveLabel) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -669,8 +669,8 @@ matrixJob('Cassandra-devbranch-cqlsh-tests') { concurrentBuild() compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } wrappers { timeout { @@ -743,8 +743,8 @@ pipelineJob('Cassandra-devbranch') { description(jobDescription) compressBuildLog() logRotator { - numToKeep(25) - artifactNumToKeep(1) + numToKeep(30) + artifactNumToKeep(10) } parameters { stringParam('REPO', 'apache', 'The github user/org to clone cassandra repo from') --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org