diff --git a/ci/jenkins/bin/autest.sh b/ci/jenkins/bin/autest.sh index 66fe7313661..45a99ba56bc 100755 --- a/ci/jenkins/bin/autest.sh +++ b/ci/jenkins/bin/autest.sh @@ -18,7 +18,7 @@ set +x -INSTALL="${WORKSPACE}/${BUILD_NUMBER}/install" +INSTALL="${ATS_BUILD_BASEDIR}/install" URL="https://ci.trafficserver.apache.org/autest" JOB_ID=${ghprbPullId:-${ATS_BRANCH:-master}} AUSB="ausb-${JOB_ID}.${BUILD_NUMBER}" diff --git a/ci/jenkins/bin/build.sh b/ci/jenkins/bin/build.sh index 1e258af102a..808f12bdc58 100755 --- a/ci/jenkins/bin/build.sh +++ b/ci/jenkins/bin/build.sh @@ -33,14 +33,14 @@ echo "CCACHE: $CCACHE" echo "WERROR: $WERROR" # Change to the build area (this is previously setup in extract.sh) -cd "${WORKSPACE}/${BUILD_NUMBER}/build" +cd "${ATS_BUILD_BASEDIR}/build" mkdir -p BUILDS && cd BUILDS # Restore verbose shell output set -x ../configure \ - --prefix="${WORKSPACE}/${BUILD_NUMBER}/install" \ + --prefix="${ATS_BUILD_BASEDIR}/install" \ --enable-experimental-plugins \ --enable-example-plugins \ --with-user=jenkins \ diff --git a/ci/jenkins/bin/cache-tests.sh b/ci/jenkins/bin/cache-tests.sh index f9b46066d04..1870ad64412 100755 --- a/ci/jenkins/bin/cache-tests.sh +++ b/ci/jenkins/bin/cache-tests.sh @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -PREFIX="${WORKSPACE}/${BUILD_NUMBER}/install" +PREFIX="${ATS_BUILD_BASEDIR}/install" REMAP="${PREFIX}/etc/trafficserver/remap.config" RECORDS="${PREFIX}/etc/trafficserver/records.config" @@ -25,7 +25,7 @@ TWEAK="" # Change to the build area (this is previously setup in extract.sh) set +x -cd "${WORKSPACE}/${BUILD_NUMBER}/build" +cd "${ATS_BUILD_BASEDIR}/build" ./configure \ --prefix=${PREFIX} \ diff --git a/ci/jenkins/bin/clang-format.sh b/ci/jenkins/bin/clang-format.sh index d60da3e4aab..40170eead90 100755 --- a/ci/jenkins/bin/clang-format.sh +++ b/ci/jenkins/bin/clang-format.sh @@ -16,6 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +set +x cd "${WORKSPACE}/src" # First, make sure there are no trailing WS!!! @@ -25,6 +26,17 @@ if [ "1" != "$?" ]; then echo "Error: Please run: git grep -IE ' +$'" exit 1 fi +echo "Success! No trailing whitespace" + +# Make sure there are no DOS shit here. +git grep -IE $'\r$' | fgrep -v 'lib/yamlcpp' +if [ "1" != "$?" ]; then + echo "Error: Please make sure to run dos2unix on the above file(s)" + exit 1 +fi +echo "Success! No DOS carriage return" + +set -x autoreconf -if && ./configure [ "0" != "$?" ] && exit 1 diff --git a/ci/jenkins/bin/cleanup.sh b/ci/jenkins/bin/cleanup.sh index 9fa5a07b83d..39c3de03f4b 100755 --- a/ci/jenkins/bin/cleanup.sh +++ b/ci/jenkins/bin/cleanup.sh @@ -17,11 +17,10 @@ # limitations under the License. # Do a distclean, to verify that we can actually satisfy this (common) build target -cd "${WORKSPACE}/${BUILD_NUMBER}/build" +cd "${ATS_BUILD_BASEDIR}/build" [ -d BUILDS ] && cd BUILDS ${ATS_MAKE} distclean -# Final cleanup, this removes the build and install areas -cd "${WORKSPACE}" -rm -rf ${BUILD_NUMBER} +# Final cleanup, this removes the build and install areas, not really needed nor right for docker builds +cd "${WORKSPACE}" && rm -rf ${BUILD_NUMBER} diff --git a/ci/jenkins/bin/environment.sh b/ci/jenkins/bin/environment.sh index e53a5dd255b..458edada8a2 100755 --- a/ci/jenkins/bin/environment.sh +++ b/ci/jenkins/bin/environment.sh @@ -18,11 +18,17 @@ # Show which platform we're actually building on set +x -echo -n "Build platform: " +# Deduct if this build is on a docker instance +IS_DOCKER="no" +df / | fgrep -q overlay && IS_DOCKER="yes" +export IS_DOCKER + +echo -n "Build platform: " [ -f /etc/lsb-release ] && grep DISTRIB_RELEASE /etc/lsb-release [ -f /etc/debian_version ] && cat /etc/debian_version [ -f /etc/redhat-release ] && cat /etc/redhat-release +echo "Build on Docker: " $IS_DOCKER # Shouldn't have to tweak this export ATS_SRC_HOME="/home/jenkins/src" @@ -40,15 +46,9 @@ export TODAY=$(/bin/date +'%m%d%Y') # Extract the current branch (default to master). ToDo: Can we do this better ? ATS_BRANCH=master -ATS_IS_7="yes" -test "${JOB_NAME#*-5.3.x}" != "${JOB_NAME}" && ATS_BRANCH=5.3.x && ATS_IS_7="no" -test "${JOB_NAME#*-6.2.x}" != "${JOB_NAME}" && ATS_BRANCH=6.2.x && ATS_IS_7="no" test "${JOB_NAME#*-7.1.x}" != "${JOB_NAME}" && ATS_BRANCH=7.1.x test "${JOB_NAME#*-8.0.x}" != "${JOB_NAME}" && ATS_BRANCH=8.0.x -test "${JOB_NAME#*-8.1.x}" != "${JOB_NAME}" && ATS_BRANCH=8.1.x -test "${JOB_NAME#*-8.2.x}" != "${JOB_NAME}" && ATS_BRANCH=8.2.x -test "${JOB_NAME#*-8.3.x}" != "${JOB_NAME}" && ATS_BRANCH=8.3.x test "${JOB_NAME#*-9.0.x}" != "${JOB_NAME}" && ATS_BRANCH=9.0.x test "${JOB_NAME#*-9.1.x}" != "${JOB_NAME}" && ATS_BRANCH=9.1.x test "${JOB_NAME#*-9.2.x}" != "${JOB_NAME}" && ATS_BRANCH=9.2.x @@ -89,17 +89,14 @@ else # Default is gcc / g++ export CC=gcc export CXX=g++ - # Only test for non standard compilers on ATS v7.x and later. ToDo: Remove this when 6.x is EOLifed. - if test "$ATS_IS_7" == "yes"; then - if test -f "/opt/rh/devtoolset-7/enable"; then - # This changes the path such that gcc / g++ is the right version. This is for CentOS 6 / 7. - source /opt/rh/devtoolset-7/enable - echo "Enabling devtoolset-7" - elif test -x "/usr/bin/g++-7"; then - # This is for Debian platforms - export CC=/usr/bin/gcc-7 - export CXX=/usr/bin/g++-7 - fi + if test -f "/opt/rh/devtoolset-7/enable"; then + # This changes the path such that gcc / g++ is the right version. This is for CentOS 6 / 7. + source /opt/rh/devtoolset-7/enable + echo "Enabling devtoolset-7" + elif test -x "/usr/bin/g++-7"; then + # This is for Debian platforms + export CC=/usr/bin/gcc-7 + export CXX=/usr/bin/g++-7 fi fi @@ -111,7 +108,12 @@ echo "CXX: $CXX" $CXX -v # Figure out parallelism for regular builds / bots -ATS_MAKE_FLAGS="-j6" +export ATS_MAKE_FLAGS="-j6" +if [ "yes" == "$IS_DOCKER" ]; then + export ATS_BUILD_BASEDIR="${WORKSPACE}" +else + export ATS_BUILD_BASEDIR="${WORKSPACE}/${BUILD_NUMBER}" +fi # Restore verbose shell output set -x diff --git a/ci/jenkins/bin/extract.sh b/ci/jenkins/bin/extract.sh index 5ee733d2ea1..9587825b748 100755 --- a/ci/jenkins/bin/extract.sh +++ b/ci/jenkins/bin/extract.sh @@ -18,16 +18,16 @@ set +x # Setup the build and install area for this build -mkdir -p "${WORKSPACE}/${BUILD_NUMBER}/build" -mkdir -p "${WORKSPACE}/${BUILD_NUMBER}/install" +mkdir -p "${ATS_BUILD_BASEDIR}/build" +mkdir -p "${ATS_BUILD_BASEDIR}/install" -cd "${WORKSPACE}/${BUILD_NUMBER}/build" +cd "${ATS_BUILD_BASEDIR}/build" echo "Artifact: ${ATS_SRC_HOME}/trafficserver-${ATS_BRANCH}.tar.bz2" tar xf ${ATS_SRC_HOME}/trafficserver-${ATS_BRANCH}.tar.bz2 mv trafficserver-*/* . -echo "build: ${WORKSPACE}/${BUILD_NUMBER}/build" -echo "install: ${WORKSPACE}/${BUILD_NUMBER}/install" +echo "build: ${ATS_BUILD_BASEDIR}/build" +echo "install: ${ATS_BUILD_BASEDIR}/install" # Restore verbose shell output set -x diff --git a/ci/jenkins/bin/github.sh b/ci/jenkins/bin/github.sh index b7b2ebaac01..64dcf811365 100755 --- a/ci/jenkins/bin/github.sh +++ b/ci/jenkins/bin/github.sh @@ -18,7 +18,7 @@ set +x -INSTALL="${WORKSPACE}/${BUILD_NUMBER}/install" +INSTALL="${ATS_BUILD_BASEDIR}/install" # Optional settings CCACHE="" diff --git a/ci/jenkins/bin/regression.sh b/ci/jenkins/bin/regression.sh index 51ae5b8d0c5..7ffda65e782 100755 --- a/ci/jenkins/bin/regression.sh +++ b/ci/jenkins/bin/regression.sh @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cd "${WORKSPACE}/${BUILD_NUMBER}/build" +cd "${ATS_BUILD_BASEDIR}/build" [ -d BUILDS ] && cd BUILDS echo @@ -27,5 +27,5 @@ ${ATS_MAKE} install || exit 1 echo echo -n "Regression tests started at " && date -"${WORKSPACE}/${BUILD_NUMBER}/install/bin/traffic_server" -k -K -R 1 +"${ATS_BUILD_BASEDIR}/install/bin/traffic_server" -k -K -R 1 echo -n "Regression tests finished at " && date