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

Configurable sh -l (login shell) for command execution #9

Open
morkeleb opened this issue Oct 31, 2013 · 10 comments
Open

Configurable sh -l (login shell) for command execution #9

morkeleb opened this issue Oct 31, 2013 · 10 comments

Comments

@morkeleb
Copy link

I wanted to set up a custom script to ensure a specific ruby version and run my ruby tests.
However, when the scripts are run there are no bash variables imported.

So after a while I figure out I could do something similar to this:

bash --login -c "rvm use 1.9.3; bundle exec rspec"

If the strider-custom.json could also contain a shell arguments and shell option that could be used in process I'm free to choose my own shell and thus be able to import variables based on the user running strider. Making it much easier to start using Strider with other languages.

example:

{
  "command": 'bash',
  "args": ['-x', '-c', '--login', command]
  "prepare": "echo executed prepare statement!",
  "test": "echo executed deploy statement!",
  "deploy": "echo deploy && git push heroku master --force"
}

In theory this could also open up for use with other environments such as powershell on Windows.

@niallo
Copy link
Member

niallo commented Oct 31, 2013

We don't stop you from using your own shell, you can always spawn it yourself.

E.g. your command itself could be "/bin/sh -l -c foo"

Test and deploy scripts shouldn't really depend on the presence of bash variables on your particular machine. We could look into making login shell configurable though (e.g. /bin/sh -l -c rather than /bin/sh -c)

@morkeleb
Copy link
Author

morkeleb commented Nov 1, 2013

I might not have been entirely clear. I run rvm using --login as its own command right now, so things are working.

Configurable is what I'm looking for.

Unfortunately RVM requires all sorts of functions and paths set, and currently is one of the easiest ways to have a linux server configured for ruby. With an option for configuring login I can keep my custom scripts a lot more readable.

@niallo
Copy link
Member

niallo commented Nov 1, 2013

Ok, I understand. I updated the title of the issue to reflect that.

On another note - how is Ruby working for you with Strider? We'd love to have a strider-ruby plugin, which might make more sense for 80% of cases, rather than strider-custom. Similar to what we have for Node and Python today.

What do you think?

@morkeleb
Copy link
Author

morkeleb commented Nov 1, 2013

it works great execpt that I have to use the login. This is what my config looks like:

{
  "prepare": "bash --login -c \"rvm use 1.9.3; bundle install\"",
  "test": "bash --login -c \"rvm use 1.9.3; bundle exec rspec\" && karma start --single-run"
}

which runs all my rspec tests using rspec and then if that works it runs all my jasmine tests using karma.

Native plugin would be nice, especially if it can "auto detect" which types of tests to run. But that means tackling the whole rvm issue. Having rvm support "built in" would be nice since it would allow specifying different ruby versions per project, but its heavily dependent on the users profile.

So far, except for some minor gotchas strider has been nice to work with. I find it easier to set up than Jenkins. Specially since the github integration is taken care of already. I think there is a niche for building using nodejs, I hope strider manages to fill it :)

@niallo
Copy link
Member

niallo commented Nov 2, 2013

I'm glad you find Strider nice! It looks like you're on 1.3.5 (latest stable).

We're finishing up 1.4.0 which greatly improves strider-custom (in addition to supporting bitbucket, github enterprise, pull requests and branches). If you'd like to take it for a spin, try cloning HEAD of the main strider repo and running on the master branch.

You might like it :)

@morkeleb
Copy link
Author

morkeleb commented Nov 2, 2013

I just installed HEAD from the master branch. I quickly ran into some bugs that prevent me from trying things out. I added them as separate issues, I hope that helps.

@faraazkhan
Copy link

+1 for the native ruby plugin

@filipechagas
Copy link

+1
I have database and some other app info configured using environment vars.
Using the bash --login -c approach, I have to export the vars, inline, every single command line,

@knownasilya
Copy link
Member

Is this issue still present?

@knownasilya
Copy link
Member

There is not an option to select a shell, feel free to add additional shells. There are no arguments though.

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

No branches or pull requests

5 participants