Shippable / support

Shippable SaaS customers can report issues and feature requests in this repository
101 stars 28 forks source link

A YAML syntax to run as non-root easily #4581

Open junaruga opened 6 years ago

junaruga commented 6 years ago

Description of your issue:

Thank you for providing this great CI service. I want to propose to add a YAML syntax to run as non-root easily.

Right now there is a way to run as non-root user as you know [1]. But it is not convenient seeing the case [2] and example code [3]

I think that most of users of Shippable has experience for Travis CI. The the difference of the default behavior for the running user is painful point to use Shippable.

On Travis, the running user is travis.

$ id
uid=2000(travis) gid=2000(travis) groups=2000(travis),999(docker)

On Shippable, the running user is root.

So, I want to propose 2 possible solutions.

user: foo

shippable.yml

user: foo <- optional element. default: root

If the user: foo is specified, kind of [3] is executed internally, keeping the specified environment variables (env element).

non-root: true/false

shippable.yml

non-root: true/false <- optional element. default: false

or

root: true/false <- optional element. default: true

[1] http://docs.shippable.com/ci/non-root/ [2] https://github.com/Shippable/support/issues/4076 [3] https://github.com/ambarish2012/maven-samples/blob/master/shippable.yml

junaruga commented 6 years ago

Here is what I am doing to run on non-root. Because PostgreSQL command initdb needs non-root user in the process bundle exec rake test.

https://github.com/junaruga/ruby-pg/commit/a038730 https://github.com/junaruga/ruby-pg/blob/feature/ci-64bit-shippable-demo/shippable.yml https://app.shippable.com/github/junaruga/ruby-pg/runs/20/1/console The build is success. But the way is a little tricky.

    - | 
      su "${CI_USER}" - <<EOF
      bundle install --path vendor/bundle
      bundle exec rake compile
      bundle exec rake test
      EOF 

I want to do like this.

    - bundle install --path vendor/bundle
    - bundle exec rake compile
    - bundle exec rake test