[ARVADOS-DEV] updated: f84fd5c8f2292a41bbb4cd762dbedab09adbf784

git at public.curoverse.com git at public.curoverse.com
Thu Jan 14 15:45:21 EST 2016


Summary of changes:
 jenkins/dockerfiles/centos6/Dockerfile             |   7 +
 .../package-test-dockerfiles/centos6/Dockerfile    |   4 +-
 .../package-test-dockerfiles/debian7/Dockerfile    |   7 +
 .../package-test-dockerfiles/debian8/Dockerfile    |   9 +-
 .../package-test-dockerfiles/ubuntu1204/Dockerfile |   8 +
 .../package-test-dockerfiles/ubuntu1404/Dockerfile |   8 +
 jenkins/rails-package-scripts/postinst.sh          |   2 +-
 jenkins/run-build-packages-one-target.sh           |  23 +-
 jenkins/run-build-packages-sso.sh                  |  48 ++--
 jenkins/run-build-packages.sh                      |   4 -
 jenkins/run-library.sh                             |  10 +-
 jenkins/run-test-packages-sso.sh                   | 293 ---------------------
 jenkins/test-package-arvados-api-server.sh         |   3 +-
 jenkins/test-package-arvados-sso-server.sh         | 172 ++++++++++++
 jenkins/test-package-arvados-workbench.sh          |   3 +-
 15 files changed, 252 insertions(+), 349 deletions(-)
 delete mode 100755 jenkins/run-test-packages-sso.sh
 create mode 100755 jenkins/test-package-arvados-sso-server.sh

       via  f84fd5c8f2292a41bbb4cd762dbedab09adbf784 (commit)
      from  2fe4a6a068e720e72b1695de133b4363e9a69a40 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f84fd5c8f2292a41bbb4cd762dbedab09adbf784
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Jan 14 15:45:18 2016 -0500

    8008: Incorporate SSO package testing into general package testing framework.

diff --git a/jenkins/dockerfiles/centos6/Dockerfile b/jenkins/dockerfiles/centos6/Dockerfile
index 68134c4..68c1c74 100644
--- a/jenkins/dockerfiles/centos6/Dockerfile
+++ b/jenkins/dockerfiles/centos6/Dockerfile
@@ -20,5 +20,12 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
 RUN touch /var/lib/rpm/* && yum -q -y install python27 python33
 RUN scl enable python33 "easy_install-3.3 pip" && scl enable python27 "easy_install-2.7 pip"
 
+RUN cd / root && \
+    curl -OL 'http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm' && \
+    rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm && \
+    cat /etc/yum.repos.d/rpmforge.repo | sed 's/enabled = 0/enabled = 1/' > /tmp/rpmforge.repo && \
+    mv /tmp/rpmforge.repo /etc/yum.repos.d && \
+    yum install --assumeyes git
+
 ENV WORKSPACE /arvados
 CMD ["scl", "enable", "python33", "python27", "/usr/local/rvm/bin/rvm-exec default bash /jenkins/run-build-packages.sh --target centos6"]
diff --git a/jenkins/package-test-dockerfiles/centos6/Dockerfile b/jenkins/package-test-dockerfiles/centos6/Dockerfile
index 6870ec3..5d610c0 100644
--- a/jenkins/package-test-dockerfiles/centos6/Dockerfile
+++ b/jenkins/package-test-dockerfiles/centos6/Dockerfile
@@ -14,6 +14,8 @@ RUN touch /var/lib/rpm/* && \
 
 RUN cd / root && \
     curl -OL 'http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm' && \
-    rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
+    rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm && \
+    cat /etc/yum.repos.d/rpmforge.repo | sed 's/enabled = 0/enabled = 1/' > /tmp/rpmforge.repo && \
+    mv /tmp/rpmforge.repo /etc/yum.repos.d
 
 COPY localrepo.repo /etc/yum.repos.d/localrepo.repo
\ No newline at end of file
diff --git a/jenkins/package-test-dockerfiles/debian7/Dockerfile b/jenkins/package-test-dockerfiles/debian7/Dockerfile
index fb789c6..9fcf3c6 100644
--- a/jenkins/package-test-dockerfiles/debian7/Dockerfile
+++ b/jenkins/package-test-dockerfiles/debian7/Dockerfile
@@ -1,4 +1,11 @@
 FROM debian:7
 MAINTAINER Peter Amstutz <peter.amstutz at curoverse.com>
 
+# Install RVM
+RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
+    curl -L https://get.rvm.io | bash -s stable && \
+    /usr/local/rvm/bin/rvm install 2.1 && \
+    /usr/local/rvm/bin/rvm alias create default ruby-2.1 && \
+    /usr/local/rvm/bin/rvm-exec default gem install fpm
+
 RUN echo "deb file:///arvados/packages/debian7/ /" >>/etc/apt/sources.list
diff --git a/jenkins/package-test-dockerfiles/debian8/Dockerfile b/jenkins/package-test-dockerfiles/debian8/Dockerfile
index fbcd8f4..01abbc9 100644
--- a/jenkins/package-test-dockerfiles/debian8/Dockerfile
+++ b/jenkins/package-test-dockerfiles/debian8/Dockerfile
@@ -1,4 +1,11 @@
 FROM debian:8
 MAINTAINER Peter Amstutz <peter.amstutz at curoverse.com>
 
-RUN echo "deb file:///arvados/packages/debian8/ /" >>/etc/apt/sources.list
\ No newline at end of file
+# Install RVM
+RUN apt-get update && apt-get -y install curl && \
+    gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
+    curl -L https://get.rvm.io | bash -s stable && \
+    /usr/local/rvm/bin/rvm install 2.1 && \
+    /usr/local/rvm/bin/rvm alias create default ruby-2.1
+
+RUN echo "deb file:///arvados/packages/debian8/ /" >>/etc/apt/sources.list
diff --git a/jenkins/package-test-dockerfiles/ubuntu1204/Dockerfile b/jenkins/package-test-dockerfiles/ubuntu1204/Dockerfile
index 4b6e936..2908515 100644
--- a/jenkins/package-test-dockerfiles/ubuntu1204/Dockerfile
+++ b/jenkins/package-test-dockerfiles/ubuntu1204/Dockerfile
@@ -1,4 +1,12 @@
 FROM ubuntu:precise
 MAINTAINER Peter Amstutz <peter.amstutz at curoverse.com>
 
+
+# Install RVM
+RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
+    curl -L https://get.rvm.io | bash -s stable && \
+    /usr/local/rvm/bin/rvm install 2.1 && \
+    /usr/local/rvm/bin/rvm alias create default ruby-2.1 && \
+    /usr/local/rvm/bin/rvm-exec default gem install fpm
+
 RUN echo "deb file:///arvados/packages/ubuntu1204/ /" >>/etc/apt/sources.list
\ No newline at end of file
diff --git a/jenkins/package-test-dockerfiles/ubuntu1404/Dockerfile b/jenkins/package-test-dockerfiles/ubuntu1404/Dockerfile
index 4f49d92..1bd06b3 100644
--- a/jenkins/package-test-dockerfiles/ubuntu1404/Dockerfile
+++ b/jenkins/package-test-dockerfiles/ubuntu1404/Dockerfile
@@ -1,4 +1,12 @@
 FROM ubuntu:trusty
 MAINTAINER Peter Amstutz <peter.amstutz at curoverse.com>
 
+
+# Install RVM
+RUN gpg --keyserver pool.sks-keyservers.net --recv-keys D39DC0E3 && \
+    curl -L https://get.rvm.io | bash -s stable && \
+    /usr/local/rvm/bin/rvm install 2.1 && \
+    /usr/local/rvm/bin/rvm alias create default ruby-2.1 && \
+    /usr/local/rvm/bin/rvm-exec default gem install fpm
+
 RUN echo "deb file:///arvados/packages/ubuntu1404/ /" >>/etc/apt/sources.list
\ No newline at end of file
diff --git a/jenkins/rails-package-scripts/postinst.sh b/jenkins/rails-package-scripts/postinst.sh
index 1032d14..2feaf13 100644
--- a/jenkins/rails-package-scripts/postinst.sh
+++ b/jenkins/rails-package-scripts/postinst.sh
@@ -194,7 +194,7 @@ configure_version() {
   fi
 
   run_and_report "Running bundle install" \
-      $COMMAND_PREFIX bundle install --path $SHARED_PATH/vendor_bundle --quiet
+      $COMMAND_PREFIX bundle install --path $SHARED_PATH/vendor_bundle --local --quiet
 
   echo -n "Ensuring directory and file permissions ..."
   # Ensure correct ownership of a few files
diff --git a/jenkins/run-build-packages-one-target.sh b/jenkins/run-build-packages-one-target.sh
index af6e078..0233de1 100755
--- a/jenkins/run-build-packages-one-target.sh
+++ b/jenkins/run-build-packages-one-target.sh
@@ -133,23 +133,32 @@ if test -z "$packages" ; then
         keep-web
         libarvados-perl"
 
-    if test "$target" = centos6 ; then
-        packages="$packages python27-python-arvados-fuse
+    case "$TARGET" in
+        centos6)
+            packages="$packages python27-python-arvados-fuse
                   python27-python-arvados-python-client"
-    else
-        packages="$packages python-arvados-fuse
+        ;;
+        *)
+            packages="$packages python-arvados-fuse
                   python-arvados-python-client"
-    fi
+            ;;
+    esac
 fi
 
 FINAL_EXITCODE=0
 
 package_fails=""
+set -x
 
 if [[ -n "$test_packages" ]]; then
     for p in $packages ; do
-        if ! docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
-                  --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND $p ; then
+        set +e
+        docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
+               --env ARVADOS_DEBUG=1 \
+               --env "TARGET=$TARGET" \
+               --env "WORKSPACE=/arvados" \
+               "$IMAGE" $COMMAND $p
+        if test $? != 0 ; then
             FINAL_EXITCODE=$?
             package_fails="$package_fails $p"
             echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2
diff --git a/jenkins/run-build-packages-sso.sh b/jenkins/run-build-packages-sso.sh
index eedb77b..6324066 100755
--- a/jenkins/run-build-packages-sso.sh
+++ b/jenkins/run-build-packages-sso.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 
-. `dirname "$(readlink -f "$0")"`/run-library.sh
+JENKINS_DIR=$(dirname $(readlink -e "$0"))
+. "$JENKINS_DIR/run-library.sh"
 
 read -rd "\000" helpmessage <<EOF
 $(basename $0): Build Arvados SSO server package
@@ -10,8 +11,6 @@ Syntax:
 
 Options:
 
---build-bundle-packages  (default: false)
-    Build package with vendor/bundle included
 --debug
     Output debug information (default: false)
 --target
@@ -23,7 +22,6 @@ EOF
 
 EXITCODE=0
 DEBUG=${ARVADOS_DEBUG:-0}
-BUILD_BUNDLE_PACKAGES=0
 TARGET=debian7
 
 PARSEDOPTS=$(getopt --name "$0" --longoptions \
@@ -47,8 +45,8 @@ while [ $# -gt 0 ]; do
         --debug)
             DEBUG=1
             ;;
-        --build-bundle-packages)
-            BUILD_BUNDLE_PACKAGES=1
+        --test-packages)
+            test_packages=1
             ;;
         --)
             if [ $# -gt 1 ]; then
@@ -111,19 +109,19 @@ fi
 fpm --version >/dev/null 2>&1
 
 if [[ "$?" != 0 ]]; then
-  echo >&2 "$helpmessage"
-  echo >&2
-  echo >&2 "Error: fpm not found"
-  echo >&2
-  exit 1
+    echo >&2 "$helpmessage"
+    echo >&2
+    echo >&2 "Error: fpm not found"
+    echo >&2
+    exit 1
 fi
 
 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`"  # absolutized and normalized
 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
-  # error; for some reason, the path is not accessible
-  # to the script (e.g. permissions re-evaled after suid)
-  exit 1  # fail
+    # error; for some reason, the path is not accessible
+    # to the script (e.g. permissions re-evaled after suid)
+    exit 1  # fail
 fi
 
 debug_echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
@@ -136,20 +134,6 @@ else
     GEM=gem
 fi
 
-if [[ "$TARGET" == "centos6" ]]; then
-  # CentOS6 comes with git 1.7.1, but we want at least 1.7.6
-  # because we use git status --ignore in fpm-info.sh
-  cd /usr/src
-  install_package libcurl-devel zlib-devel wget gettext
-  wget https://www.kernel.org/pub/software/scm/git/git-1.8.5.6.tar.gz
-  tar xzf git-1.8.5.6.tar.gz
-  cd git-1.8.5.6
-  make configure
-  ./configure --prefix=/usr --without-tcltk
-  make all
-  make install
-fi
-
 # Make all files world-readable -- jenkins runs with umask 027, and has checked
 # out our git tree here
 chmod o+r "$WORKSPACE" -R
@@ -165,13 +149,13 @@ umask 0022
 debug_echo "umask is" `umask`
 
 if [[ ! -d "$WORKSPACE/packages/$TARGET" ]]; then
-  mkdir -p $WORKSPACE/packages/$TARGET
+    mkdir -p $WORKSPACE/packages/$TARGET
 fi
 
 # Build the SSO server package
 handle_rails_package arvados-sso-server "$WORKSPACE" \
-    "$WORKSPACE/LICENCE" --url="https://arvados.org" \
-    --description="Arvados SSO server - Arvados is a free and open source platform for big data science." \
-    --license="Expat license"
+                     "$WORKSPACE/LICENCE" --url="https://arvados.org" \
+                     --description="Arvados SSO server - Arvados is a free and open source platform for big data science." \
+                     --license="Expat license"
 
 exit $EXITCODE
diff --git a/jenkins/run-build-packages.sh b/jenkins/run-build-packages.sh
index 26486e9..445b3a0 100755
--- a/jenkins/run-build-packages.sh
+++ b/jenkins/run-build-packages.sh
@@ -27,7 +27,6 @@ EOF
 
 EXITCODE=0
 DEBUG=${ARVADOS_DEBUG:-0}
-BUILD_BUNDLE_PACKAGES=0
 TARGET=debian7
 COMMAND=
 
@@ -52,9 +51,6 @@ while [ $# -gt 0 ]; do
         --debug)
             DEBUG=1
             ;;
-        --build-bundle-packages)
-            BUILD_BUNDLE_PACKAGES=1
-            ;;
         --command)
             COMMAND="$2"; shift
             ;;
diff --git a/jenkins/run-library.sh b/jenkins/run-library.sh
index 0579814..dce75eb 100755
--- a/jenkins/run-library.sh
+++ b/jenkins/run-library.sh
@@ -136,9 +136,7 @@ handle_rails_package() {
         mkdir -p tmp
         version_from_git >"$version_file"
         git rev-parse HEAD >git-commit.version
-        if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
-            bundle install --path vendor/bundle >"$STDOUT_IF_DEBUG"
-        fi
+        bundle package --all
     )
     if [[ 0 != "$?" ]] || ! cd "$WORKSPACE/packages/$TARGET"; then
         echo "ERROR: $pkgname package prep failed" >&2
@@ -160,15 +158,11 @@ handle_rails_package() {
     # .git and packages are for the SSO server, which is built from its
     # repository root.
     for exclude in .git packages tmp log coverage \
-                        vendor/cache/\* Capfile\* config/deploy\*; do
+                        Capfile\* config/deploy\*; do
         switches+=(-x "$exclude_root/$exclude")
     done
     fpm_build "${pos_args[@]}" "${switches[@]}" \
               -x "$exclude_root/vendor/bundle" "$@" "$license_arg"
-    if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
-        posargs[1]="$pkgname-with-bundle"
-        fpm_build "${pos_args[@]}" "${switches[@]}" "$@" "$license_arg"
-    fi
     rm -rf "$scripts_dir" "$version_file"
 }
 
diff --git a/jenkins/run-test-packages-sso.sh b/jenkins/run-test-packages-sso.sh
deleted file mode 100755
index 03d4a96..0000000
--- a/jenkins/run-test-packages-sso.sh
+++ /dev/null
@@ -1,293 +0,0 @@
-#!/bin/bash
-
-. `dirname "$(readlink -f "$0")"`/run-library.sh
-
-read -rd "\000" helpmessage <<EOF
-$(basename $0): Test Arvados SSO package
-
-Syntax:
-        WORKSPACE=/path/to/arvados-sso $(basename $0) [options]
-
-Options:
-
---debug
-    Output debug information (default: false)
---target
-    Distribution to build packages for (default: debian7)
-
-WORKSPACE=path         Path to the Arvados SSO source tree
-
-EOF
-
-EXITCODE=0
-DEBUG=${ARVADOS_DEBUG:-0}
-BUILD_BUNDLE_PACKAGES=0
-TARGET=debian7
-SUDO=/usr/bin/sudo
-
-if [[ ! -e "$SUDO" ]]; then
-  SUDO=
-fi
-
-PARSEDOPTS=$(getopt --name "$0" --longoptions \
-    help,build-bundle-packages,debug,target: \
-    -- "" "$@")
-if [ $? -ne 0 ]; then
-    exit 1
-fi
-
-eval set -- "$PARSEDOPTS"
-while [ $# -gt 0 ]; do
-    case "$1" in
-        --help)
-            echo >&2 "$helpmessage"
-            echo >&2
-            exit 1
-            ;;
-        --target)
-            TARGET="$2"; shift
-            ;;
-        --debug)
-            DEBUG=1
-            ;;
-        --build-bundle-packages)
-            BUILD_BUNDLE_PACKAGES=1
-            ;;
-        --)
-            if [ $# -gt 1 ]; then
-                echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
-                exit 1
-            fi
-            ;;
-    esac
-    shift
-done
-
-STDOUT_IF_DEBUG=/dev/null
-STDERR_IF_DEBUG=/dev/null
-DASHQ_UNLESS_DEBUG=-q
-if [[ "$DEBUG" != 0 ]]; then
-    STDOUT_IF_DEBUG=/dev/stdout
-    STDERR_IF_DEBUG=/dev/stderr
-    DASHQ_UNLESS_DEBUG=
-fi
-
-case "$TARGET" in
-    debian7)
-        FORMAT=deb
-        ;;
-    debian8)
-        FORMAT=deb
-        ;;
-    ubuntu1204)
-        FORMAT=deb
-        ;;
-    ubuntu1404)
-        FORMAT=deb
-        ;;
-    centos6)
-        FORMAT=rpm
-        ;;
-    *)
-        echo -e "$0: Unknown target '$TARGET'.\n" >&2
-        exit 1
-        ;;
-esac
-
-if ! [[ -n "$WORKSPACE" ]]; then
-  echo >&2 "$helpmessage"
-  echo >&2
-  echo >&2 "Error: WORKSPACE environment variable not set"
-  echo >&2
-  exit 1
-fi
-
-if ! [[ -d "$WORKSPACE" ]]; then
-  echo >&2 "$helpmessage"
-  echo >&2
-  echo >&2 "Error: $WORKSPACE is not a directory"
-  echo >&2
-  exit 1
-fi
-
-title () {
-    txt="********** $1 **********"
-    printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
-}
-
-checkexit() {
-    if [[ "$1" != "0" ]]; then
-        title "!!!!!! $2 FAILED !!!!!!"
-    fi
-}
-
-
-# Find the SSO server package
-
-cd "$WORKSPACE"
-
-SSO_VERSION=$(version_from_git)
-PACKAGE_NAME=arvados-sso-server
-
-if [[ "$FORMAT" == "deb" ]]; then
-  PACKAGE_PATH=$WORKSPACE/packages/$TARGET/${PACKAGE_NAME}_${SSO_VERSION}_amd64.deb
-elif [[ "$FORMAT" == "rpm" ]]; then
-  PACKAGE_PATH=$WORKSPACE/packages/$TARGET/${PACKAGE_NAME}-${SSO_VERSION}-1.x86_64.rpm
-fi
-
-# Test 1a: the package to test must exist
-if [[ ! -f $PACKAGE_PATH ]]; then
-  echo "Latest package not found at $PACKAGE_PATH. Please build the package first."
-  exit 1
-fi
-
-if [[ "$FORMAT" == "deb" ]]; then
-  # Test 1b: the system/container where we're running the tests must be clean
-  set +e
-  dpkg -l |grep $PACKAGE_NAME -q
-  if [[ "$?" != "1" ]]; then
-    echo "Please make sure the $PACKAGE_NAME package is not installed before running this script"
-    exit 1
-  fi
-  set -e
-fi
-
-if [[ -e "/var/www/arvados-sso" ]]; then
-  echo "Please make sure /var/www/arvados-sso does not exist before running this script"
-  exit 1
-fi
-
-# Prepare the machine
-if [[ "$FORMAT" == "deb" ]]; then
-  $SUDO apt-get update
-elif [[ "$FORMAT" == "rpm" ]]; then
-  $SUDO yum check-update
-fi
-$SUDO mkdir -p /etc/arvados/sso
-
-if [[ ! -e "/etc/arvados/sso/application.yml" ]]; then
-  RANDOM_PASSWORD=`date | md5sum |cut -f1 -d' '`
-  cp config/application.yml.example /etc/arvados/sso/application.yml
-  sed -i -e 's/uuid_prefix: ~/uuid_prefix: zzzzz/' /etc/arvados/sso/application.yml
-  sed -i -e "s/secret_token: ~/secret_token: $RANDOM_PASSWORD/" /etc/arvados/sso/application.yml
-fi
-
-if [[ ! -e "/etc/arvados/sso/database.yml" ]]; then
-  # We haven't installed our dependencies yet, but we need to set up our
-  # database configuration now. Install postgresql if need be.
-  if [[ "$FORMAT" == "deb" ]]; then
-    install_package postgresql
-  elif [[ "$FORMAT" == "rpm" ]]; then
-    install_package postgresql-server
-    # postgres packaging on CentOS6 is kind of primitive, needs an initdb
-    $SUDO service postgresql initdb
-    if [ "$TARGET" = "centos6" ]; then
-      sed -i -e "s/127.0.0.1\/32          ident/127.0.0.1\/32          md5/" /var/lib/pgsql/data/pg_hba.conf
-      sed -i -e "s/::1\/128               ident/::1\/128               md5/" /var/lib/pgsql/data/pg_hba.conf
-    fi
-  fi
-  $SUDO service postgresql start
-
-  RANDOM_PASSWORD=`date | md5sum |cut -f1 -d' '`
-  cat >/etc/arvados/sso/database.yml <<EOF
-production:
-  adapter: postgresql
-  encoding: utf8
-  database: sso_provider_production
-  username: sso_provider_user
-  password: $RANDOM_PASSWORD
-  host: localhost
-EOF
-  if [[ "$SUDO" != '' ]]; then
-    $SUDO -u postgres psql -c "CREATE USER sso_provider_user WITH PASSWORD '$RANDOM_PASSWORD'"
-    $SUDO -u postgres createdb sso_provider_production -O sso_provider_user
-  else
-    install_package sudo
-    if [ "$TARGET" = "centos6" ]; then
-      # Work around silly CentOS6 default, cf. https://bugzilla.redhat.com/show_bug.cgi?id=1020147
-      sed -i -e 's/Defaults    requiretty/#Defaults    requiretty/' /etc/sudoers
-    fi
-    /usr/bin/sudo -u postgres psql -c "CREATE USER sso_provider_user WITH PASSWORD '$RANDOM_PASSWORD'"
-    /usr/bin/sudo -u postgres createdb sso_provider_production -O sso_provider_user
-  fi
-fi
-
-if [[ "$FORMAT" == "deb" ]]; then
-  # Test 2: the package should install cleanly
-  # In order to get the package dependencies, we need to first do an install
-  # with dpkg that will fail, then run apt-get to install the dependencies,
-  # and the subsequent dpkg installation should succeed.
-  set +e
-  $SUDO dpkg -i $PACKAGE_PATH > /dev/null 2>&1
-  $SUDO apt-get -f install --yes
-  set -e
-  $SUDO dpkg -i $PACKAGE_PATH || EXITCODE=2
-
-  checkexit $EXITCODE "dpkg -i $PACKAGE_PATH"
-
-  # Test 3: the package should remove cleanly
-  $SUDO apt-get remove $PACKAGE_NAME --yes || EXITCODE=3
-
-  checkexit $EXITCODE "apt-get remove $PACKAGE_PATH --yes"
-
-  # Test 4: the package configuration should remove cleanly
-  $SUDO dpkg --purge $PACKAGE_NAME || EXITCODE=4
-
-  checkexit $EXITCODE "dpkg --purge $PACKAGE_PATH"
-
-  if [[ -e "/var/www/arvados-sso" ]]; then
-    EXITCODE=4
-  fi
-
-  checkexit $EXITCODE "leftover items under /var/www/arvados-sso"
-
-  # Test 5: the package should remove cleanly with --purge
-  $SUDO dpkg -i $PACKAGE_PATH || EXITCODE=5
-
-  checkexit $EXITCODE "dpkg -i $PACKAGE_PATH"
-
-  $SUDO apt-get remove $PACKAGE_NAME --purge --yes || EXITCODE=5
-
-  checkexit $EXITCODE "apt-get remove $PACKAGE_PATH --purge --yes"
-
-  if [[ -e "/var/www/arvados-sso" ]]; then
-    EXITCODE=5
-  fi
-
-  checkexit $EXITCODE "leftover items under /var/www/arvados-sso"
-
-elif [[ "$FORMAT" == "rpm" ]]; then
-
-  # Set up Nginx first
-  # (courtesy of https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el6/install_passenger.html)
-  $SUDO yum install -q -y epel-release pygpgme curl
-  $SUDO curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
-  $SUDO yum install -q -y nginx passenger
-  $SUDO sed -i -e 's/^# passenger/passenger/' /etc/nginx/conf.d/passenger.conf
-  # Done setting up Nginx
-
-  # Test 2: the package should install cleanly
-  $SUDO yum -q -y --nogpgcheck localinstall $PACKAGE_PATH || EXITCODE=3
-
-  checkexit $EXITCODE "yum -q -y --nogpgcheck localinstall $PACKAGE_PATH"
-
-  # Test 3: the package should remove cleanly
-  $SUDO yum -q -y remove $PACKAGE_NAME || EXITCODE=3
-
-  checkexit $EXITCODE "yum -q -y remove $PACKAGE_PATH"
-
-  if [[ -e "/var/www/arvados-sso" ]]; then
-    EXITCODE=3
-  fi
-
-  checkexit $EXITCODE "leftover items under /var/www/arvados-sso"
-
-fi
-
-if [[ "$EXITCODE" == "0" ]]; then
-  echo "Testing complete, no errors!"
-else
-  echo "Errors while testing!"
-fi
-
-exit $EXITCODE
diff --git a/jenkins/test-package-arvados-api-server.sh b/jenkins/test-package-arvados-api-server.sh
index 0f21ff5..467872b 100755
--- a/jenkins/test-package-arvados-api-server.sh
+++ b/jenkins/test-package-arvados-api-server.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 set -e
 cd /var/www/arvados-api/current/
-/usr/local/rvm/bin/rvm-exec default bundle install
+yum install --assumeyes httpd
+yum reinstall --assumeyes arvados-api-server
 /usr/local/rvm/bin/rvm-exec default bundle list >$ARV_PACKAGES_DIR/arados-api-server.gems
diff --git a/jenkins/test-package-arvados-sso-server.sh b/jenkins/test-package-arvados-sso-server.sh
new file mode 100755
index 0000000..7f1221e
--- /dev/null
+++ b/jenkins/test-package-arvados-sso-server.sh
@@ -0,0 +1,172 @@
+#!/bin/bash
+
+set -e
+
+EXITCODE=0
+DEBUG=${ARVADOS_DEBUG:-0}
+
+STDOUT_IF_DEBUG=/dev/null
+STDERR_IF_DEBUG=/dev/null
+DASHQ_UNLESS_DEBUG=-q
+if [[ "$DEBUG" != 0 ]]; then
+    STDOUT_IF_DEBUG=/dev/stdout
+    STDERR_IF_DEBUG=/dev/stderr
+    DASHQ_UNLESS_DEBUG=
+fi
+
+case "$TARGET" in
+    debian*|ubuntu*)
+        FORMAT=deb
+        ;;
+    centos6)
+        FORMAT=rpm
+        ;;
+    *)
+        echo -e "$0: Unknown target '$TARGET'.\n" >&2
+        exit 1
+        ;;
+esac
+
+if ! [[ -n "$WORKSPACE" ]]; then
+  echo >&2 "$helpmessage"
+  echo >&2
+  echo >&2 "Error: WORKSPACE environment variable not set"
+  echo >&2
+  exit 1
+fi
+
+if ! [[ -d "$WORKSPACE" ]]; then
+  echo >&2 "$helpmessage"
+  echo >&2
+  echo >&2 "Error: $WORKSPACE is not a directory"
+  echo >&2
+  exit 1
+fi
+
+title () {
+    txt="********** $1 **********"
+    printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
+}
+
+checkexit() {
+    if [[ "$1" != "0" ]]; then
+        title "!!!!!! $2 FAILED !!!!!!"
+    fi
+}
+
+
+# Find the SSO server package
+
+cd "$WORKSPACE"
+
+if [[ ! -d "/var/www/arvados-sso" ]]; then
+  echo "/var/www/arvados-sso should exist"
+  exit 1
+fi
+
+if [[ ! -e "/etc/arvados/sso/application.yml" ]]; then
+    mkdir -p /etc/arvados/sso/
+    RANDOM_PASSWORD=`date | md5sum |cut -f1 -d' '`
+    cp config/application.yml.example /etc/arvados/sso/application.yml
+    sed -i -e 's/uuid_prefix: ~/uuid_prefix: zzzzz/' /etc/arvados/sso/application.yml
+    sed -i -e "s/secret_token: ~/secret_token: $RANDOM_PASSWORD/" /etc/arvados/sso/application.yml
+fi
+
+if [[ ! -e "/etc/arvados/sso/database.yml" ]]; then
+  # We need to set up our database configuration now.
+  if [[ "$FORMAT" == "rpm" ]]; then
+    # postgres packaging on CentOS6 is kind of primitive, needs an initdb
+    $SUDO service postgresql initdb
+    if [ "$TARGET" = "centos6" ]; then
+      sed -i -e "s/127.0.0.1\/32          ident/127.0.0.1\/32          md5/" /var/lib/pgsql/data/pg_hba.conf
+      sed -i -e "s/::1\/128               ident/::1\/128               md5/" /var/lib/pgsql/data/pg_hba.conf
+    fi
+  fi
+  service postgresql start
+
+  RANDOM_PASSWORD=`date | md5sum |cut -f1 -d' '`
+  cat >/etc/arvados/sso/database.yml <<EOF
+production:
+  adapter: postgresql
+  encoding: utf8
+  database: sso_provider_production
+  username: sso_provider_user
+  password: $RANDOM_PASSWORD
+  host: localhost
+EOF
+
+  su postgres -c "psql -c \"CREATE USER sso_provider_user WITH PASSWORD '$RANDOM_PASSWORD'\""
+  su postgres -c "createdb sso_provider_production -O sso_provider_user"
+fi
+
+if [[ "$FORMAT" == "deb" ]]; then
+  # Test 2: the package should reconfigure cleanly
+  dpkg-reconfigure arvados-sso-server || EXITCODE=3
+
+  cd /var/www/arvados-sso/current/
+  /usr/local/rvm/bin/rvm-exec default bundle list >$ARV_PACKAGES_DIR/arvados-sso-server.gems
+
+  # Test 3: the package should remove cleanly
+  $SUDO apt-get remove arvados-sso-server --yes || EXITCODE=3
+
+  checkexit $EXITCODE "apt-get remove arvados-sso-server --yes"
+
+  # Test 4: the package configuration should remove cleanly
+  $SUDO dpkg --purge arvados-sso-server || EXITCODE=4
+
+  checkexit $EXITCODE "dpkg --purge arvados-sso-server"
+
+  if [[ -e "/var/www/arvados-sso" ]]; then
+    EXITCODE=4
+  fi
+
+  checkexit $EXITCODE "leftover items under /var/www/arvados-sso"
+
+  # Test 5: the package should remove cleanly with --purge
+
+  $SUDO apt-get remove arvados-sso-server --purge --yes || EXITCODE=5
+
+  checkexit $EXITCODE "apt-get remove arvados-sso-server --purge --yes"
+
+  if [[ -e "/var/www/arvados-sso" ]]; then
+    EXITCODE=5
+  fi
+
+  checkexit $EXITCODE "leftover items under /var/www/arvados-sso"
+
+elif [[ "$FORMAT" == "rpm" ]]; then
+
+  # Set up Nginx first
+  # (courtesy of https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el6/install_passenger.html)
+  $SUDO yum install -q -y epel-release pygpgme curl
+  $SUDO curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
+  $SUDO yum install -q -y nginx passenger
+  $SUDO sed -i -e 's/^# passenger/passenger/' /etc/nginx/conf.d/passenger.conf
+  # Done setting up Nginx
+
+  # Test 2: the package should reinstall cleanly
+  yum --assumeyes reinstall arvados-sso-server || EXITCODE=3
+
+  cd /var/www/arvados-sso/current/
+  /usr/local/rvm/bin/rvm-exec default bundle list >$ARV_PACKAGES_DIR/arvados-sso-server.gems
+
+  # Test 3: the package should remove cleanly
+  $SUDO yum -q -y remove arvados-sso-server || EXITCODE=3
+
+  checkexit $EXITCODE "yum -q -y remove arvados-sso-server"
+
+  if [[ -e "/var/www/arvados-sso" ]]; then
+    EXITCODE=3
+  fi
+
+  checkexit $EXITCODE "leftover items under /var/www/arvados-sso"
+
+fi
+
+if [[ "$EXITCODE" == "0" ]]; then
+  echo "Testing complete, no errors!"
+else
+  echo "Errors while testing!"
+fi
+
+exit $EXITCODE
diff --git a/jenkins/test-package-arvados-workbench.sh b/jenkins/test-package-arvados-workbench.sh
index 270fc3a..7111b94 100755
--- a/jenkins/test-package-arvados-workbench.sh
+++ b/jenkins/test-package-arvados-workbench.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 set -e
 cd /var/www/arvados-workbench/current/
-/usr/local/rvm/bin/rvm-exec default bundle install
+yum install --assumeyes httpd
+yum reinstall --assumeyes arvados-workbench
 /usr/local/rvm/bin/rvm-exec default bundle list >$ARV_PACKAGES_DIR/arvados-workbench.gems

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list