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

Fix tests to work with sharpstone/default_ruby #1527

Merged
merged 5 commits into from
Dec 5, 2024
Merged

Conversation

schneems
Copy link
Contributor

@schneems schneems commented Dec 5, 2024

Ruby no longer includes a webserver by default, so I added webrick to the sharpstone/default_ruby repo. The hatchet tests pull in the latest from master there and it broke this test which is modifying files it expects on disk.

Fixes:

```
Hatchet::App::FailedDeployError Could not deploy 'hatchet-t-741ea26fdf' (default_ruby) using 'Hatchet::GitApp' at path: './repos/rack/default_ruby'
if this was expected add `allow_failure: true` to your deploy hash.
Buildpack: nil
Repo: https://git.heroku.com/hatchet-t-741ea26fdf.git
output:
remote: Updated 5 paths from 3dac5f9
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: https://github.com/heroku/heroku-buildpack-ruby#schneems/ci-queue-dec3
remote: -----> Ruby app detected
remote:
remote:        ## Warning: Your app needs java
remote:
remote:        The Ruby buildpack determined your app needs java installed
remote:        we recommend you add the jvm buildpack to your application:
remote:
remote:          $ heroku buildpacks:add heroku/jvm --index=1
remote:
remote: -----> Installing Java
remote:
remote: -----> Downloading Buildpack: heroku/jvm
remote: -----> Detected Framework: JVM Common
remote:
remote:  !     WARNING: No OpenJDK version specified
remote:        Your application does not explicitly specify an OpenJDK
remote:        version. OpenJDK 1.8 will be installed.
remote:
remote:        This default version will change at some point. Your
remote:        application might fail to build with the new version. We
remote:        recommend explicitly setting the required OpenJDK version for
remote:        your application.
remote:
remote:        To set the OpenJDK version, add or edit the system.properties
remote:        file in the root directory of your application to contain:
remote:
remote:        java.runtime.version = 1.8
remote:
remote:
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Installing bundler 1.17.3
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rack
remote: -----> Using Ruby version: ruby-2.5.7-jruby-9.2.13.0
remote: -----> Installing dependencies using bundler 1.17.3
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 bundle install -j4
remote:        You are trying to install in deployment mode after changing
remote:        your Gemfile. Run `bundle install` elsewhere and add the
remote:        updated Gemfile.lock to version control.
remote:
remote:        If this is a development machine, remove the /tmp/build_3b0d62e8/Gemfile freeze
remote:        by running `bundle install --no-deployment`.
remote:
remote:        Bundler is unlocking ruby
remote:
remote:        You have added to the Gemfile:
remote:        * webrick
remote:        Bundler Output: You are trying to install in deployment mode after changing
remote:        your Gemfile. Run `bundle install` elsewhere and add the
remote:        updated Gemfile.lock to version control.
remote:
remote:        If this is a development machine, remove the /tmp/build_3b0d62e8/Gemfile freeze
remote:        by running `bundle install --no-deployment`.
remote:
remote:        Bundler is unlocking ruby
remote:
remote:        You have added to the Gemfile:
remote:        * webrick
remote:
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: df7a92f56ea636831f28033356791f2ba6ba0ef0
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version df7a92f56ea636831f28033356791f2ba6ba0ef0
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: !	Push rejected to hatchet-t-741ea26fdf.
remote:
To https://git.heroku.com/hatchet-t-741ea26fdf.git
 ! [remote rejected] HEAD -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/hatchet-t-741ea26fdf.git'
  /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/git_app.rb:36:in `git_push_heroku_yall'
  /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/git_app.rb:13:in `block in push_without_retry!'
  /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/shell_throttle.rb:28:in `block (2 levels) in call'
  /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/shell_throttle.rb:27:in `catch'
  /app/vendor/bundle/ruby/3.1.0/gems/heroku_hatchet-8.0.4/lib/hatchet/shell_throttle.rb:27:in `block in call'
```

https://dashboard.heroku.com/pipelines/ac057663-170b-4bdd-99d0-87560eb3a570/tests/2165
```
       remote: -----> Installing dependencies using bundler 2.5.6
       remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       remote:        NoMethodError: undefined method `union' for ["BUNDLE_JOBS"]:Array
       remote:                               all at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/settings.rb:169
       remote:                            report at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/env.rb:20
       remote:          request_issue_report_for at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:71
       remote:                         log_error at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:50
       remote:              with_friendly_errors at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:123
       remote:                            <main> at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/exe/bundle:20
       remote:                              load at org/jruby/RubyKernel.java:1009
       remote:                            <main> at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/bin/bundle:25
       remote:        Bundler Output: NoMethodError: undefined method `union' for ["BUNDLE_JOBS"]:Array
       remote:                               all at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/settings.rb:169
       remote:                            report at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/env.rb:20
       remote:          request_issue_report_for at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:71
       remote:                         log_error at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:50
       remote:              with_friendly_errors at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/lib/bundler/friendly_errors.rb:123
       remote:                            <main> at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/gems/bundler-2.5.6/exe/bundle:20
       remote:                              load at org/jruby/RubyKernel.java:1009
       remote:                            <main> at /tmp/build_0e08ea51/vendor/bundle/jruby/2.5.0/bin/bundle:25
```
From https://github.com/heroku/heroku-buildpack-java/blob/b3c51f94de6a43bc656b777bc84ef2a9451371aa/test/spec/java_spec.rb#L78

> OpenJDK versions > 9 do not have the jre/lib/ext directory where we drop the pgconfig.jar

This test was added by Joe in 248b30a later I moved to not having a separate track for installing JVM 648a149 so I removed the logic for installing a pgconfig.jar and relied on the buildpack. According to the JVM buildpack it's no longer in this updated version.

It seems the original PR was using this to test that installation logic. While we no longer need to do that (as the logic is part of the `heroku/jvm` buildpack) I wanted to preserve calling a `heroku run` to assert something about the dyno that would indicate that jruby was installed as we expect.
@schneems schneems requested a review from a team as a code owner December 5, 2024 21:46
@schneems schneems enabled auto-merge (squash) December 5, 2024 21:52
@schneems schneems merged commit b1c482c into main Dec 5, 2024
4 of 5 checks passed
@schneems schneems deleted the schneems/update-tests branch December 5, 2024 21:53
@heroku-linguist heroku-linguist bot mentioned this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants