4 read -rd "\000" helpmessage <<EOF
5 $(basename $0): Build Arvados packages and (optionally) upload them.
8 WORKSPACE=/path/to/arvados $(basename $0) [options]
13 Upload packages (default: false)
15 scp user for repository server (only required when --upload is specified)
17 scp host for repository server (only required when --upload is specified)
18 --build-bundle-packages (default: false)
19 Build api server and workbench packages with vendor/bundle included
21 Output debug information (default: false)
23 Distribution to build packages for (default: debian7)
25 WORKSPACE=path Path to the Arvados source tree to build packages from
34 BUILD_BUNDLE_PACKAGES=0
37 PARSEDOPTS=$(getopt --name "$0" --longoptions \
38 help,upload,scp-user:,scp-host:,apt-server:,build-bundle-packages,debug,target: \
44 eval set -- "$PARSEDOPTS"
45 while [ $# -gt 0 ]; do
48 echo >&2 "$helpmessage"
55 --scp-host|--apt-server)
67 --build-bundle-packages)
68 BUILD_BUNDLE_PACKAGES=1
72 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
81 if [[ "$UPLOAD" != '0' && ("$SCPUSER" == '' || "$SCPHOST" == '') ]]; then
82 echo >&2 "$helpmessage"
84 echo >&2 "Error: please specify --scp-user and --scp-host if --upload is set"
89 declare -a PYTHON_BACKPORTS PYTHON3_BACKPORTS
95 REPO_UPDATE_CMD='freight add *deb apt/wheezy && freight cache && rm -f *deb'
96 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
97 oauth2client pyasn1 pyasn1-modules rsa uritemplate httplib2 ws4py \
98 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
99 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
100 PYTHON3_BACKPORTS=(docker-py six requests)
105 REPO_UPDATE_CMD='mv *rpm /var/www/rpm.arvados.org/CentOS/6/os/x86_64/ && createrepo /var/www/rpm.arvados.org/CentOS/6/os/x86_64/'
106 PYTHON_BACKPORTS=(python-gflags pyvcf google-api-python-client \
107 oauth2client pyasn1 pyasn1-modules rsa uritemplate httplib2 ws4py \
108 virtualenv pykka apache-libcloud requests six pyexecjs jsonschema \
109 ciso8601 pycrypto backports.ssl_match_hostname pycurl)
110 PYTHON3_BACKPORTS=(docker-py six requests)
113 echo -e "$0: Unknown target '$TARGET'.\n" >&2
119 if ! [[ -n "$WORKSPACE" ]]; then
120 echo >&2 "$helpmessage"
122 echo >&2 "Error: WORKSPACE environment variable not set"
128 fpm --version >/dev/null 2>&1
130 if [[ "$?" != 0 ]]; then
131 echo >&2 "$helpmessage"
133 echo >&2 "Error: fpm not found"
138 if ! easy_install3 --version >/dev/null; then
142 Error: easy_install3 (from python3-setuptools) not found
148 RUN_BUILD_PACKAGES_PATH="`dirname \"$0\"`"
149 RUN_BUILD_PACKAGES_PATH="`( cd \"$RUN_BUILD_PACKAGES_PATH\" && pwd )`" # absolutized and normalized
150 if [ -z "$RUN_BUILD_PACKAGES_PATH" ] ; then
151 # error; for some reason, the path is not accessible
152 # to the script (e.g. permissions re-evaled after suid)
156 if [[ "$DEBUG" != 0 ]]; then
157 echo "$0 is running from $RUN_BUILD_PACKAGES_PATH"
158 echo "Workspace is $WORKSPACE"
162 # Generates a version number from the git log for the current working
163 # directory, and writes it to stdout.
164 local git_ts git_hash
165 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
166 --format=format:"git_ts=%ct git_hash=%h" .)
167 echo "0.1.$(date -ud "@$git_ts" +%Y%m%d%H%M%S).$git_hash"
170 timestamp_from_git() {
171 # Generates a version number from the git log for the current working
172 # directory, and writes it to stdout.
173 local git_ts git_hash
174 declare $(TZ=UTC git log -n1 --first-parent --max-count=1 \
175 --format=format:"git_ts=%ct git_hash=%h" .)
179 handle_python_package () {
180 # This function assumes the current working directory is the python package directory
181 if [[ "$UPLOAD" != 0 ]]; then
182 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
183 if [[ "$DEBUG" != 0 ]]; then
184 python setup.py sdist upload
186 python setup.py -q sdist upload
189 # Make sure only to use sdist - that's the only format pip can deal with (sigh)
190 if [[ "$DEBUG" != 0 ]]; then
191 python setup.py sdist
193 python setup.py -q sdist
198 # Build debs for everything
199 fpm_build_and_scp () {
200 # The package source. Depending on the source type, this can be a
201 # path, or the name of the package in an upstream repository (e.g.,
205 # The name of the package to build. Defaults to $PACKAGE.
206 PACKAGE_NAME=${1:-$PACKAGE}
208 # Optional: the vendor of the package. Should be "Curoverse, Inc." for
209 # packages of our own software. Passed to fpm --vendor.
212 # The type of source package. Passed to fpm -s. Default "python".
213 PACKAGE_TYPE=${1:-python}
215 # Optional: the package version number. Passed to fpm -v.
219 case "$PACKAGE_TYPE" in
221 # All Arvados Python2 packages depend on Python 2.7.
222 # Make sure we build with that for consistency.
223 set -- "$@" --python-bin python2.7 \
224 --python-easyinstall easy_install-2.7
227 # fpm does not actually support a python3 package type. Instead
228 # we recognize it as a convenience shortcut to add several
229 # necessary arguments to fpm's command line later, after we're
230 # done handling positional arguments.
232 set -- "$@" --python-bin python3 --python-easyinstall easy_install3 \
233 --python-package-name-prefix python3 --depends python3
237 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "-s" "$PACKAGE_TYPE" "-t" "$FORMAT" "-x" "usr/local/lib/python2.7/dist-packages/tests")
239 if [[ "$PACKAGE_NAME" != "$PACKAGE" ]]; then
240 COMMAND_ARR+=('-n' "$PACKAGE_NAME")
243 if [[ "$VENDOR" != "" ]]; then
244 COMMAND_ARR+=('--vendor' "$VENDOR")
247 if [[ "$VERSION" != "" ]]; then
248 COMMAND_ARR+=('-v' "$VERSION")
251 # Append remaining function arguments directly to fpm's command line.
256 COMMAND_ARR+=("$PACKAGE")
258 if [[ "$DEBUG" != 0 ]]; then
260 echo "${COMMAND_ARR[@]}"
264 FPM_RESULTS=$("${COMMAND_ARR[@]}")
267 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
270 # verify build results and scp debs, if needed
271 fpm_verify_and_scp () {
277 if [[ $FPM_RESULTS =~ ([A-Za-z0-9_\-.]*\.)(deb|rpm) ]]; then
278 FPM_PACKAGE_NAME=${BASH_REMATCH[1]}${BASH_REMATCH[2]}
281 if [[ "$FPM_PACKAGE_NAME" == "" ]]; then
283 echo "Error: $PACKAGE: Unable to figure out package name from fpm results:"
288 if [[ ! $FPM_RESULTS =~ "File already exists" ]]; then
289 if [[ "$FPM_EXIT_CODE" != "0" ]]; then
290 echo "Error building package for $1:\n $FPM_RESULTS"
292 if [[ "$UPLOAD" != 0 ]]; then
293 scp -P2222 $FPM_PACKAGE_NAME $SCPUSER@$SCPHOST:$FPM_OUTDIR/
298 echo "Package $FPM_PACKAGE_NAME exists, not rebuilding"
303 if [[ -f /etc/profile.d/rvm.sh ]]; then
304 source /etc/profile.d/rvm.sh
307 # Make all files world-readable -- jenkins runs with umask 027, and has checked
308 # out our git tree here
309 chmod o+r "$WORKSPACE" -R
311 # More cleanup - make sure all executables that we'll package are 755
312 find -type d -name 'bin' |xargs -I {} find {} -type f |xargs -I {} chmod 755 {}
314 # Now fix our umask to something better suited to building and publishing
318 if [[ "$DEBUG" != 0 ]]; then
319 echo "umask is" `umask`
323 if [[ "$DEBUG" != 0 ]]; then
324 echo -e "\nPerl packages\n"
327 if [[ "$DEBUG" != 0 ]]; then
333 cd "$WORKSPACE/sdk/perl"
335 if [[ -e Makefile ]]; then
336 make realclean >"$PERL_OUT"
338 find -maxdepth 1 \( -name 'MANIFEST*' -or -name 'libarvados-perl_*.deb' \) \
342 perl Makefile.PL >"$PERL_OUT" && \
343 make install PREFIX=install INSTALLDIRS=perl >"$PERL_OUT" && \
344 fpm_build_and_scp install/=/usr libarvados-perl "Curoverse, Inc." dir \
345 "$(version_from_git)"
348 if [[ "$DEBUG" != 0 ]]; then
354 if type rvm-exec >/dev/null 2>&1; then
355 FPM_GEM_PREFIX=$(rvm-exec system gem environment gemdir)
357 FPM_GEM_PREFIX=$(gem environment gemdir)
363 ARVADOS_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
364 ARVADOS_GEM_DATE=`date --utc --date="@${ARVADOS_GEM_EPOCH}" +%Y%m%d%H%M%S`
365 ARVADOS_GEM_VERSION="0.1.${ARVADOS_GEM_DATE}"
367 # see if this gem needs building/uploading
368 gem search arvados -r -a |grep -q $ARVADOS_GEM_VERSION
370 if [[ "$?" != "0" ]]; then
371 # clean up old packages
372 find -maxdepth 1 \( -name 'arvados-*.gem' -or -name 'rubygem-arvados_*.deb' -or -name 'rubygem-arvados_*.rpm' \) \
375 if [[ "$DEBUG" != 0 ]]; then
376 gem build arvados.gemspec
378 # -q appears to be broken in gem version 2.2.2
379 gem build arvados.gemspec -q >/dev/null 2>&1
382 if [[ "$UPLOAD" != 0 ]]; then
384 gem push arvados-*gem
387 fpm_build_and_scp arvados-*.gem "" "Curoverse, Inc." gem "" \
388 --prefix "$FPM_GEM_PREFIX"
391 # Build arvados-cli GEM
395 ARVADOS_CLI_GEM_EPOCH=`git log -n1 --first-parent --format=%ct`
396 ARVADOS_CLI_GEM_DATE=`date --utc --date="@${ARVADOS_CLI_GEM_EPOCH}" +%Y%m%d%H%M%S`
397 ARVADOS_CLI_GEM_VERSION="0.1.${ARVADOS_CLI_GEM_DATE}"
399 # see if this gem needs building/uploading
400 gem search arvados-cli -r -a |grep -q $ARVADOS_GEM_VERSION
402 if [[ "$?" != "0" ]]; then
404 rm -f arvados-cli*gem
406 if [[ "$DEBUG" != 0 ]]; then
407 gem build arvados-cli.gemspec
409 # -q appears to be broken in gem version 2.2.2
410 gem build arvados-cli.gemspec -q >/dev/null
413 if [[ "$UPLOAD" != 0 ]]; then
415 gem push arvados-cli*gem
420 if [[ "$DEBUG" != 0 ]]; then
422 echo "Python packages"
429 handle_python_package
431 cd ../../services/fuse
432 handle_python_package
434 cd ../../services/nodemanager
435 handle_python_package
437 if [[ ! -d "$WORKSPACE/debs" ]]; then
438 mkdir -p $WORKSPACE/debs
442 # We use $WORKSPACE/src-build-dir as the clean directory from which to build the src package
443 if [[ ! -d "$WORKSPACE/src-build-dir" ]]; then
444 mkdir "$WORKSPACE/src-build-dir"
446 if [[ "$DEBUG" != 0 ]]; then
447 git clone https://github.com/curoverse/arvados.git src-build-dir
449 git clone -q https://github.com/curoverse/arvados.git src-build-dir
453 cd "$WORKSPACE/src-build-dir"
454 # just in case, check out master
455 if [[ "$DEBUG" != 0 ]]; then
458 # go into detached-head state
459 git checkout `git log --format=format:%h -n1 .`
461 git checkout -q master
463 # go into detached-head state
464 git checkout -q `git log --format=format:%h -n1 .`
467 git log --format=format:%H -n1 . > git-commit.version
469 # Build arvados src deb package
471 PKG_VERSION=$(version_from_git)
473 fpm_build_and_scp $WORKSPACE/src-build-dir/=/usr/local/arvados/src arvados-src 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--exclude=usr/local/arvados/src/.git" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=The Arvados source code" "--architecture=all"
475 # clean up, check out master and step away from detached-head state
476 cd "$WORKSPACE/src-build-dir"
477 if [[ "$DEBUG" != 0 ]]; then
480 git checkout -q master
484 export GOPATH=$(mktemp -d)
485 mkdir -p "$GOPATH/src/git.curoverse.com"
486 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
489 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepstore"
490 PKG_VERSION=$(version_from_git)
491 go get "git.curoverse.com/arvados.git/services/keepstore"
493 fpm_build_and_scp $GOPATH/bin/keepstore=/usr/bin/keepstore keepstore 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Keepstore is the Keep storage daemon, accessible to clients on the LAN"
496 cd "$GOPATH/src/git.curoverse.com/arvados.git/sdk/go"
497 GO_SDK_VERSION=$(version_from_git)
498 GO_SDK_TIMESTAMP=$(timestamp_from_git)
501 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/keepproxy"
502 KEEPPROXY_VERSION=$(version_from_git)
503 KEEPPROXY_TIMESTAMP=$(timestamp_from_git)
505 if [[ "$GO_SDK_TIMESTAMP" -gt "$KEEPPROXY_TIMESTAMP" ]]; then
506 PKG_VERSION=$GO_SDK_VERSION
508 PKG_VERSION=$KEEPPROXY_VERSION
511 go get "git.curoverse.com/arvados.git/services/keepproxy"
513 fpm_build_and_scp $GOPATH/bin/keepproxy=/usr/bin/keepproxy keepproxy 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Keepproxy makes a Keep cluster accessible to clients that are not on the LAN"
516 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/datamanager"
517 DATAMANAGER_VERSION=$(version_from_git)
518 DATAMANAGER_TIMESTAMP=$(timestamp_from_git)
520 if [[ "$GO_SDK_TIMESTAMP" -gt "$DATAMANAGER_TIMESTAMP" ]]; then
521 PKG_VERSION=$GO_SDK_VERSION
523 PKG_VERSION=$DATAMANAGER_VERSION
526 go get "git.curoverse.com/arvados.git/services/datamanager"
528 fpm_build_and_scp $GOPATH/bin/datamanager=/usr/bin/arvados-data-manager arvados-data-manager 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Datamanager ensures block replication levels, reports on disk usage and determines which blocks should be deleted when space is needed."
531 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/arv-git-httpd"
532 ARVGITHTTPD_VERSION=$(version_from_git)
533 ARVGITHTTPD_TIMESTAMP=$(timestamp_from_git)
535 if [[ "$GO_SDK_TIMESTAMP" -gt "$ARVGITHTTPD_TIMESTAMP" ]]; then
536 PKG_VERSION=$GO_SDK_VERSION
538 PKG_VERSION=$ARVGITHTTPD_VERSION
541 go get "git.curoverse.com/arvados.git/services/arv-git-httpd"
543 fpm_build_and_scp $GOPATH/bin/arv-git-httpd=/usr/bin/arvados-git-httpd arvados-git-httpd 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Provides authenticated http access to Arvados-hosted git repositories."
546 cd "$GOPATH/src/git.curoverse.com/arvados.git/services/crunchstat"
547 PKG_VERSION=$(version_from_git)
548 go get "git.curoverse.com/arvados.git/services/crunchstat"
550 fpm_build_and_scp $GOPATH/bin/crunchstat=/usr/bin/crunchstat crunchstat 'Curoverse, Inc.' 'dir' "$PKG_VERSION" "--url=https://arvados.org" "--license=GNU Affero General Public License, version 3.0" "--description=Crunchstat gathers cpu/memory/network statistics of running Crunch jobs"
553 # Please resist the temptation to add --no-python-fix-name to the fpm call here
554 # (which would remove the python- prefix from the package name), because this
555 # package is a dependency of arvados-fuse, and fpm can not omit the python-
556 # prefix from only one of the dependencies of a package... Maybe I could
557 # whip up a patch and send it upstream, but that will be for another day. Ward,
560 fpm_build_and_scp $WORKSPACE/sdk/python python-arvados-python-client 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/sdk/python/arvados_python_client.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados Python SDK" --depends=python2.7
563 # Please see comment about --no-python-fix-name above; we stay consistent and do
564 # not omit the python- prefix first.
566 fpm_build_and_scp $WORKSPACE/services/fuse python-arvados-fuse 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/fuse/arvados_fuse.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Keep FUSE driver" --depends=python2.7
570 fpm_build_and_scp $WORKSPACE/services/nodemanager arvados-node-manager 'Curoverse, Inc.' 'python' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/nodemanager/arvados_node_manager.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados node manager" --depends=python2.7
572 # The Docker image cleaner
574 fpm_build_and_scp $WORKSPACE/services/dockercleaner arvados-docker-cleaner 'Curoverse, Inc.' 'python3' "$(awk '($1 == "Version:"){print $2}' $WORKSPACE/services/dockercleaner/arvados_docker_cleaner.egg-info/PKG-INFO)" "--url=https://arvados.org" "--description=The Arvados Docker image cleaner"
577 for deppkg in "${PYTHON_BACKPORTS[@]}"; do
578 fpm_build_and_scp "$deppkg"
581 # Python 3 dependencies
582 for deppkg in "${PYTHON3_BACKPORTS[@]}"; do
583 # The empty string is the vendor argument: these aren't Curoverse software.
584 fpm_build_and_scp "$deppkg" "python3-$deppkg" "" python3
587 # Build the API server package
589 cd "$WORKSPACE/services/api"
591 API_VERSION=$(version_from_git)
592 PACKAGE_NAME=arvados-api-server
594 if [[ ! -d "$WORKSPACE/services/api/tmp" ]]; then
595 mkdir $WORKSPACE/services/api/tmp
598 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
600 if [[ "$DEBUG" != 0 ]]; then
604 /usr/bin/git rev-parse HEAD > git-commit.version
608 # Annoyingly, we require a database.yml file for rake assets:precompile to work. So for now,
609 # we do that in the upgrade script.
610 # TODO: add bogus database.yml file so we can precompile the assets and put them in the
611 # package. Then remove that database.yml file again. It has to be a valid file though.
612 #RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile
614 # This is the complete package with vendor/bundle included.
615 # It's big, so we do not build it by default.
616 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
617 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados API server - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}-with-bundle" "-v" "$API_VERSION" "-x" "var/www/arvados-api/current/tmp" "-x" "var/www/arvados-api/current/log" "-x" "var/www/arvados-api/current/vendor/cache/*" "-x" "var/www/arvados-api/current/coverage" "-x" "var/www/arvados-api/current/Capfile*" "-x" "var/www/arvados-api/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/postinst.sh" "$WORKSPACE/services/api/=/var/www/arvados-api/current" "$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/arvados-api-server-upgrade.sh=/usr/local/bin/arvados-api-server-upgrade.sh")
619 if [[ "$DEBUG" != 0 ]]; then
621 echo "${COMMAND_ARR[@]}"
625 FPM_RESULTS=$("${COMMAND_ARR[@]}")
627 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
630 # Build the 'bare' package without vendor/bundle.
631 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados API server - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}" "-v" "$API_VERSION" "-x" "var/www/arvados-api/current/tmp" "-x" "var/www/arvados-api/current/log" "-x" "var/www/arvados-api/current/vendor/bundle" "-x" "var/www/arvados-api/current/vendor/cache/*" "-x" "var/www/arvados-api/current/coverage" "-x" "var/www/arvados-api/current/Capfile*" "-x" "var/www/arvados-api/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/postinst.sh" "$WORKSPACE/services/api/=/var/www/arvados-api/current" "$RUN_BUILD_PACKAGES_PATH/arvados-api-server-extras/arvados-api-server-upgrade.sh=/usr/local/bin/arvados-api-server-upgrade.sh")
633 if [[ "$DEBUG" != 0 ]]; then
635 echo "${COMMAND_ARR[@]}"
639 FPM_RESULTS=$("${COMMAND_ARR[@]}")
641 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
643 # API server package build done
645 # Build the workbench server package
647 cd "$WORKSPACE/apps/workbench"
649 WORKBENCH_VERSION=$(version_from_git)
650 PACKAGE_NAME=arvados-workbench
652 if [[ ! -d "$WORKSPACE/apps/workbench/tmp" ]]; then
653 mkdir $WORKSPACE/apps/workbench/tmp
656 BUNDLE_OUTPUT=`bundle install --path vendor/bundle`
658 if [[ "$DEBUG" != 0 ]]; then
662 /usr/bin/git rev-parse HEAD > git-commit.version
664 # clear the tmp directory; the asset generation step will recreate tmp/cache/assets,
665 # and we want that in the package, so it's easier to not exclude the tmp directory
666 # from the package - empty it instead.
667 rm -rf $WORKSPACE/apps/workbench/tmp/*
669 # Set up application.yml so that asset precompilation works
670 \cp config/application.yml.example config/application.yml -f
671 sed -i 's/secret_token: ~/secret_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' config/application.yml
673 RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile >/dev/null
675 if [[ "$?" != "0" ]]; then
676 echo "ERROR: Asset precompilation failed"
682 # This is the complete package with vendor/bundle included.
683 # It's big, so we do not build it by default.
684 if [[ "$BUILD_BUNDLE_PACKAGES" != 0 ]]; then
686 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados Workbench - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}-with-bundle" "-v" "$WORKBENCH_VERSION" "-x" "var/www/arvados-workbench/current/log" "-x" "var/www/arvados-workbench/current/vendor/cache/*" "-x" "var/www/arvados-workbench/current/coverage" "-x" "var/www/arvados-workbench/current/Capfile*" "-x" "var/www/arvados-workbench/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/postinst.sh" "$WORKSPACE/apps/workbench/=/var/www/arvados-workbench/current" "$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/arvados-workbench-upgrade.sh=/usr/local/bin/arvados-workbench-upgrade.sh")
688 if [[ "$DEBUG" != 0 ]]; then
690 echo "${COMMAND_ARR[@]}"
694 FPM_RESULTS=$("${COMMAND_ARR[@]}")
696 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
699 # Build the 'bare' package without vendor/bundle.
701 declare -a COMMAND_ARR=("fpm" "--maintainer=Ward Vandewege <ward@curoverse.com>" "--vendor='Curoverse, Inc.'" "--url='https://arvados.org'" "--description='Arvados Workbench - Arvados is a free and open source platform for big data science.'" "--license='GNU Affero General Public License, version 3.0'" "-s" "dir" "-t" "$FORMAT" "-n" "${PACKAGE_NAME}" "-v" "$WORKBENCH_VERSION" "-x" "var/www/arvados-workbench/current/log" "-x" "var/www/arvados-workbench/current/vendor/bundle" "-x" "var/www/arvados-workbench/current/vendor/cache/*" "-x" "var/www/arvados-workbench/current/coverage" "-x" "var/www/arvados-workbench/current/Capfile*" "-x" "var/www/arvados-workbench/current/config/deploy*" "--after-install=$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/postinst.sh" "$WORKSPACE/apps/workbench/=/var/www/arvados-workbench/current" "$RUN_BUILD_PACKAGES_PATH/arvados-workbench-extras/arvados-workbench-upgrade.sh=/usr/local/bin/arvados-workbench-upgrade.sh")
703 if [[ "$DEBUG" != 0 ]]; then
705 echo "${COMMAND_ARR[@]}"
709 FPM_RESULTS=$("${COMMAND_ARR[@]}")
711 fpm_verify_and_scp $FPM_EXIT_CODE $FPM_RESULTS
713 # Workbench package build done
715 # Finally, publish the packages, if necessary
716 if [[ "$UPLOAD" != 0 && "$CALL_FREIGHT" != 0 ]]; then
717 ssh -p2222 $SCPUSER@$SCPHOST -t bash - <<EOF
718 if [ -n "\$(find -name "$FPM_OUTDIR/*.$FORMAT" -print -quit)" ]; then
719 cd "$FPM_OUTDIR" && $REPO_UPDATE_CMD
723 if [[ "$UPLOAD" != 0 ]]; then
724 echo "No new packages generated. No freight run necessary."
728 # clean up temporary GOPATH