Merge branch '55838-remove-gem-install-bundler-from-docker-based-ruby-environments' into 'master'
Remove gem install bundler from Docker-based Ruby environments Closes #55838 See merge request gitlab-org/gitlab-ce!24093
This commit is contained in:
commit
a0a12ee5a1
12 changed files with 8 additions and 13 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Remove gem install bundler from Docker-based Ruby environments
|
||||
merge_request: 24093
|
||||
author: Takuya Noguchi
|
||||
type: other
|
|
@ -13,7 +13,7 @@ POST /lint
|
|||
| `content` | string | yes | the .gitlab-ci.yaml content|
|
||||
|
||||
```bash
|
||||
curl --header "Content-Type: application/json" https://gitlab.example.com/api/v4/ci/lint --data '{"content": "{ \"image\": \"ruby:2.1\", \"services\": [\"postgres\"], \"before_script\": [\"gem install bundler\", \"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}'
|
||||
curl --header "Content-Type: application/json" https://gitlab.example.com/api/v4/ci/lint --data '{"content": "{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}'
|
||||
```
|
||||
|
||||
Be sure to copy paste the exact contents of `.gitlab-ci.yml` as YAML is very picky about indentation and spaces.
|
||||
|
|
|
@ -120,6 +120,6 @@ Example response:
|
|||
```json
|
||||
{
|
||||
"name": "Ruby",
|
||||
"content": "# This file is a template, and might need editing before it works on your project.\n# Official language image. Look for the different tagged releases at:\n# https://hub.docker.com/r/library/ruby/tags/\nimage: \"ruby:2.3\"\n\n# Pick zero or more services to be used on all builds.\n# Only needed when using a docker container to run your tests in.\n# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-service\nservices:\n - mysql:latest\n - redis:latest\n - postgres:latest\n\nvariables:\n POSTGRES_DB: database_name\n\n# Cache gems in between builds\ncache:\n paths:\n - vendor/ruby\n\n# This is a basic example for a gem or script which doesn't use\n# services such as redis or postgres\nbefore_script:\n - ruby -v # Print out ruby version for debugging\n # Uncomment next line if your rails app needs a JS runtime:\n # - apt-get update -q && apt-get install nodejs -yqq\n - gem install bundler --no-document # Bundler is not installed with the image\n - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby\n\n# Optional - Delete if not using `rubocop`\nrubocop:\n script:\n - rubocop\n\nrspec:\n script:\n - rspec spec\n\nrails:\n variables:\n DATABASE_URL: \"postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB\"\n script:\n - bundle exec rake db:migrate\n - bundle exec rake db:seed\n - bundle exec rake test\n"
|
||||
"content": "# This file is a template, and might need editing before it works on your project.\n# Official language image. Look for the different tagged releases at:\n# https://hub.docker.com/r/library/ruby/tags/\nimage: \"ruby:2.5\"\n\n# Pick zero or more services to be used on all builds.\n# Only needed when using a docker container to run your tests in.\n# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service\nservices:\n - mysql:latest\n - redis:latest\n - postgres:latest\n\nvariables:\n POSTGRES_DB: database_name\n\n# Cache gems in between builds\ncache:\n paths:\n - vendor/ruby\n\n# This is a basic example for a gem or script which doesn't use\n# services such as redis or postgres\nbefore_script:\n - ruby -v # Print out ruby version for debugging\n # Uncomment next line if your rails app needs a JS runtime:\n # - apt-get update -q && apt-get install nodejs -yqq\n - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby\n\n# Optional - Delete if not using `rubocop`\nrubocop:\n script:\n - rubocop\n\nrspec:\n script:\n - rspec spec\n\nrails:\n variables:\n DATABASE_URL: \"postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB\"\n script:\n - rails db:migrate\n - rails db:seed\n - rails test\n\n# This deploy job uses a simple deploy flow to Heroku, other providers, e.g. AWS Elastic Beanstalk\n# are supported too: https://github.com/travis-ci/dpl\ndeploy:\n type: deploy\n environment: production\n script:\n - gem install dpl\n - dpl --provider=heroku --app=$HEROKU_APP_NAME --api-key=$HEROKU_PRODUCTION_KEY\n"
|
||||
}
|
||||
```
|
||||
|
|
|
@ -300,7 +300,6 @@ cache:
|
|||
|
||||
before_script:
|
||||
- ruby -v # Print out ruby version for debugging
|
||||
- gem install bundler --no-document # Bundler is not installed with the image
|
||||
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
||||
|
||||
rspec:
|
||||
|
|
|
@ -24,7 +24,6 @@ before_script:
|
|||
- ruby -v # Print out ruby version for debugging
|
||||
# Uncomment next line if your rails app needs a JS runtime:
|
||||
# - apt-get update -q && apt-get install nodejs -yqq
|
||||
- gem install bundler --no-document # Bundler is not installed with the image
|
||||
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
||||
|
||||
# Optional - Delete if not using `rubocop`
|
||||
|
|
|
@ -51,7 +51,6 @@ describe Projects::Ci::LintsController do
|
|||
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
||||
- ruby -v
|
||||
- which ruby
|
||||
- gem install bundler --no-ri --no-rdoc
|
||||
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
||||
HEREDOC
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@ before_script:
|
|||
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
||||
- ruby -v
|
||||
- which ruby
|
||||
- gem install bundler --no-ri --no-rdoc
|
||||
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
||||
|
||||
rspec:
|
||||
|
|
|
@ -44,7 +44,6 @@ describe Gitlab::Ci::Config::External::File::Local do
|
|||
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
||||
- ruby -v
|
||||
- which ruby
|
||||
- gem install bundler --no-ri --no-rdoc
|
||||
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
||||
HEREDOC
|
||||
end
|
||||
|
|
|
@ -11,7 +11,6 @@ describe Gitlab::Ci::Config::External::File::Remote do
|
|||
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
||||
- ruby -v
|
||||
- which ruby
|
||||
- gem install bundler --no-ri --no-rdoc
|
||||
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
||||
HEREDOC
|
||||
end
|
||||
|
|
|
@ -51,7 +51,6 @@ describe Gitlab::Ci::Config::External::Processor do
|
|||
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
||||
- ruby -v
|
||||
- which ruby
|
||||
- gem install bundler --no-ri --no-rdoc
|
||||
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
||||
|
||||
rspec:
|
||||
|
@ -86,7 +85,6 @@ describe Gitlab::Ci::Config::External::Processor do
|
|||
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
||||
- ruby -v
|
||||
- which ruby
|
||||
- gem install bundler --no-ri --no-rdoc
|
||||
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
||||
HEREDOC
|
||||
end
|
||||
|
|
|
@ -170,7 +170,6 @@ describe Gitlab::Ci::Config do
|
|||
before_script_values = [
|
||||
"apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs", "ruby -v",
|
||||
"which ruby",
|
||||
"gem install bundler --no-ri --no-rdoc",
|
||||
"bundle install --jobs $(nproc) \"${FLAGS[@]}\""
|
||||
]
|
||||
variables = {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
image: ruby:2.1
|
||||
image: ruby:2.6
|
||||
services:
|
||||
- postgres
|
||||
|
||||
before_script:
|
||||
- gem install bundler
|
||||
- bundle install
|
||||
- bundle exec rake db:create
|
||||
|
||||
|
|
Loading…
Reference in a new issue