Commit af3a73ef authored by Sean McGivern's avatar Sean McGivern

Merge branch 'switch-rails' into 'master'

Switch to Rails 5

Closes #14286 and #48991

See merge request gitlab-org/gitlab-ce!21492
parents 28e3a90b f6d368c7
...@@ -75,15 +75,15 @@ stages: ...@@ -75,15 +75,15 @@ stages:
- mysql:5.7 - mysql:5.7
- redis:alpine - redis:alpine
.rails5: &rails5 .rails4: &rails4
allow_failure: true allow_failure: false
only: except:
variables: variables:
- $CI_COMMIT_REF_NAME =~ /rails5/ - $CI_COMMIT_REF_NAME =~ /norails4/
- $RAILS5_ENABLED - $RAILS5_DISABLED
variables: variables:
BUNDLE_GEMFILE: "Gemfile.rails5" BUNDLE_GEMFILE: "Gemfile.rails4"
RAILS5: "true" RAILS5: "false"
# Skip all jobs except the ones that begin with 'docs/'. # Skip all jobs except the ones that begin with 'docs/'.
# Used for commits including ONLY documentation changes. # Used for commits including ONLY documentation changes.
...@@ -177,17 +177,17 @@ stages: ...@@ -177,17 +177,17 @@ stages:
<<: *rspec-metadata <<: *rspec-metadata
<<: *use-pg <<: *use-pg
.rspec-metadata-pg-rails5: &rspec-metadata-pg-rails5 .rspec-metadata-pg-rails4: &rspec-metadata-pg-rails4
<<: *rspec-metadata-pg <<: *rspec-metadata-pg
<<: *rails5 <<: *rails4
.rspec-metadata-mysql: &rspec-metadata-mysql .rspec-metadata-mysql: &rspec-metadata-mysql
<<: *rspec-metadata <<: *rspec-metadata
<<: *use-mysql <<: *use-mysql
.rspec-metadata-mysql-rails5: &rspec-metadata-mysql-rails5 .rspec-metadata-mysql-rails4: &rspec-metadata-mysql-rails4
<<: *rspec-metadata-mysql <<: *rspec-metadata-mysql
<<: *rails5 <<: *rails4
.only-canonical-masters: &only-canonical-masters .only-canonical-masters: &only-canonical-masters
only: only:
...@@ -429,7 +429,7 @@ setup-test-env: ...@@ -429,7 +429,7 @@ setup-test-env:
script: script:
- bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init'
- scripts/gitaly-test-build # Do not use 'bundle exec' here - scripts/gitaly-test-build # Do not use 'bundle exec' here
- BUNDLE_GEMFILE=Gemfile.rails5 bundle install $BUNDLE_INSTALL_FLAGS - BUNDLE_GEMFILE=Gemfile.rails4 bundle install $BUNDLE_INSTALL_FLAGS
artifacts: artifacts:
expire_in: 7d expire_in: 7d
paths: paths:
...@@ -521,67 +521,67 @@ rspec-mysql 27 30: *rspec-metadata-mysql ...@@ -521,67 +521,67 @@ rspec-mysql 27 30: *rspec-metadata-mysql
rspec-mysql 28 30: *rspec-metadata-mysql rspec-mysql 28 30: *rspec-metadata-mysql
rspec-mysql 29 30: *rspec-metadata-mysql rspec-mysql 29 30: *rspec-metadata-mysql
rspec-pg-rails5 0 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 0 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 1 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 1 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 2 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 2 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 3 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 3 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 4 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 4 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 5 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 5 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 6 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 6 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 7 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 7 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 8 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 8 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 9 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 9 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 10 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 10 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 11 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 11 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 12 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 12 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 13 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 13 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 14 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 14 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 15 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 15 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 16 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 16 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 17 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 17 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 18 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 18 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 19 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 19 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 20 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 20 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 21 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 21 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 22 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 22 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 23 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 23 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 24 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 24 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 25 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 25 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 26 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 26 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 27 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 27 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 28 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 28 30: *rspec-metadata-pg-rails4
rspec-pg-rails5 29 30: *rspec-metadata-pg-rails5 rspec-pg-rails4 29 30: *rspec-metadata-pg-rails4
rspec-mysql-rails5 0 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 0 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 1 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 1 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 2 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 2 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 3 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 3 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 4 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 4 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 5 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 5 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 6 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 6 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 7 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 7 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 8 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 8 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 9 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 9 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 10 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 10 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 11 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 11 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 12 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 12 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 13 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 13 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 14 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 14 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 15 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 15 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 16 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 16 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 17 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 17 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 18 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 18 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 19 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 19 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 20 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 20 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 21 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 21 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 22 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 22 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 23 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 23 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 24 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 24 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 25 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 25 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 26 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 26 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 27 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 27 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 28 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 28 30: *rspec-metadata-mysql-rails4
rspec-mysql-rails5 29 30: *rspec-metadata-mysql-rails5 rspec-mysql-rails4 29 30: *rspec-metadata-mysql-rails4
static-analysis: static-analysis:
<<: *dedicated-no-docs-no-db-pull-cache-job <<: *dedicated-no-docs-no-db-pull-cache-job
...@@ -627,11 +627,11 @@ downtime_check: ...@@ -627,11 +627,11 @@ downtime_check:
- /(^docs[\/-].*|.*-docs$)/ - /(^docs[\/-].*|.*-docs$)/
- /(^qa[\/-].*|.*-qa$)/ - /(^qa[\/-].*|.*-qa$)/
rails5_gemfile_lock_check: rails4_gemfile_lock_check:
<<: *dedicated-no-docs-no-db-pull-cache-job <<: *dedicated-no-docs-no-db-pull-cache-job
<<: *except-docs-and-qa <<: *except-docs-and-qa
script: script:
- scripts/rails5-gemfile-lock-check - scripts/rails4-gemfile-lock-check
ee_compat_check: ee_compat_check:
<<: *rake-exec <<: *rake-exec
......
# --- Special code for migrating to Rails 5.0 --- # --- Special code for migrating to Rails 5.0 ---
def rails5? def rails5?
%w[1 true].include?(ENV["RAILS5"]) !%w[0 false].include?(ENV["RAILS5"])
end end
gem_versions = {} gem_versions = {}
......
...@@ -4,41 +4,44 @@ GEM ...@@ -4,41 +4,44 @@ GEM
RedCloth (4.3.2) RedCloth (4.3.2)
abstract_type (0.0.7) abstract_type (0.0.7)
ace-rails-ap (4.1.2) ace-rails-ap (4.1.2)
actionmailer (4.2.10) actioncable (5.0.7)
actionpack (= 4.2.10) actionpack (= 5.0.7)
actionview (= 4.2.10) nio4r (>= 1.2, < 3.0)
activejob (= 4.2.10) websocket-driver (~> 0.6.1)
actionmailer (5.0.7)
actionpack (= 5.0.7)
actionview (= 5.0.7)
activejob (= 5.0.7)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
actionpack (4.2.10) actionpack (5.0.7)
actionview (= 4.2.10) actionview (= 5.0.7)
activesupport (= 4.2.10) activesupport (= 5.0.7)
rack (~> 1.6) rack (~> 2.0)
rack-test (~> 0.6.2) rack-test (~> 0.6.3)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.10) actionview (5.0.7)
activesupport (= 4.2.10) activesupport (= 5.0.7)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (4.2.10) activejob (5.0.7)
activesupport (= 4.2.10) activesupport (= 5.0.7)
globalid (>= 0.3.0) globalid (>= 0.3.6)
activemodel (4.2.10) activemodel (5.0.7)
activesupport (= 4.2.10) activesupport (= 5.0.7)
builder (~> 3.1) activerecord (5.0.7)
activerecord (4.2.10) activemodel (= 5.0.7)
activemodel (= 4.2.10) activesupport (= 5.0.7)
activesupport (= 4.2.10) arel (~> 7.0)
arel (~> 6.0) activerecord_sane_schema_dumper (1.0)
activerecord_sane_schema_dumper (0.2) rails (>= 5, < 6)
rails (>= 4, < 5) activesupport (5.0.7)
activesupport (4.2.10) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
acts-as-taggable-on (5.0.0) acts-as-taggable-on (5.0.0)
activerecord (>= 4.2.8) activerecord (>= 4.2.8)
...@@ -49,7 +52,7 @@ GEM ...@@ -49,7 +52,7 @@ GEM
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
aes_key_wrap (1.0.1) aes_key_wrap (1.0.1)
akismet (2.0.0) akismet (2.0.0)
arel (6.0.4) arel (7.1.4)
asana (0.6.0) asana (0.6.0)
faraday (~> 0.9) faraday (~> 0.9)
faraday_middleware (~> 0.9) faraday_middleware (~> 0.9)
...@@ -143,8 +146,8 @@ GEM ...@@ -143,8 +146,8 @@ GEM
html-pipeline html-pipeline
declarative (0.0.10) declarative (0.0.10)
declarative-option (0.1.0) declarative-option (0.1.0)
default_value_for (3.0.2) default_value_for (3.0.5)
activerecord (>= 3.2.0, < 5.1) activerecord (>= 3.2.0, < 5.2)
descendants_tracker (0.0.4) descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
device_detector (1.0.0) device_detector (1.0.0)
...@@ -376,7 +379,7 @@ GEM ...@@ -376,7 +379,7 @@ GEM
json (~> 1.8) json (~> 1.8)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
httpclient (2.8.3) httpclient (2.8.3)
i18n (0.9.5) i18n (1.1.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
icalendar (2.4.1) icalendar (2.4.1)
ice_nine (0.11.2) ice_nine (0.11.2)
...@@ -470,6 +473,7 @@ GEM ...@@ -470,6 +473,7 @@ GEM
net-ldap (0.16.0) net-ldap (0.16.0)
net-ssh (5.0.1) net-ssh (5.0.1)
netrc (0.11.0) netrc (0.11.0)
nio4r (2.3.1)
nokogiri (1.8.4) nokogiri (1.8.4)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
nokogumbo (1.5.0) nokogumbo (1.5.0)
...@@ -598,7 +602,7 @@ GEM ...@@ -598,7 +602,7 @@ GEM
get_process_mem (~> 0.2) get_process_mem (~> 0.2)
puma (>= 2.7, < 4) puma (>= 2.7, < 4)
pyu-ruby-sasl (0.0.3.3) pyu-ruby-sasl (0.0.3.3)
rack (1.6.11) rack (2.0.5)
rack-accept (0.4.5) rack-accept (0.4.5)
rack (>= 0.4) rack (>= 0.4)
rack-attack (4.4.1) rack-attack (4.4.1)
...@@ -616,31 +620,36 @@ GEM ...@@ -616,31 +620,36 @@ GEM
rack rack
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.10) rails (5.0.7)
actionmailer (= 4.2.10) actioncable (= 5.0.7)
actionpack (= 4.2.10) actionmailer (= 5.0.7)
actionview (= 4.2.10) actionpack (= 5.0.7)
activejob (= 4.2.10) actionview (= 5.0.7)
activemodel (= 4.2.10) activejob (= 5.0.7)
activerecord (= 4.2.10) activemodel (= 5.0.7)
activesupport (= 4.2.10) activerecord (= 5.0.7)
bundler (>= 1.3.0, < 2.0) activesupport (= 5.0.7)
railties (= 4.2.10) bundler (>= 1.3.0)
sprockets-rails railties (= 5.0.7)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
actionview (~> 5.x, >= 5.0.1)
activesupport (~> 5.x)
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.9) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0, < 5.0) activesupport (>= 4.2.0)
nokogiri (~> 1.6) nokogiri (>= 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.4) rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2) loofah (~> 2.2, >= 2.2.2)
rails-i18n (4.0.9) rails-i18n (5.1.1)
i18n (~> 0.7) i18n (>= 0.7, < 2)
railties (~> 4.0) railties (>= 5.0, < 6)
railties (4.2.10) railties (5.0.7)
actionpack (= 4.2.10) actionpack (= 5.0.7)
activesupport (= 4.2.10) activesupport (= 5.0.7)
method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
...@@ -731,8 +740,7 @@ GEM ...@@ -731,8 +740,7 @@ GEM
rspec-core rspec-core
rspec-set (0.1.3) rspec-set (0.1.3)
rspec-support (3.7.1) rspec-support (3.7.1)
rspec_junit_formatter (0.2.3) rspec_junit_formatter (0.4.1)
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0) rspec-core (>= 2, < 4, != 2.12.0)
rspec_profiling (0.0.5) rspec_profiling (0.0.5)
activerecord activerecord
...@@ -849,8 +857,6 @@ GEM ...@@ -849,8 +857,6 @@ GEM
sysexits (1.2.0) sysexits (1.2.0)
temple (0.8.0) temple (0.8.0)
test-prof (0.2.5) test-prof (0.2.5)
test_after_commit (1.1.0)
activerecord (>= 3.2)
text (1.3.1) text (1.3.1)
thin (1.7.2) thin (1.7.2)
daemons (~> 1.0, >= 1.0.9) daemons (~> 1.0, >= 1.0.9)
...@@ -913,6 +919,9 @@ GEM ...@@ -913,6 +919,9 @@ GEM
hashdiff hashdiff
webpack-rails (0.9.11) webpack-rails (0.9.11)
railties (>= 3.2.0) railties (>= 3.2.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
wikicloth (0.8.1) wikicloth (0.8.1)
builder builder
expression_parser expression_parser
...@@ -928,7 +937,7 @@ PLATFORMS ...@@ -928,7 +937,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
RedCloth (~> 4.3.2) RedCloth (~> 4.3.2)
ace-rails-ap (~> 4.1.0) ace-rails-ap (~> 4.1.0)
activerecord_sane_schema_dumper (= 0.2) activerecord_sane_schema_dumper (= 1.0)
acts-as-taggable-on (~> 5.0) acts-as-taggable-on (~> 5.0)
addressable (~> 2.5.2) addressable (~> 2.5.2)
akismet (~> 2.0) akismet (~> 2.0)
...@@ -962,7 +971,7 @@ DEPENDENCIES ...@@ -962,7 +971,7 @@ DEPENDENCIES
creole (~> 0.5.0) creole (~> 0.5.0)
database_cleaner (~> 1.5.0) database_cleaner (~> 1.5.0)
deckar01-task_list (= 2.0.0) deckar01-task_list (= 2.0.0)
default_value_for (~> 3.0.0) default_value_for (~> 3.0.5)
device_detector device_detector
devise (~> 4.4) devise (~> 4.4)
devise-two-factor (~> 3.0.0) devise-two-factor (~> 3.0.0)
...@@ -1080,9 +1089,10 @@ DEPENDENCIES ...@@ -1080,9 +1089,10 @@ DEPENDENCIES
rack-cors (~> 1.0.0) rack-cors (~> 1.0.0)
rack-oauth2 (~> 1.2.1) rack-oauth2 (~> 1.2.1)
rack-proxy (~> 0.6.0) rack-proxy (~> 0.6.0)
rails (= 4.2.10) rails (= 5.0.7)
rails-controller-testing
rails-deprecated_sanitizer (~> 1.0.3) rails-deprecated_sanitizer (~> 1.0.3)
rails-i18n (~> 4.0.9) rails-i18n (~> 5.1)
rainbow (~> 3.0) rainbow (~> 3.0)
raindrops (~> 0.18) raindrops (~> 0.18)
rblineprof (~> 0.3.6) rblineprof (~> 0.3.6)
...@@ -1135,7 +1145,6 @@ DEPENDENCIES ...@@ -1135,7 +1145,6 @@ DEPENDENCIES
state_machines-activerecord (~> 0.5.1) state_machines-activerecord (~> 0.5.1)
sys-filesystem (~> 1.1.6) sys-filesystem (~> 1.1.6)
test-prof (~> 0.2.5) test-prof (~> 0.2.5)
test_after_commit (~> 1.1)
thin (~> 1.7.0) thin (~> 1.7.0)
timecop (~> 0.8.0) timecop (~> 0.8.0)
toml-rb (~> 1.0.0) toml-rb (~> 1.0.0)
......
# BUNDLE_GEMFILE=Gemfile.rails4 bundle install
ENV["RAILS5"] = "false"
gemfile = File.expand_path("../Gemfile", __FILE__)
eval(File.read(gemfile), nil, gemfile)
...@@ -4,44 +4,41 @@ GEM ...@@ -4,44 +4,41 @@ GEM
RedCloth (4.3.2) RedCloth (4.3.2)
abstract_type (0.0.7) abstract_type (0.0.7)
ace-rails-ap (4.1.2) ace-rails-ap (4.1.2)
actioncable (5.0.7) actionmailer (4.2.10)
actionpack (= 5.0.7) actionpack (= 4.2.10)
nio4r (>= 1.2, < 3.0) actionview (= 4.2.10)
websocket-driver (~> 0.6.1) activejob (= 4.2.10)
actionmailer (5.0.7)
actionpack (= 5.0.7)
actionview (= 5.0.7)
activejob (= 5.0.7)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (5.0.7) actionpack (4.2.10)
actionview (= 5.0.7) actionview (= 4.2.10)
activesupport (= 5.0.7) activesupport (= 4.2.10)
rack (~> 2.0) rack (~> 1.6)
rack-test (~> 0.6.3) rack-test (~> 0.6.2)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7) actionview (4.2.10)
activesupport (= 5.0.7) activesupport (= 4.2.10)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.7) activejob (4.2.10)
activesupport (= 5.0.7) activesupport (= 4.2.10)
globalid (>= 0.3.6) globalid (>= 0.3.0)
activemodel (5.0.7) activemodel (4.2.10)
activesupport (= 5.0.7) activesupport (= 4.2.10)
activerecord (5.0.7) builder (~> 3.1)
activemodel (= 5.0.7) activerecord (4.2.10)
activesupport (= 5.0.7) activemodel (= 4.2.10)
arel (~> 7.0) activesupport (= 4.2.10)
activerecord_sane_schema_dumper (1.0) arel (~> 6.0)
rails (>= 5, < 6) activerecord_sane_schema_dumper (0.2)
activesupport (5.0.7) rails (>= 4, < 5)
concurrent-ruby (~> 1.0, >= 1.0.2) activesupport (4.2.10)
i18n (>= 0.7, < 2) i18n (~> 0.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
acts-as-taggable-on (5.0.0) acts-as-taggable-on (5.0.0)
activerecord (>= 4.2.8) activerecord (>= 4.2.8)
...@@ -52,7 +49,7 @@ GEM ...@@ -52,7 +49,7 @@ GEM
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
aes_key_wrap (1.0.1) aes_key_wrap (1.0.1)
akismet (2.0.0) akismet (2.0.0)
arel (7.1.4) arel (6.0.4)
asana (0.6.0) asana (0.6.0)
faraday (~> 0.9) faraday (~> 0.9)
faraday_middleware (~> 0.9) faraday_middleware (~> 0.9)
...@@ -146,8 +143,8 @@ GEM ...@@ -146,8 +143,8 @@ GEM
html-pipeline html-pipeline
declarative (0.0.10) declarative (0.0.10)
declarative-option (0.1.0) declarative-option (0.1.0)
default_value_for (3.0.5) default_value_for (3.0.2)
activerecord (>= 3.2.0, < 5.2) activerecord (>= 3.2.0, < 5.1)
descendants_tracker (0.0.4) descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
device_detector (1.0.0) device_detector (1.0.0)
...@@ -379,7 +376,7 @@ GEM ...@@ -379,7 +376,7 @@ GEM
json (~> 1.8) json (~> 1.8)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
httpclient (2.8.3) httpclient (2.8.3)
i18n (1.1.0) i18n (0.9.5)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
icalendar (2.4.1) icalendar (2.4.1)
ice_nine (0.11.2) ice_nine (0.11.2)
...@@ -454,9 +451,9 @@ GEM ...@@ -454,9 +451,9 @@ GEM
memoizable (0.4.2) memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
method_source (0.9.0) method_source (0.9.0)
mime-types (3.1) mime-types (3.2.2)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2018.0812)
mimemagic (0.3.0) mimemagic (0.3.0)
mini_magick (4.8.0) mini_magick (4.8.0)
mini_mime (1.0.1) mini_mime (1.0.1)
...@@ -473,7 +470,6 @@ GEM ...@@ -473,7 +470,6 @@ GEM
net-ldap (0.16.0) net-ldap (0.16.0)
net-ssh (5.0.1) net-ssh (5.0.1)
netrc (0.11.0) netrc (0.11.0)
nio4r (2.3.1)
nokogiri (1.8.4) nokogiri (1.8.4)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
nokogumbo (1.5.0) nokogumbo (1.5.0)
...@@ -602,7 +598,7 @@ GEM ...@@ -602,7 +598,7 @@ GEM
get_process_mem (~> 0.2) get_process_mem (~> 0.2)
puma (>= 2.7, < 4) puma (>= 2.7, < 4)
pyu-ruby-sasl (0.0.3.3) pyu-ruby-sasl (0.0.3.3)
rack (2.0.5) rack (1.6.11)
rack-accept (0.4.5) rack-accept (0.4.5)
rack (>= 0.4) rack (>= 0.4)
rack-attack (4.4.1) rack-attack (4.4.1)
...@@ -620,36 +616,31 @@ GEM ...@@ -620,36 +616,31 @@ GEM
rack rack
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (5.0.7) rails (4.2.10)
actioncable (= 5.0.7) actionmailer (= 4.2.10)
actionmailer (= 5.0.7) actionpack (= 4.2.10)
actionpack (= 5.0.7) actionview (= 4.2.10)
actionview (= 5.0.7) activejob (= 4.2.10)
activejob (= 5.0.7) activemodel (= 4.2.10)
activemodel (= 5.0.7) activerecord (= 4.2.10)
activerecord (= 5.0.7) activesupport (= 4.2.10)
activesupport (= 5.0.7) bundler (>= 1.3.0, < 2.0)
bundler (>= 1.3.0) railties (= 4.2.10)
railties (= 5.0.7) sprockets-rails
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
actionview (~> 5.x, >= 5.0.1)
activesupport (~> 5.x)
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (2.0.3) rails-dom-testing (1.0.9)
activesupport (>= 4.2.0) activesupport (>= 4.2.0, < 5.0)
nokogiri (>= 1.6) nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.4) rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2) loofah (~> 2.2, >= 2.2.2)
rails-i18n (5.1.1) rails-i18n (4.0.9)
i18n (>= 0.7, < 2) i18n (~> 0.7)
railties (>= 5.0, < 6) railties (~> 4.0)
railties (5.0.7) railties (4.2.10)
actionpack (= 5.0.7) actionpack (= 4.2.10)
activesupport (= 5.0.7) activesupport (= 4.2.10)
method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
...@@ -740,7 +731,8 @@ GEM ...@@ -740,7 +731,8 @@ GEM
rspec-core rspec-core
rspec-set (0.1.3) rspec-set (0.1.3)
rspec-support (3.7.1) rspec-support (3.7.1)
rspec_junit_formatter (0.4.1) rspec_junit_formatter (0.2.3)
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0) rspec-core (>= 2, < 4, != 2.12.0)
rspec_profiling (0.0.5) rspec_profiling (0.0.5)
activerecord activerecord
...@@ -857,6 +849,8 @@ GEM ...@@ -857,6 +849,8 @@ GEM
sysexits (1.2.0) sysexits (1.2.0)
temple (0.8.0) temple (0.8.0)
test-prof (0.2.5) test-prof (0.2.5)
test_after_commit (1.1.0)
activerecord (>= 3.2)
text (1.3.1) text (1.3.1)
thin (1.7.2) thin (1.7.2)
daemons (~> 1.0, >= 1.0.9) daemons (~> 1.0, >= 1.0.9)
...@@ -919,9 +913,6 @@ GEM ...@@ -919,9 +913,6 @@ GEM
hashdiff hashdiff
webpack-rails (0.9.11) webpack-rails (0.9.11)
railties (>= 3.2.0) railties (>= 3.2.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
wikicloth (0.8.1) wikicloth (0.8.1)
builder builder
expression_parser expression_parser
...@@ -937,7 +928,7 @@ PLATFORMS ...@@ -937,7 +928,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
RedCloth (~> 4.3.2) RedCloth (~> 4.3.2)
ace-rails-ap (~> 4.1.0) ace-rails-ap (~> 4.1.0)
activerecord_sane_schema_dumper (= 1.0) activerecord_sane_schema_dumper (= 0.2)
acts-as-taggable-on (~> 5.0) acts-as-taggable-on (~> 5.0)
addressable (~> 2.5.2) addressable (~> 2.5.2)
akismet (~> 2.0) akismet (~> 2.0)
...@@ -971,7 +962,7 @@ DEPENDENCIES ...@@ -971,7 +962,7 @@ DEPENDENCIES
creole (~> 0.5.0) creole (~> 0.5.0)
database_cleaner (~> 1.5.0) database_cleaner (~> 1.5.0)
deckar01-task_list (= 2.0.0) deckar01-task_list (= 2.0.0)
default_value_for (~> 3.0.5) default_value_for (~> 3.0.0)
device_detector device_detector
devise (~> 4.4) devise (~> 4.4)
devise-two-factor (~> 3.0.0) devise-two-factor (~> 3.0.0)
...@@ -1089,10 +1080,9 @@ DEPENDENCIES ...@@ -1089,10 +1080,9 @@ DEPENDENCIES
rack-cors (~> 1.0.0) rack-cors (~> 1.0.0)
rack-oauth2 (~> 1.2.1) rack-oauth2 (~> 1.2.1)
rack-proxy (~> 0.6.0) rack-proxy (~> 0.6.0)
rails (= 5.0.7) rails (= 4.2.10)
rails-controller-testing
rails-deprecated_sanitizer (~> 1.0.3) rails-deprecated_sanitizer (~> 1.0.3)
rails-i18n (~> 5.1) rails-i18n (~> 4.0.9)
rainbow (~> 3.0) rainbow (~> 3.0)
raindrops (~> 0.18) raindrops (~> 0.18)
rblineprof (~> 0.3.6) rblineprof (~> 0.3.6)
...@@ -1145,6 +1135,7 @@ DEPENDENCIES ...@@ -1145,6 +1135,7 @@ DEPENDENCIES
state_machines-activerecord (~> 0.5.1) state_machines-activerecord (~> 0.5.1)
sys-filesystem (~> 1.1.6) sys-filesystem (~> 1.1.6)
test-prof (~> 0.2.5) test-prof (~> 0.2.5)
test_after_commit (~> 1.1)
thin (~> 1.7.0) thin (~> 1.7.0)
timecop (~> 0.8.0) timecop (~> 0.8.0)
toml-rb (~> 1.0.0) toml-rb (~> 1.0.0)
......
# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
#!/usr/bin/env ruby #!/usr/bin/env ruby
# Remove this block when upgraded to rails 5.0. # Remove this block when upgraded to rails 5.0.
unless %w[1 true].include?(ENV["RAILS5"]) if %w[0 false].include?(ENV["RAILS5"])
begin begin
load File.expand_path('../spring', __FILE__) load File.expand_path('../spring', __FILE__)
rescue LoadError => e rescue LoadError => e
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
# Remove this block when upgraded to rails 5.0. # Remove this block when upgraded to rails 5.0.
unless %w[1 true].include?(ENV["RAILS5"]) if %w[0 false].include?(ENV["RAILS5"])
begin begin
load File.expand_path('../spring', __FILE__) load File.expand_path('../spring', __FILE__)
rescue LoadError => e rescue LoadError => e
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Remove these two lines below when upgraded to rails 5.0. # Remove these two lines below when upgraded to rails 5.0.
# Allow run `rspec` command as `RAILS5=1 rspec ...` instead of `BUNDLE_GEMFILE=Gemfile.rails5 rspec ...` # Allow run `rspec` command as `RAILS5=1 rspec ...` instead of `BUNDLE_GEMFILE=Gemfile.rails5 rspec ...`
gemfile = %w[1 true].include?(ENV["RAILS5"]) ? "Gemfile.rails5" : "Gemfile" gemfile = %w[0 false].include?(ENV["RAILS5"]) ? "Gemfile.rails4" : "Gemfile"
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../#{gemfile}", __dir__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../#{gemfile}", __dir__)
begin begin
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
def rails5? def rails5?
%w[1 true].include?(ENV["RAILS5"]) !%w[0 false].include?(ENV["RAILS5"])
end end
require "pathname" require "pathname"
......
---
title: Switch to Rails 5
merge_request: 21492
author:
type: other
...@@ -8,7 +8,7 @@ module Gitlab ...@@ -8,7 +8,7 @@ module Gitlab
# This method is used for smooth upgrading from the current Rails 4.x to Rails 5.0. # This method is used for smooth upgrading from the current Rails 4.x to Rails 5.0.
# https://gitlab.com/gitlab-org/gitlab-ce/issues/14286 # https://gitlab.com/gitlab-org/gitlab-ce/issues/14286
def self.rails5? def self.rails5?
ENV["RAILS5"].in?(%w[1 true]) !%w[0 false].include?(ENV["RAILS5"])
end end
class Application < Rails::Application class Application < Rails::Application
......
def rails5? def rails5?
%w[1 true].include?(ENV["RAILS5"]) !%w[0 false].include?(ENV["RAILS5"])
end end
require 'rubygems' unless rails5? require 'rubygems' unless rails5?
gemfile = rails5? ? "Gemfile.rails5" : "Gemfile" gemfile = rails5? ? "Gemfile" : "Gemfile.rails4"
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../#{gemfile}", __dir__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../#{gemfile}", __dir__)
# Set up gems listed in the Gemfile. # Set up gems listed in the Gemfile.
......
# Load the rails application # Load the rails application
# Remove this condition when upgraded to rails 5.0. # Remove this condition when upgraded to rails 5.0.
if %w[1 true].include?(ENV["RAILS5"]) if %w[0 false].include?(ENV["RAILS5"])
require_relative 'application'
else
require File.expand_path('application', __dir__) require File.expand_path('application', __dir__)
else
require_relative 'application'
end end
# Initialize the rails application # Initialize the rails application
......
...@@ -24,10 +24,25 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) ...@@ -24,10 +24,25 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, MysqlSetLengthForBinaryIndex) ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, MysqlSetLengthForBinaryIndex)
end end
if Gitlab.rails5? module MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema
module MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema
# This method is used in Rails 5 schema loading as t.index # This method is used in Rails 5 schema loading as t.index
def index(column_names, options = {}) def index(column_names, options = {})
# Ignore indexes that use opclasses,
# also see config/initializers/mysql_ignore_postgresql_options.rb
if options[:opclasses]
warn "WARNING: index on columns #{column_names} uses unsupported option, skipping."
return
end
# when running rails 4 with rails 5 schema, rails 4 doesn't support multiple
# indexes on the same set of columns. Mysql doesn't support partial indexes, so if
# an index already exists and we add another index, skip it if it's partial:
# see https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21492#note_102821326
if !Gitlab.rails5? && indexes[column_names] && options[:where]
warn "WARNING: index on columns #{column_names} already exists and partial index is not supported, skipping."
return
end
options[:length] ||= {} options[:length] ||= {}
Array(column_names).each do |column_name| Array(column_names).each do |column_name|
column = columns.find { |c| c.name == column_name } column = columns.find { |c| c.name == column_name }
...@@ -37,15 +52,18 @@ if Gitlab.rails5? ...@@ -37,15 +52,18 @@ if Gitlab.rails5?
end end
end end
# Ignore indexes that use opclasses,
# also see config/initializers/mysql_ignore_postgresql_options.rb
unless options[:opclasses]
super(column_names, options) super(column_names, options)
end end
end end
end
def mysql_adapter?
defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) && ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
end
if Gitlab.rails5?
if defined?(ActiveRecord::ConnectionAdapters::MySQL::TableDefinition) if defined?(ActiveRecord::ConnectionAdapters::MySQL::TableDefinition)
ActiveRecord::ConnectionAdapters::MySQL::TableDefinition.send(:prepend, MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema) ActiveRecord::ConnectionAdapters::MySQL::TableDefinition.send(:prepend, MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema)
end end
elsif mysql_adapter? && defined?(ActiveRecord::ConnectionAdapters::TableDefinition)
ActiveRecord::ConnectionAdapters::TableDefinition.send(:prepend, MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema)
end end
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -51,6 +51,7 @@ description: 'Learn how to contribute to GitLab.' ...@@ -51,6 +51,7 @@ description: 'Learn how to contribute to GitLab.'
- [Prometheus metrics](prometheus_metrics.md) - [Prometheus metrics](prometheus_metrics.md)
- [Guidelines for reusing abstractions](reusing_abstractions.md) - [Guidelines for reusing abstractions](reusing_abstractions.md)
- [DeclarativePolicy framework](policies.md) - [DeclarativePolicy framework](policies.md)
- [Switching to Rails 5](switching_to_rails5.md)
## Performance guides ## Performance guides
......
# Switching to Rails 5
GitLab switched recently to Rails 5. This is a big change (especially for backend development) and it introduces couple of temporary inconveniences.
## After the switch, I found a broken feature. What do I do?
Many fixes and tweaks were done to make our codebase compatible with Rails 5, but it's possible that not all issues were found. If you find an bug, please create an issue and assign it the ~rails5 label.
## It takes much longer to run CI pipelines that build GitLab. Why?
We are temporarily running CI pipelines with Rails 4 and 5 so that we ensure we remain compatible with Rails 4 in case we must revert back to Rails 4 from Rails 5 (this can double the duration of CI pipelines).
We might revert back to Rails 4 if we found a major issue we were unable to quickly fix.
Once we are sure we can stay with Rails 5, we will stop running CI pipelines with Rails 4.
## Can I skip running Rails 4 tests?
If you are sure that your merge request doesn't introduce any incompatibility, you can just include `norails4` anywhere in your branch name and Rails 4 tests will be skipped.
## CI is failing on my test with Rails 4. How can I debug it?
You can run specs locally with Rails 4 using the following command:
```sh
BUNDLE_GEMFILE=Gemfile.rails4 RAILS5=0 bundle exec rspec ...
```
#!/usr/bin/env bash
echo -e "=> Checking if Gemfile.rails4.lock is up-to-date...\\n"
cp Gemfile.rails4.lock Gemfile.rails4.lock.orig
BUNDLE_GEMFILE=Gemfile.rails4 bundle install "$BUNDLE_INSTALL_FLAGS"
diff -u Gemfile.rails4.lock.orig Gemfile.rails4.lock >/dev/null 2>&1
if [ $? == 1 ]
then
diff -u Gemfile.rails4.lock.orig Gemfile.rails4.lock
echo -e "\\n✖ ERROR: Gemfile.rails4.lock is not up-to-date!
Please run 'BUNDLE_GEMFILE=Gemfile.rails4 bundle install'\\n" >&2
exit 1
fi
echo "✔ Gemfile.rails4.lock is up-to-date"
exit 0
#!/usr/bin/env bash
echo -e "=> Checking if Gemfile.rails5.lock is up-to-date...\\n"
cp Gemfile.rails5.lock Gemfile.rails5.lock.orig
BUNDLE_GEMFILE=Gemfile.rails5 bundle install "$BUNDLE_INSTALL_FLAGS"
diff -u Gemfile.rails5.lock.orig Gemfile.rails5.lock >/dev/null 2>&1
if [ $? == 1 ]
then
diff -u Gemfile.rails5.lock.orig Gemfile.rails5.lock
echo -e "\\n✖ ERROR: Gemfile.rails5.lock is not up-to-date!
Please run 'BUNDLE_GEMFILE=Gemfile.rails5 bundle install'\\n" >&2
exit 1
fi
echo "✔ Gemfile.rails5.lock is up-to-date"
exit 0
...@@ -1338,7 +1338,12 @@ describe Gitlab::Database::MigrationHelpers do ...@@ -1338,7 +1338,12 @@ describe Gitlab::Database::MigrationHelpers do
end end
describe '#index_exists_by_name?' do describe '#index_exists_by_name?' do
it 'returns true if an index exists' do # TODO: remove rails5-only after removing rails4 tests
# rails 4 can not handle multiple indexes on the same column set if
# index was added by 't.index' - t.index is used by default in schema.rb in
# rails 5. Let's run this test only in rails 5 env:
# see https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21492#note_113602758
it 'returns true if an index exists', :rails5 do
expect(model.index_exists_by_name?(:projects, 'index_projects_on_path')) expect(model.index_exists_by_name?(:projects, 'index_projects_on_path'))
.to be_truthy .to be_truthy
end end
......
...@@ -240,7 +240,12 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi ...@@ -240,7 +240,12 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi
.and_return(user.id) .and_return(user.id)
end end
it 'returns the existing merge request' do # TODO: remove rails5-only after removing rails4 tests
# rails 4 can not handle multiple indexes on the same column set if
# index was added by 't.index' - t.index is used by default in schema.rb in
# rails 5. Let's run this test only in rails 5 env:
# see https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21492#note_113602758
it 'returns the existing merge request', :rails5 do
mr1, exists1 = importer.create_merge_request mr1, exists1 = importer.create_merge_request
mr2, exists2 = importer.create_merge_request mr2, exists2 = importer.create_merge_request
......
...@@ -235,6 +235,10 @@ RSpec.configure do |config| ...@@ -235,6 +235,10 @@ RSpec.configure do |config|
example.run if Gitlab::Database.mysql? example.run if Gitlab::Database.mysql?
end end
config.around(:each, :rails5) do |example|
example.run if Gitlab.rails5?
end
# This makes sure the `ApplicationController#can?` method is stubbed with the # This makes sure the `ApplicationController#can?` method is stubbed with the
# original implementation for all view specs. # original implementation for all view specs.
config.before(:each, type: :view) do config.before(:each, type: :view) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment