diff --git a/run.sh b/run.sh new file mode 100755 index 000000000..1ae53c5f5 --- /dev/null +++ b/run.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# This script is suitable for local use. +# It is also invoked by Jenkins (from scripts/jobs/integrate/community-build). + +# usage: +# ./run.sh +# ./run.sh project1 +# ./run.sh project1,project2,project3 + +set -e +set -o pipefail + +export LANG="en_US.UTF-8" +export HOME="$(pwd)" + +DBUILDVERSION=0.9.5 +echo "dbuild version: $DBUILDVERSION" + +DBUILDCONFIG=community.dbuild +echo "dbuild config file: $DBUILDCONFIG" + +if [ ! -f "$DBUILDCONFIG" ] +then + echo "File not found: $DBUILDCONFIG" + exit 1 +fi + +if [ ! -d "dbuild-${DBUILDVERSION}" ] +then + wget "http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.dbuild/dbuild/${DBUILDVERSION}/tgzs/dbuild-${DBUILDVERSION}.tgz" + tar xfz "dbuild-${DBUILDVERSION}.tgz" + rm "dbuild-${DBUILDVERSION}.tgz" +fi + +# sigh, Ubuntu has nodejs but OS X has node +if hash nodejs 2>/dev/null; then + export NODE=nodejs +else + export NODE=node +fi + +# use -n since running locally you don't want notifications sent, +# and on our Jenkins setup it doesn't actually work (for now anyway) + +echo "dbuild-${DBUILDVERSION}/bin/dbuild" -n "$DBUILDCONFIG" "${@}" +"dbuild-${DBUILDVERSION}/bin/dbuild" -n "$DBUILDCONFIG" "${@}" 2>&1 | tee "dbuild-${DBUILDVERSION}/dbuild.out" +STATUS="$?" +BUILD_ID="$(grep '^\[info\] uuid = ' "dbuild-${DBUILDVERSION}/dbuild.out" | sed -e 's/\[info\] uuid = //')" +echo "The repeatable UUID of this build was: ${BUILD_ID}" +exit "$STATUS" diff --git a/scripts/dbuild-runner.sh b/scripts/dbuild-runner.sh deleted file mode 100755 index 975f5326b..000000000 --- a/scripts/dbuild-runner.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash -set -e -set -o pipefail -export LANG="en_US.UTF-8" -export HOME="$(pwd)" - -if [ "$#" -lt "2" ] -then - echo "Usage: $0 []" - exit 1 -fi -DBUILDCONFIG="$1" -DBUILDVERSION="$2" -shift;shift - -if [ ! -f "$DBUILDCONFIG" ] -then - echo "File not found: $DBUILDCONFIG" - exit 1 -fi - -echo "dbuild version: $DBUILDVERSION" -echo "dbuild config: $DBUILDCONFIG" -#sed 's/"\([^@"]*\)@[^"]*\.[^"]*"/"\1@..."/g' <"$DBUILDCONFIG" - -strip0() { - echo $(($(echo "$1" | sed 's/^0*//'))) -} - -if [ ! -d "dbuild-${DBUILDVERSION}" ] -then - a=( ${DBUILDVERSION//./ } ) - maj=$(strip0 "${a[0]}") - min=$(strip0 "${a[1]}") - patch=$(strip0 "${a[2]}") - if [[ ( $maj -lt 1 ) && ( $min -lt 9 ) ]] - then - # old location for dbuild <0.9.0 (stored on S3) - wget "http://downloads.typesafe.com/dbuild/${DBUILDVERSION}/dbuild-${DBUILDVERSION}.tgz" - else - if [[ ( $maj -lt 1 ) && ( $min -eq 9 ) && ( $patch -lt 2) ]] - then - # new location for dbuild 0.9.[01] (regular artifact) - wget "http://repo.typesafe.com/typesafe/temp-distributed-build-snapshots/com.typesafe.dbuild/dbuild/${DBUILDVERSION}/tgzs/dbuild-${DBUILDVERSION}.tgz" - else - # new location for dbuild >=0.9.2 (regular artifact) - wget "http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.dbuild/dbuild/${DBUILDVERSION}/tgzs/dbuild-${DBUILDVERSION}.tgz" - fi - fi - tar xfz "dbuild-${DBUILDVERSION}.tgz" - rm "dbuild-${DBUILDVERSION}.tgz" - # work around https://github.com/typesafehub/dbuild/issues/175 - # until we can move to a newer version of dbuild that has the fix; - # see https://github.com/scala/community-builds/issues/108 . - # note that this only actually applies if you run dbuild with - # `-l` or `-r`, which tells dbuild to ignore the list of resolvers - # in common.conf and use its built-in list instead. but my - # current understanding is that the resolver list in common.conf - # should be fine both for Jenkins and for local operation. - ST 9/4/2015 - sed -i.bak "s/typesafe.artifactoryonline.com/repo.typesafe.com/g" "dbuild-${DBUILDVERSION}/bin/"*.properties - sed -i.bak "s/scalasbt.artifactoryonline.com/repo.scala-sbt.org/g" "dbuild-${DBUILDVERSION}/bin/"*.properties -fi - -# sigh, Ubuntu has nodejs but OS X has node -if hash nodejs 2>/dev/null; then - export NODE=nodejs -else - export NODE=node -fi - -echo "dbuild-${DBUILDVERSION}/bin/dbuild" "${@}" "$DBUILDCONFIG" -"dbuild-${DBUILDVERSION}/bin/dbuild" "${@}" "$DBUILDCONFIG" 2>&1 | tee "dbuild-${DBUILDVERSION}/dbuild.out" -STATUS="$?" -BUILD_ID="$(grep '^\[info\] uuid = ' "dbuild-${DBUILDVERSION}/dbuild.out" | sed -e 's/\[info\] uuid = //')" -echo "The repeatable UUID of this build was: ${BUILD_ID}" -exit "$STATUS" diff --git a/scripts/jobs/integrate/community-build b/scripts/jobs/integrate/community-build index c2ae9c65d..cc5aad603 100755 --- a/scripts/jobs/integrate/community-build +++ b/scripts/jobs/integrate/community-build @@ -1,10 +1,14 @@ #!/usr/bin/env bash -DBUILDVERSION=0.9.5 +set -e # otherwise these directories just keep growing. # see scala/scala-jenkins-infra#115 rm -rf target-$DBUILDVERSION/project-builds rm -rf target-$DBUILDVERSION/extraction -scripts/dbuild-runner.sh "community.dbuild" "$DBUILDVERSION" "${@}" +# TODO: in scala-jenkins-infra, make an actual parameter for +# specifying projects to be built, instead of hijacking the +# "scala_build_extra_opt" name for that purpose + +./run.sh $scala_build_extra_opt