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

enable rails 7.1 compatibility for buildpack #925

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

nouseforaname
Copy link
Contributor

@nouseforaname nouseforaname commented Apr 10, 2024

should fix #865

rails 7.1 removed bundle exec rake secret

rails 7.0 contains both rake secret and rails secret

❯ bundle exec rake secret
7f0aea7a13fe04e7b00490ccee27efda75ca8862f1991c3235b161188e9b58620afae253ba7394faddc92439ebcdeec222e086b67b93f5252fbd389264890aa9
❯ bundle exec rails secret
afa3a40584e6d173931692d721b5f34b80e524d951fdd97409103f339e77fdc66059177fe40f457c9c1f3b8919d02aca343dc5ac1e561cc42cd84b2fa10a3660
❯ bundle exec rails --version
Rails 7.0.1

❯ bundle exec rake secret
rake aborted!
Don't know how to build task 'secret' (See the list of available tasks with `rake --tasks`)
/nix/store/swaznx77b459sc46zavsahp1j8ahs9d4-my-rails-app-ruby-env/lib/ruby/gems/3.2.0/gems/rake-13.2.0/exe/rake:27:in `<top (required)>'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `load'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:23:in `run'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli.rb:451:in `exec'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli.rb:34:in `dispatch'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli.rb:28:in `start'
/nix/store/swaznx77b459sc46zavsahp1j8ahs9d4-my-rails-app-ruby-env/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/exe/bundle:28:in `block in <top (required)>'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/nix/store/swaznx77b459sc46zavsahp1j8ahs9d4-my-rails-app-ruby-env/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/exe/bundle:20:in `<top (required)>'
/nix/store/xqpfpk00g4n7wc6rdc6jjq23awrb5gkf-ruby-3.2.3/bin/bundle:25:in `load'
/nix/store/xqpfpk00g4n7wc6rdc6jjq23awrb5gkf-ruby-3.2.3/bin/bundle:25:in `<main>'
(See full trace by running task with --trace)
❯ bundle exec rails secret
92c69dcca516c685e1af2c5a744239cf4819957030fee5ab0918295be91aed0e8b215b996eee9253d6cb5fbe451d07bc4fa5e00f845190524ff3afa6985331b3
❯ bundle exec rails version
Rails 7.1.0

conditionally run the right command depending on the rails version detected.

Thanks for contributing to the buildpack. To speed up the process of reviewing your pull request please provide us with:

  • A short explanation of the proposed change:

  • An explanation of the use cases your change solves

  • I have viewed signed and have submitted the Contributor License Agreement

  • I have made this pull request to the develop branch

  • I have added an integration test

Didn't add an integration test but I did update existing units to check that rails secret command is called if rails 7 is detected.

rails 7.1 removed `bundle exec rake secret`

rails 7.0 contains both `rake secret` and `rails secret`

```
❯ bundle exec rake secret
7f0aea7a13fe04e7b00490ccee27efda75ca8862f1991c3235b161188e9b58620afae253ba7394faddc92439ebcdeec222e086b67b93f5252fbd389264890aa9
❯ bundle exec rails secret
afa3a40584e6d173931692d721b5f34b80e524d951fdd97409103f339e77fdc66059177fe40f457c9c1f3b8919d02aca343dc5ac1e561cc42cd84b2fa10a3660
❯ bundle exec rails --version
Rails 7.0.1
```
----
```
❯ bundle exec rake secret
rake aborted!
Don't know how to build task 'secret' (See the list of available tasks with `rake --tasks`)
/nix/store/swaznx77b459sc46zavsahp1j8ahs9d4-my-rails-app-ruby-env/lib/ruby/gems/3.2.0/gems/rake-13.2.0/exe/rake:27:in `<top (required)>'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `load'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli/exec.rb:23:in `run'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli.rb:451:in `exec'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli.rb:34:in `dispatch'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/cli.rb:28:in `start'
/nix/store/swaznx77b459sc46zavsahp1j8ahs9d4-my-rails-app-ruby-env/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/exe/bundle:28:in `block in <top (required)>'
/nix/store/ircaz84b1631bxdw4bnn6bzkmp02l0np-bundler-2.5.6/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/nix/store/swaznx77b459sc46zavsahp1j8ahs9d4-my-rails-app-ruby-env/lib/ruby/gems/3.2.0/gems/bundler-2.5.6/exe/bundle:20:in `<top (required)>'
/nix/store/xqpfpk00g4n7wc6rdc6jjq23awrb5gkf-ruby-3.2.3/bin/bundle:25:in `load'
/nix/store/xqpfpk00g4n7wc6rdc6jjq23awrb5gkf-ruby-3.2.3/bin/bundle:25:in `<main>'
(See full trace by running task with --trace)
❯ bundle exec rails secret
92c69dcca516c685e1af2c5a744239cf4819957030fee5ab0918295be91aed0e8b215b996eee9253d6cb5fbe451d07bc4fa5e00f845190524ff3afa6985331b3
❯ bundle exec rails version
Rails 7.1.0
```

conditionally run the right command depending on the rails version detected.
@nouseforaname nouseforaname requested a review from a team as a code owner April 10, 2024 10:39
@nouseforaname nouseforaname changed the base branch from master to develop April 10, 2024 10:40
@sophiewigmore
Copy link
Member

this change makes sense to me. I'd love to see a Rails 7.1 integration test added so we know its now definitely supported, but I'm happy to help with that if needed

this test hopes to ensure that rails 7.1 apps will succesfully
stage instead of failing with:

```
rake aborted!
Don't know how to build task 'secret' (See the list of available tasks with `rake --tasks`)
```
@nouseforaname
Copy link
Contributor Author

I added a test based on the rails6 stuff I found. Best I could come up with is checking that we see no failure involving rake secret in the output and that the app is running.

@sophiewigmore sophiewigmore merged commit 92a8791 into cloudfoundry:develop Apr 11, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants