Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RethinkDB addon (WIP) #676

Merged
merged 7 commits into from
Jul 20, 2016
Merged

RethinkDB addon (WIP) #676

merged 7 commits into from
Jul 20, 2016

Conversation

danielmewes
Copy link
Contributor

This adds a RethinkDB addon.

The supplied test is currently failing as follows, and I'm not sure what that means:

Failures:

  1) Travis::Build::Addons::Rethinkdb 
     Failure/Error: raise TaintedOutput if !ignore_taint && script.tainted?

     Travis::Shell::Generator::TaintedOutput:
       Travis::Shell::Generator::TaintedOutput
     # ./lib/travis/shell/generator.rb:16:in `generate'
     # ./lib/travis/shell.rb:10:in `generate'
     # spec/spec_helpers/sexp.rb:55:in `store_example'
     # ./spec/build/addons/rethinkdb_spec.rb:12:in `block (2 levels) in <top (required)>'

  2) Travis::Build::Addons::Rethinkdb behaves like compiled script can be compiled
     Failure/Error: expect { subject }.to_not raise_error

       expected no Exception, got #<Travis::Shell::Generator::TaintedOutput: Travis::Shell::Generator::TaintedOutput> with backtrace:
         # ./lib/travis/shell/generator.rb:16:in `generate'
         # ./lib/travis/shell.rb:10:in `generate'
         # ./lib/travis/build/script.rb:72:in `compile'
         # spec/build/script/shared/script.rb:7:in `block (2 levels) in <top (required)>'
         # spec/build/script/shared/script.rb:14:in `block (3 levels) in <top (required)>'
         # spec/build/script/shared/script.rb:14:in `block (2 levels) in <top (required)>'
     Shared Example Group: "compiled script" called from ./spec/build/addons/rethinkdb_spec.rb:14
     # spec/build/script/shared/script.rb:14:in `block (2 levels) in <top (required)>'

  3) Travis::Build::Addons::Rethinkdb behaves like compiled script includes the expected travis_cmds
     Failure/Error: raise TaintedOutput if !ignore_taint && script.tainted?

     Travis::Shell::Generator::TaintedOutput:
       Travis::Shell::Generator::TaintedOutput
     Shared Example Group: "compiled script" called from ./spec/build/addons/rethinkdb_spec.rb:14
     # ./lib/travis/shell/generator.rb:16:in `generate'
     # ./lib/travis/shell.rb:10:in `generate'
     # ./lib/travis/build/script.rb:72:in `compile'
     # spec/build/script/shared/script.rb:7:in `block (2 levels) in <top (required)>'
     # spec/build/script/shared/script.rb:25:in `block (3 levels) in <top (required)>'
     # spec/build/script/shared/script.rb:24:in `each'
     # spec/build/script/shared/script.rb:24:in `block (2 levels) in <top (required)>'

Finished in 16.45 seconds (files took 1.77 seconds to load)
3090 examples, 3 failures, 11 pending

Failed examples:

rspec ./spec/build/addons/rethinkdb_spec.rb:12 # Travis::Build::Addons::Rethinkdb 
rspec ./spec/build/addons/rethinkdb_spec.rb[1:2:1] # Travis::Build::Addons::Rethinkdb behaves like compiled script can be compiled
rspec ./spec/build/addons/rethinkdb_spec.rb[1:2:3] # Travis::Build::Addons::Rethinkdb behaves like compiled script includes the expected travis_cmds

Mentioning @joshk who suggested opening the pull request despite the remaining failures.

def after_prepare
sh.fold 'rethinkdb' do
sh.echo "Installing RethinkDB version #{rethinkdb_version}", ansi: :yellow
sh.cmd "service rethinkdb stop", sudo: true

This comment was marked as spam.

@BanzaiMan
Copy link
Contributor

Not sure where the taintedness is coming into play, but with my fixes, that is not a problem when I run the specs locally.

@BanzaiMan
Copy link
Contributor

A possible fix for these issues: https://gist.github.com/BanzaiMan/20cc01553a1948236138

@danielmewes
Copy link
Contributor Author

Thanks for the feedback and proposed fixes @BanzaiMan . I'll update the PR shortly.

Do you have any suggestions or example code for how to check for the operating system?

@BanzaiMan
Copy link
Contributor

@danielmewes $TRAVIS_OS_NAME should be set to either linux or osx by the time this addon gets to run.

@danielmewes
Copy link
Contributor Author

I applied your fixes @BanzaiMan and the tests are now passing. However I couldn't get the OS check to work. I tried checking ENV['TRAVIS_OS_NAME'], but it was always empty during testing. Any ideas?

@BanzaiMan
Copy link
Contributor

@danielmewes How are you testing it?

@danielmewes
Copy link
Contributor Author

@BanzaiMan I was using the Vagrant file and running bundle exec rspec spec as described in the README https://github.com/travis-ci/travis-build/blob/master/README.md .


def after_prepare
sh.fold 'rethinkdb' do
#if ENV['TRAVIS_OS_NAME'] != 'linux'

This comment was marked as spam.

@BanzaiMan
Copy link
Contributor

@danielmewes Do you need help?

@danielmewes
Copy link
Contributor Author

@BanzaiMan Thanks for your comments. Picking this up again now...

@danielmewes
Copy link
Contributor Author

@BanzaiMan Updated as suggested. This seems to be working now.

@hueniverse
Copy link

What's the issue here? What needs to happen to get this merged? Who is this blocked with?


def after_prepare
sh.fold 'rethinkdb' do
sh.if "ENV['TRAVIS_OS_NAME'] != 'linux'" do

This comment was marked as spam.

This comment was marked as spam.

@hueniverse
Copy link

@danielmewes @BanzaiMan Who are we waiting on at this point? I am not sure if more changes are needed from @danielmewes or if @BanzaiMan needs to help fix something. Either way, this was supposed to be a quick solution back in March. It's now June...

Thanks!

@danielmewes
Copy link
Contributor Author

Thanks for the explanation @BanzaiMan .
I've updated the OS check.

RethinkDB works on Mac, but the setup procedure is entirely different and I don't want to deal with that now.

BanzaiMan added a commit that referenced this pull request Jun 2, 2016
BanzaiMan added a commit that referenced this pull request Jun 2, 2016
@BanzaiMan
Copy link
Contributor

@danielmewes Thanks for the update. I ran a quick test to install 2.3, but it is failing: https://staging.travis-ci.org/BanzaiMan/travis_staging_test/builds/493918#L143-L166

Installing RethinkDB version 2.3
rethinkdb: unrecognized service
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.rvZe4OH5c8 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d//apt.postgresql.org.gpg --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x3A8F2399
gpg: requesting key 3A8F2399 from hkp server keyserver.ubuntu.com
gpg: key 3A8F2399: public key "RethinkDB Packaging <packaging@rethinkdb.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
W: Failed to fetch http://download.rethinkdb.com/apt/dists/precise/Release  Unable to find expected entry 'main/source/Sources' in Release file (Wrong sources.list entry or malformed file)
E: Some index files failed to download. They have been ignored, or old ones used instead.
$ sudo apt-get install -y -o Dpkg::Options::='--force-confnew' rethinkdb=$package_version
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package rethinkdb
Installing RethinkDB default instance configuration
cp: cannot stat `/etc/rethinkdb/default.conf.sample': No such file or directory
Starting RethinkDB v2.3
$ sudo service rethinkdb start
rethinkdb: unrecognized service
$ rethinkdb --version
/home/travis/build.sh: line 45: rethinkdb: command not found

Could you review these messages?

Also, do you want the build to fail immediately if installation fails for one reason or another?

@danielmewes
Copy link
Contributor Author

Ah, I think this is the same issue as travis-ci/travis-ci#4772 . I'll change the add-apt-repository line...

module Build
class Addons
class Rethinkdb < Base
SUPER_USER_SAFE = true

This comment was marked as spam.

@hueniverse
Copy link

@BanzaiMan does this mean this will not work with the new infrastructure?

@danielmewes requiring sudo makes this a lot less useful because it blocks it out of the new infrastructure. Goal is to make using rethink as easy as all the other built-in dbs available in Travis.

@danielmewes
Copy link
Contributor Author

@BanzaiMan Thanks for the comments. I'll look into those things.

@hueniverse Both the MariaDB (which I based this on) and PostgreSQL addons also require sudo on the destination system. Do you have an example for a DB addon that works without it that I could look at?

@BanzaiMan
Copy link
Contributor

If the only requirement is sudo, you can do stuff in the configure phase instead.

@BanzaiMan
Copy link
Contributor

Scratch that. after_prepare also has sudo (and you are using it).

@hueniverse
Copy link

@BanzaiMan So we are good as is with the sudo requirements?

@BanzaiMan
Copy link
Contributor

@hueniverse Yes, I think so. The version specification still needs to be fixed.

@BanzaiMan
Copy link
Contributor

Also a PR to docs, please.

@hueniverse
Copy link

@BanzaiMan Can you point me where those docs are and a similar section to based this on?

@BanzaiMan
Copy link
Contributor

BanzaiMan commented Jun 27, 2016

@hueniverse It should go into https://github.com/travis-ci/docs-travis-ci-com/blob/gh-pages/user/database-setup.md. (Which is rendered at https://docs.travis-ci.com/user/database-setup/). You can see similar sections (e.g., MariaDB) on that page.

@danielmewes
Copy link
Contributor Author

@BanzaiMan I fixed the SUPER_USER_SAFE line, the line for piping into /etc/apt/sources.list, and re-implemented how the RethinkDB package version is determined. It is now possible to set rethinkdb_version to any prefix of the target version, e.g. "2.3".
The script will then install the highest version with that prefix, e.g. "2.3.4~0precise".

@danielmewes
Copy link
Contributor Author

Documentation is coming.

@danielmewes
Copy link
Contributor Author

Documentation is in travis-ci/docs-travis-ci-com#673

@hueniverse
Copy link

@danielmewes you're my hero!

BanzaiMan added a commit that referenced this pull request Jul 20, 2016
@BanzaiMan
Copy link
Contributor

OK, this has been deployed to staging one more time.

@BanzaiMan
Copy link
Contributor

module Build
class Addons
class Rethinkdb < Base
SUPER_USER_SAFE = false

This comment was marked as spam.

@danielmewes
Copy link
Contributor Author

Thanks for testing and your comments @BanzaiMan . I turned SUPER_USER_SAFE back on.

@BanzaiMan BanzaiMan merged commit ed74f59 into travis-ci:master Jul 20, 2016
@BanzaiMan
Copy link
Contributor

Deployed to production now.

@danielmewes
Copy link
Contributor Author

Thanks again for your help in getting this into shape @BanzaiMan !

@hueniverse
Copy link

Thanks @BanzaiMan @danielmewes! Can't wait to try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants