diff --git a/.travis.yml b/.travis.yml index 28bc3db39..513547a47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ rvm: 2.2.4 env: global: - USE_TESTING_TIMEOUTS: "true" - - OPENSTUDIO_VERSION=2.8.0 OPENSTUDIO_VERSION_SHA=55665635f0 + - OPENSTUDIO_VERSION=2.8.1 OPENSTUDIO_VERSION_SHA=809785b98f OPENSTUDIO_VERSION_EXT=-rc1 - DOCKER_COMPOSE_VERSION=1.21.1 gemfile: @@ -56,13 +56,14 @@ jobs: - BUILD_TYPE=docker before_script: # remove the .git in the .dockerignore so coverage can be reported correctly to coveralls + - export OPENSTUDIO_TAG=$(ruby -e "load 'server/app/lib/openstudio_server/version.rb'; print OpenstudioServer::VERSION+OpenstudioServer::VERSION_EXT") - sed -i -E "s/.git//g" .dockerignore - docker volume create --name=osdata - docker images --all - docker --version - docker-compose --version - docker-compose -f docker-compose.test.yml pull - - docker-compose -f docker-compose.test.yml build + - docker-compose -f docker-compose.test.yml build --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_TAG script: - docker-compose -f docker-compose.test.yml run web && docker-compose stop after_script: @@ -80,11 +81,12 @@ jobs: env: - BUILD_TYPE=docker before_script: + - export OPENSTUDIO_TAG=$(ruby -e "load 'server/app/lib/openstudio_server/version.rb'; print OpenstudioServer::VERSION+OpenstudioServer::VERSION_EXT") - docker images --all - docker --version - docker-compose --version - docker volume create --name=osdata - - docker-compose build web + - docker-compose build --build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_TAG web - docker-compose build rserve script: ./docker/deployment/scripts/deploy_docker.sh diff --git a/Dockerfile b/Dockerfile index 017dd9e74..674a39ef1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ # TO_BUILD_AND_RUN: docker-compose up # NOTES: Currently this is one big dockerfile and non-optimal. - -ARG OPENSTUDIO_VERSION=2.8.0 +#may include suffix +ARG OPENSTUDIO_VERSION FROM nrel/openstudio:$OPENSTUDIO_VERSION as base MAINTAINER Nicholas Long nicholas.long@nrel.gov diff --git a/appveyor.yml b/appveyor.yml index 4f74f486f..7bcab27ac 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,8 +2,9 @@ version: 1.0.{build}-{branch} environment: USE_TESTING_TIMEOUTS: "true" - OPENSTUDIO_VERSION: 2.8.0 - OPENSTUDIO_VERSION_SHA: 55665635f0 + OPENSTUDIO_VERSION: 2.8.1 + OPENSTUDIO_VERSION_SHA: 809785b98f + OPENSTUDIO_VERSION_EXT: -rc1 OPENSTUDIO_TEST_EXE: C:\projects\openstudio\bin\openstudio.exe diff --git a/bin/openstudio_meta b/bin/openstudio_meta index 01444ff5e..ad13bdf13 100755 --- a/bin/openstudio_meta +++ b/bin/openstudio_meta @@ -344,7 +344,7 @@ class InstallGems rake_bin = File.absolute_path('./../gems/bin/rake/') sys_cmds = [] - sys_cmds << "#{$ruby_path} #{RbConfig::CONFIG['prefix']}/bin/gem install --no-env-shebang bundler -v 1.14.4" + sys_cmds << "#{$ruby_path} #{RbConfig::CONFIG['prefix']}/bin/gem install --no-env-shebang bundler -v 1.17.1" if /darwin/.match(RUBY_PLATFORM) sys_cmds << "#{$ruby_path} #{bundler_bin} config build.nokogiri --use-system-libraries --with-xml2-lib=/usr/lib --with-xml2-include=/usr/include" end diff --git a/ci/appveyor/setup.cmd b/ci/appveyor/setup.cmd index 8001ee7ad..81765f4ee 100644 --- a/ci/appveyor/setup.cmd +++ b/ci/appveyor/setup.cmd @@ -1,7 +1,7 @@ set PATH=C:\Program Files\Git\mingw64\bin;C:\projects\openstudio\bin;%PATH% -echo Downloading and Installing OpenStudio (%OPENSTUDIO_VERSION%.%OPENSTUDIO_VERSION_SHA%) -curl -SLO --insecure https://s3.amazonaws.com/openstudio-builds/%OPENSTUDIO_VERSION%/OpenStudio-%OPENSTUDIO_VERSION%.%OPENSTUDIO_VERSION_SHA%-Windows.exe -OpenStudio-%OPENSTUDIO_VERSION%.%OPENSTUDIO_VERSION_SHA%-Windows.exe --script ci/appveyor/install-windows.qs +echo Downloading and Installing OpenStudio (%OPENSTUDIO_VERSION%%OPENSTUDIO_VERSION_EXT%.%OPENSTUDIO_VERSION_SHA%) +curl -SLO --insecure https://s3.amazonaws.com/openstudio-builds/%OPENSTUDIO_VERSION%/OpenStudio-%OPENSTUDIO_VERSION%%OPENSTUDIO_VERSION_EXT%.%OPENSTUDIO_VERSION_SHA%-Windows.exe +OpenStudio-%OPENSTUDIO_VERSION%%OPENSTUDIO_VERSION_EXT%.%OPENSTUDIO_VERSION_SHA%-Windows.exe --script ci/appveyor/install-windows.qs move C:\openstudio C:\projects\openstudio dir C:\projects\openstudio dir C:\projects\openstudio\Ruby diff --git a/ci/travis/setup.sh b/ci/travis/setup.sh index 93605a5b1..9a3ce7837 100755 --- a/ci/travis/setup.sh +++ b/ci/travis/setup.sh @@ -24,8 +24,8 @@ else cp mongodb-osx-x86_64-3.4.18/bin/* /usr/local/bin/ # Install openstudio -- Use the install script that is in this repo now, the one on OpenStudio/develop has changed - curl -SLO --insecure https://s3.amazonaws.com/openstudio-builds/$OPENSTUDIO_VERSION/OpenStudio-$OPENSTUDIO_VERSION.$OPENSTUDIO_VERSION_SHA-Darwin.zip - unzip OpenStudio-$OPENSTUDIO_VERSION.$OPENSTUDIO_VERSION_SHA-Darwin.zip + curl -SLO --insecure https://s3.amazonaws.com/openstudio-builds/$OPENSTUDIO_VERSION/OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_VERSION_SHA-Darwin.zip + unzip OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_VERSION_SHA-Darwin.zip sed -i -e "s|REPLACEME|$HOME/openstudio|" ci/travis/install-mac.qs rm -rf $HOME/openstudio # Will install into $HOME/openstudio and RUBYLIB will be $HOME/openstudio/Ruby @@ -37,7 +37,8 @@ else sudo apt-get update sudo apt-get install -y pv tree mkdir -p reports/rspec - sudo ./docker/deployment/scripts/install_openstudio.sh $OPENSTUDIO_VERSION $OPENSTUDIO_VERSION_SHA + # AP: this appears to only be used for Travis/Linux so we should move it out of the docker/deployment/scripts dir + sudo ./docker/deployment/scripts/install_openstudio.sh $OPENSTUDIO_VERSION $OPENSTUDIO_VERSION_SHA $OPENSTUDIO_VERSION_EXT fi ruby "${TRAVIS_BUILD_DIR}/bin/openstudio_meta" install_gems --with_test_develop --debug --verbose --use_cached_gems diff --git a/docker/deployment/scripts/deploy_docker.sh b/docker/deployment/scripts/deploy_docker.sh index 9d1b0fcf0..2963963b7 100755 --- a/docker/deployment/scripts/deploy_docker.sh +++ b/docker/deployment/scripts/deploy_docker.sh @@ -5,7 +5,7 @@ if [ "${TRAVIS_BRANCH}" == "develop" ]; then IMAGETAG=develop elif [ "${TRAVIS_BRANCH}" == "nrcan-master" ]; then # NRCAN is still using pre 2.4.1 version of Server. This will break when they upgrade. - IMAGETAG="$(ruby -e "load 'server/lib/openstudio_server/version.rb'; print OpenstudioServer::VERSION+OpenstudioServer::VERSION_EXT")-nrcan" + IMAGETAG="$(ruby -e "load 'server/lib/openstudio_server/version.rb'; print OpenstudioServer::VERSION")-nrcan" elif [ "${TRAVIS_BRANCH}" == "master" ]; then # Retrieve the version number from rails IMAGETAG="$(ruby -e "load 'server/app/lib/openstudio_server/version.rb'; print OpenstudioServer::VERSION+OpenstudioServer::VERSION_EXT")" diff --git a/docker/deployment/scripts/install_openstudio.sh b/docker/deployment/scripts/install_openstudio.sh index 643cc44d2..5172a1d70 100755 --- a/docker/deployment/scripts/install_openstudio.sh +++ b/docker/deployment/scripts/install_openstudio.sh @@ -7,12 +7,15 @@ OPENSTUDIO_VERSION=$1 OPENSTUDIO_SHA=$2 +OPENSTUDIO_VERSION_EXT=$3 if [ ! -z ${OPENSTUDIO_VERSION} ] && [ ! -z ${OPENSTUDIO_SHA} ]; then - echo "Installing OpenStudio ${OPENSTUDIO_VERSION}.${OPENSTUDIO_SHA}" + # OPENSTUDIO_VERSION_EXT may be empty + OPENSTUDIO_DOWNLOAD_FILENAME=OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Linux.deb + + echo "Installing OpenStudio ${OPENSTUDIO_DOWNLOAD_FILENAME}" OPENSTUDIO_DOWNLOAD_BASE_URL=https://s3.amazonaws.com/openstudio-builds/$OPENSTUDIO_VERSION - OPENSTUDIO_DOWNLOAD_FILENAME=OpenStudio-$OPENSTUDIO_VERSION.$OPENSTUDIO_SHA-Linux.deb OPENSTUDIO_DOWNLOAD_URL=$OPENSTUDIO_DOWNLOAD_BASE_URL/$OPENSTUDIO_DOWNLOAD_FILENAME # Install gdebi, then download and install OpenStudio, then clean up. @@ -29,6 +32,6 @@ if [ ! -z ${OPENSTUDIO_VERSION} ] && [ ! -z ${OPENSTUDIO_SHA} ]; then && rm -rf /usr/SketchUpPlugin \ && rm -rf /var/lib/apt/lists/* else - echo "Must pass in the OpenStudio version and sha to be installed (e.g. install_openstudio.sh 2.4.0 f58a3e1808)" + echo "Must pass in the OpenStudio version, and sha to be installed (e.g. install_openstudio.sh 2.4.0 f58a3e1808)" exit 9 fi diff --git a/server/app/jobs/dj_jobs/run_simulate_data_point.rb b/server/app/jobs/dj_jobs/run_simulate_data_point.rb index fd38910cf..8aa54ae72 100644 --- a/server/app/jobs/dj_jobs/run_simulate_data_point.rb +++ b/server/app/jobs/dj_jobs/run_simulate_data_point.rb @@ -195,8 +195,22 @@ def perform cmd = "#{Utility::Oss.oscli_cmd(@sim_logger)} --verbose run --workflow '#{osw_path}' --debug" process_log = File.join(simulation_dir, 'oscli_simulation.log') @sim_logger.info "Running workflow using cmd #{cmd} and writing log to #{process_log}" - - pid = Process.spawn({ 'BUNDLE_GEMFILE' => nil, 'BUNDLE_PATH' => nil }, cmd, [:err, :out] => [process_log, 'w']) + oscli_env_unset = { + 'BUNDLE_GEMFILE' => nil, + 'BUNDLE_PATH' => nil, + 'RUBYLIB' => nil, + 'RUBYOPT' => nil, + 'BUNDLE_BIN_PATH' => nil, + 'BUNDLER_VERSION' => nil, + 'BUNDLER_ORIG_PATH' => nil, + 'BUNDLER_ORIG_MANPATH' => nil, + 'GEM_PATH' => nil, + 'GEM_HOME' => nil, + 'BUNDLE_GEMFILE' => nil, + 'BUNDLE_PATH' => nil, + 'BUNDLE_WITHOUT' => nil + } + pid = Process.spawn(oscli_env_unset, cmd, [:err, :out] => [process_log, 'w']) # timeout the process if it doesn't return in 4 hours Timeout.timeout(14400) do diff --git a/server/app/lib/openstudio_server/version.rb b/server/app/lib/openstudio_server/version.rb index bce720acb..af295fd10 100644 --- a/server/app/lib/openstudio_server/version.rb +++ b/server/app/lib/openstudio_server/version.rb @@ -36,6 +36,7 @@ module OpenstudioServer VERSION = '2.8.1'.freeze # format should be ^.*\-{1}[a-z]+[0-9]+ - # for example: -rc0, -beta6, -customusecase0 - VERSION_EXT = '-rc0'.freeze # with preceding - or + + # for example: -rc1, -beta6, -customusecase0 + VERSION_EXT = '-rc1'.freeze # with preceding - or + + OS_SHA = '809785b98f' end diff --git a/server/spec/features/dj_run_simulation_data_point_spec.rb b/server/spec/features/dj_run_simulation_data_point_spec.rb index 81fe526c4..c062115f8 100644 --- a/server/spec/features/dj_run_simulation_data_point_spec.rb +++ b/server/spec/features/dj_run_simulation_data_point_spec.rb @@ -163,6 +163,10 @@ a = RestClient.get "http://#{host}/data_points/#{datapoint_id}.json" a = JSON.parse(a, symbolize_names: true) puts a + + # l = RestClient.get "http://#{host}/data_points/#{datapoint_id}/download_result_file?filename=#{datapoint_id}.log" + # expect(l).to eq('hack to inspect oscli output') + expect(a[:data_point][:name]).to eq('Test Datapoint') expect(a[:data_point][:status_message]).to eq('completed normal') expect(a[:data_point][:status]).to eq('completed') diff --git a/spec/tests/openstudio_meta_spec.rb b/spec/tests/openstudio_meta_spec.rb index 25786c656..dd8ab5b68 100644 --- a/spec/tests/openstudio_meta_spec.rb +++ b/spec/tests/openstudio_meta_spec.rb @@ -250,6 +250,8 @@ class LocalRspecTest end end data_points.each do |data_point| + # l = RestClient.get "http://localhost:8080/data_points/#{data_point[:_id]}/download_result_file?filename=#{data_point[:_id]}.log" + # expect(l).to eq('hack to view oscli output') a = RestClient.get "http://localhost:8080/data_points/#{data_point[:_id]}.json" a = JSON.parse(a, symbolize_names: true) expect(a[:data_point][:status_message]).to eq('completed normal')