diff --git a/.rubocop.yml b/.rubocop.yml index 17d9be63ca..38f85fc115 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,6 @@ --- -require: rubocop-rspec +plugins: + - rubocop-rspec AllCops: NewCops: enable @@ -40,7 +41,9 @@ RSpec/ExampleLength: Max: 20 RSpec/ExpectOutput: Enabled: false -RSpec/FilePath: +RSpec/SpecFilePathFormat: + Enabled: false +RSpec/SpecFilePathSuffix: Enabled: false RSpec/MissingExampleGroupArgument: Enabled: false @@ -64,7 +67,7 @@ Lint/EmptyBlock: RSpec/MultipleMemoizedHelpers: Max: 10 RSpec/VerifiedDoubleReference: - EnforcedStyle: string + Enabled: false Style/OptionalBooleanParameter: Enabled: false Lint/RedundantCopDisableDirective: diff --git a/.ruby-version b/.ruby-version index 30f69e8cc5..2aa5131992 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.9 +3.4.7 diff --git a/Gemfile b/Gemfile index ec63e80628..9c057db63f 100644 --- a/Gemfile +++ b/Gemfile @@ -2,11 +2,19 @@ source 'https://rubygems.org' +# Ruby 3.4+ standard library gems that need to be explicit +gem 'base64' +gem 'bigdecimal' +gem 'digest' +gem 'racc' +gem 'set' +gem 'tmpdir' + group :development do gem 'rake' gem 'redcarpet' gem 'rspec' - gem 'rubocop' + gem 'rubocop', '~> 1.60' gem 'rubocop-rspec' gem 'rubyzip' gem 'tee' diff --git a/Gemfile.lock b/Gemfile.lock index b3eb261a97..9206946216 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,20 +3,30 @@ GEM specs: addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) - ast (2.4.2) + ast (2.4.3) + base64 (0.3.0) + bigdecimal (3.3.1) crack (0.4.5) rexml diff-lcs (1.5.0) + digest (3.2.1) + fileutils (1.8.0) hashdiff (1.0.1) - parallel (1.22.1) - parser (3.1.2.0) + json (2.16.0) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + parallel (1.27.0) + parser (3.3.10.0) ast (~> 2.4.1) + racc + prism (1.6.0) public_suffix (4.0.7) + racc (1.8.1) rainbow (3.1.1) rake (13.0.6) redcarpet (3.5.1) - regexp_parser (2.3.1) - rexml (3.2.5) + regexp_parser (2.11.3) + rexml (3.4.4) rspec (3.11.0) rspec-core (~> 3.11.0) rspec-expectations (~> 3.11.0) @@ -30,25 +40,32 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) rspec-support (3.11.0) - rubocop (1.28.2) + rubocop (1.81.7) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.17.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.17.0) - parser (>= 3.1.1.0) - rubocop-rspec (2.10.0) - rubocop (~> 1.19) - ruby-progressbar (1.11.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.48.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-rspec (3.8.0) + lint_roller (~> 1.1) + rubocop (~> 1.81) + ruby-progressbar (1.13.0) rubyzip (2.3.2) + set (1.1.2) tee (1.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - unicode-display_width (2.1.0) + tmpdir (0.3.1) + fileutils + unicode-display_width (2.6.0) webmock (3.14.0) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -61,14 +78,20 @@ PLATFORMS ruby DEPENDENCIES + base64 + bigdecimal + digest + racc rake redcarpet rspec - rubocop + rubocop (~> 1.60) rubocop-rspec rubyzip + set tee terminal-table + tmpdir webmock yard diff --git a/bin/run b/bin/run index dc6220f0f1..f7ea7c9633 100755 --- a/bin/run +++ b/bin/run @@ -93,13 +93,15 @@ function main() { local phase phase="$(basename "${0}")" - if ! which ruby > /dev/null; then - mkdir -p "${RUBY_DIR}" + # Always install and use buildpack Ruby to ensure consistent version + # regardless of system Ruby availability + mkdir -p "${RUBY_DIR}" + if [ ! -d "${RUBY_DIR}/bin" ]; then util::install - util::environment::setup fi + util::environment::setup exec "${BUILDPACK_DIR}/bin/ruby-run" "${phase}" "${@-}" } diff --git a/ci/Dockerfile b/ci/Dockerfile index 79a666b0c0..0b9bc77e52 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,4 +1,4 @@ -ARG base_image=ubuntu:bionic +ARG base_image=ubuntu:jammy FROM ${base_image} RUN apt-get update && apt-get install -y wget gnupg @@ -10,11 +10,13 @@ RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ - libssl1.0-dev \ + libffi-dev \ + libssl-dev \ libreadline-dev \ + libyaml-dev \ lsb-release \ locales \ - python \ + python3 \ zip \ zlib1g-dev \ bellsoft-java17 \ @@ -32,16 +34,8 @@ RUN eval "$(rbenv init -)" \ RUN eval "$(rbenv init -)" \ && git clone https://github.com/sstephenson/rbenv-default-gems.git $(rbenv root)/plugins/rbenv-default-gems \ - && echo 'bundler 2.3.26' >> $(rbenv root)/default-gems + && echo 'bundler 2.3.12' >> $(rbenv root)/default-gems RUN eval "$(rbenv init -)" \ - && rbenv install 2.5.9 - -RUN eval "$(rbenv init -)" \ - && rbenv install 2.7.6 - -RUN eval "$(rbenv init -)" \ - && rbenv install 3.0.4 - -RUN eval "$(rbenv init -)" \ - && rbenv install 3.1.3 + && rbenv install 3.4.7 \ + && rbenv global 3.4.7 diff --git a/config/jprofiler_profiler.yml b/config/jprofiler_profiler.yml index d741f2f611..e48294a00c 100644 --- a/config/jprofiler_profiler.yml +++ b/config/jprofiler_profiler.yml @@ -15,7 +15,7 @@ # JMX configuration --- -version: 13.+ +version: 15.+ repository_root: https://download.run.pivotal.io/jprofiler enabled: false nowait: true diff --git a/config/ruby.yml b/config/ruby.yml index 94541f7ee4..0d05199092 100644 --- a/config/ruby.yml +++ b/config/ruby.yml @@ -14,6 +14,8 @@ # limitations under the License. # Configuration for Ruby +# Note: Ruby 3.2.8+ is required for Psych 5.0.1+ which supports YAML.load_file +# with permitted_classes and aliases keyword arguments used throughout the buildpack --- version: 3.2.+ repository_root: https://raw.githubusercontent.com/cloudfoundry/ruby-buildpack/master/java-index diff --git a/docs/extending-repositories.md b/docs/extending-repositories.md index f1c58a6ac1..9d7854f17d 100644 --- a/docs/extending-repositories.md +++ b/docs/extending-repositories.md @@ -55,7 +55,7 @@ end | Variable | Description | | -------- | ----------- | | `{default.repository.root}` | The common root for all repositories. Currently defaults to `https://java-buildpack.cloudfoundry.org`. -| `{platform}` | The platform that the application is running on. Currently detects `bionic`. +| `{platform}` | The platform that the application is running on. Currently detects `jammy`, `noble`, etc. | `{architecture}` | The architecture of the system as returned by Ruby. The value is typically one of `x86_64` or `x86`. ## Configuration @@ -95,5 +95,5 @@ In addition to declaring a specific versions to use, you can also specify a boun [`config/repository.yml`]: ../config/repository.yml [`JavaBuildpack::Repository::ConfiguredItem`]: ../lib/java_buildpack/repository/configured_item.rb [Configuration and Extension]: ../README.md#configuration-and-extension -[example]: https://java-buildpack.cloudfoundry.org/openjdk/bionic/x86_64/index.yml +[example]: https://java-buildpack.cloudfoundry.org/openjdk/jammy/x86_64/index.yml diff --git a/docs/framework-google_stackdriver_debugger.md b/docs/framework-google_stackdriver_debugger.md index adf4bca22a..82d1a4b991 100644 --- a/docs/framework-google_stackdriver_debugger.md +++ b/docs/framework-google_stackdriver_debugger.md @@ -39,5 +39,5 @@ The framework can be configured by modifying the [`config/google_stackdriver_deb [`config/google_stackdriver_debugger.yml`]: ../config/google_stackdriver_debugger.yml [Google Stackdriver Debugger Service]: https://cloud.google.com/debugger/ [repositories]: extending-repositories.md -[this listing]: https://java-buildpack.cloudfoundry.org/google-stackdriver-debugger/bionic/x86_64/index.yml +[this listing]: https://java-buildpack.cloudfoundry.org/google-stackdriver-debugger/jammy/x86_64/index.yml [version syntax]: extending-repositories.md#version-syntax-and-ordering diff --git a/docs/framework-google_stackdriver_profiler.md b/docs/framework-google_stackdriver_profiler.md index bbc174efaa..7bc3fa645f 100644 --- a/docs/framework-google_stackdriver_profiler.md +++ b/docs/framework-google_stackdriver_profiler.md @@ -39,5 +39,5 @@ The framework can be configured by modifying the [`config/google_stackdriver_pro [`config/google_stackdriver_profiler.yml`]: ../config/google_stackdriver_profiler.yml [Google Stackdriver Profiler Service]: https://cloud.google.com/profiler/ [repositories]: extending-repositories.md -[this listing]: https://java-buildpack.cloudfoundry.org/google-stackdriver-profiler/bionic/x86_64/index.yml +[this listing]: https://java-buildpack.cloudfoundry.org/google-stackdriver-profiler/jammy/x86_64/index.yml [version syntax]: extending-repositories.md#version-syntax-and-ordering diff --git a/docs/framework-your_kit_profiler.md b/docs/framework-your_kit_profiler.md index 45d98685a2..8c56095116 100644 --- a/docs/framework-your_kit_profiler.md +++ b/docs/framework-your_kit_profiler.md @@ -24,7 +24,7 @@ The framework can be configured by creating or modifying the [`config/your_kit_p | `enabled` | Whether to enable the YourKit Profiler | `port` | The port that the YourKit Profiler will listen on. Defaults to `10001`. | `repository_root` | The URL of the YourKit Profiler repository index ([details][repositories]). -| `version` | The version of the YourKit Profiler to use. Candidate versions can be found in the listings for [bionic][]. +| `version` | The version of the YourKit Profiler to use. Candidate versions can be found in the listings for [jammy][]. ## Creating SSH Tunnel After starting an application with the YourKit Profiler enabled, an SSH tunnel must be created to the container. To create that SSH container, execute the following command: @@ -40,7 +40,7 @@ Once the SSH tunnel has been created, your YourKit Profiler should connect to `l ![YourKit Configuration](framework-your_kit_profiler.png) [`config/your_kit_profiler.yml`]: ../config/your_kit_profiler.yml -[bionic]: https://download.run.pivotal.io/your-kit/bioni/x86_64/index.yml +[jammy]: https://download.run.pivotal.io/your-kit/bioni/x86_64/index.yml [Configuration and Extension]: ../README.md#configuration-and-extension [repositories]: extending-repositories.md [version syntax]: extending-repositories.md#version-syntax-and-ordering diff --git a/docs/jre-graal_vm_jre.md b/docs/jre-graal_vm_jre.md index c80ef30372..5ec9a60144 100644 --- a/docs/jre-graal_vm_jre.md +++ b/docs/jre-graal_vm_jre.md @@ -44,7 +44,7 @@ cf restage | `jre.repository_root` | The URL of the GraalVM repository index ([details][repositories]). | `jre.version` | The version of Java runtime to use. Candidate versions can be found in the the repository that you have created to house the JREs. | `jvmkill.repository_root` | The URL of the `jvmkill` repository index ([details][repositories]). -| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [bionic][jvmkill-bionic]. +| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [jammy][jvmkill-jammy]. | `memory_calculator` | Memory calculator defaults, described below under "Memory". ### Additional Resources @@ -169,7 +169,7 @@ JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=99199 [`config/graal_vm_jre.yml`]: ../config/graal_vm_jre.yml [Configuration and Extension]: ../README.md#configuration-and-extension [Java Buildpack Memory Calculator]: https://github.com/cloudfoundry/java-buildpack-memory-calculator -[jvmkill-bionic]: https://java-buildpack.cloudfoundry.org/jvmkill/bionic/x86_64/index.yml +[jvmkill-jammy]: https://java-buildpack.cloudfoundry.org/jvmkill/jammy/x86_64/index.yml [Memory Calculator's README]: https://github.com/cloudfoundry/java-buildpack-memory-calculator [OpenJDK JRE]: jre-open_jdk_jre.md [GraalVM]: https://www.graalvm.org/ diff --git a/docs/jre-open_jdk_jre.md b/docs/jre-open_jdk_jre.md index 050de39b28..f5cac3083e 100644 --- a/docs/jre-open_jdk_jre.md +++ b/docs/jre-open_jdk_jre.md @@ -25,9 +25,9 @@ The JRE can be configured by modifying the [`config/open_jdk_jre.yml`][] file in | Name | Description | ---- | ----------- | `jre.repository_root` | The URL of the OpenJDK repository index ([details][repositories]). -| `jre.version` | The version of Java runtime to use. Candidate versions can be found in the listings for [bionic][]. Note: version 1.8.0 and higher require the `memory_sizes` and `memory_heuristics` mappings to specify `metaspace` rather than `permgen`. +| `jre.version` | The version of Java runtime to use. Candidate versions can be found in the listings for [jammy][]. Note: version 1.8.0 and higher require the `memory_sizes` and `memory_heuristics` mappings to specify `metaspace` rather than `permgen`. | `jvmkill.repository_root` | The URL of the `jvmkill` repository index ([details][repositories]). -| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [bionic][jvmkill-bionic]. +| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [jammy][jvmkill-jammy]. | `memory_calculator` | Memory calculator defaults, described below under "Memory". ### Additional Resources @@ -152,10 +152,10 @@ JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=99199 ``` [`config/open_jdk_jre.yml`]: ../config/open_jdk_jre.yml -[bionic]: https://java-buildpack.cloudfoundry.org/openjdk/bionic/x86_64/index.yml +[jammy]: https://java-buildpack.cloudfoundry.org/openjdk/jammy/x86_64/index.yml [Configuration and Extension]: ../README.md#configuration-and-extension [Java Buildpack Memory Calculator]: https://github.com/cloudfoundry/java-buildpack-memory-calculator -[jvmkill-bionic]: https://java-buildpack.cloudfoundry.org/jvmkill/bionic/x86_64/index.yml +[jvmkill-jammy]: https://java-buildpack.cloudfoundry.org/jvmkill/jammy/x86_64/index.yml [Memory Calculator's README]: https://github.com/cloudfoundry/java-buildpack-memory-calculator [OpenJDK]: http://openjdk.java.net [repositories]: extending-repositories.md diff --git a/docs/jre-oracle_jre.md b/docs/jre-oracle_jre.md index 48d1091ae5..2b0635d3d0 100644 --- a/docs/jre-oracle_jre.md +++ b/docs/jre-oracle_jre.md @@ -44,7 +44,7 @@ cf restage | `jre.repository_root` | The URL of the Oracle repository index ([details][repositories]). | `jre.version` | The version of Java runtime to use. Candidate versions can be found in the the repository that you have created to house the JREs. Note: version 1.8.0 and higher require the `memory_sizes` and `memory_heuristics` mappings to specify `metaspace` rather than `permgen`. | `jvmkill.repository_root` | The URL of the `jvmkill` repository index ([details][repositories]). -| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [bionic][jvmkill-bionic]. +| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [jammy][jvmkill-jammy]. | `memory_calculator` | Memory calculator defaults, described below under "Memory". ### Additional Resources @@ -172,7 +172,7 @@ JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=99199 [`config/oracle_jre.yml`]: ../config/oracle_jre.yml [Configuration and Extension]: ../README.md#configuration-and-extension [Java Buildpack Memory Calculator]: https://github.com/cloudfoundry/java-buildpack-memory-calculator -[jvmkill-bionic]: https://java-buildpack.cloudfoundry.org/jvmkill/bionic/x86_64/index.yml +[jvmkill-jammy]: https://java-buildpack.cloudfoundry.org/jvmkill/jammy/x86_64/index.yml [Memory Calculator's README]: https://github.com/cloudfoundry/java-buildpack-memory-calculator [OpenJDK JRE]: jre-open_jdk_jre.md [Oracle]: http://www.oracle.com/technetwork/java/index.html diff --git a/docs/jre-sap_machine_jre.md b/docs/jre-sap_machine_jre.md index 28057bb20d..2aee4e2fb3 100644 --- a/docs/jre-sap_machine_jre.md +++ b/docs/jre-sap_machine_jre.md @@ -32,9 +32,9 @@ cf restage | Name | Description | ---- | ----------- | `jre.repository_root` | The URL of the SapMachine repository index ([details][repositories]). -| `jre.version` | The version of Java runtime to use. Candidate versions can be found in the listings for [bionic][]. Note: version 1.8.0 and higher require the `memory_sizes` and `memory_heuristics` mappings to specify `metaspace` rather than `permgen`. +| `jre.version` | The version of Java runtime to use. Candidate versions can be found in the listings for [jammy][]. Note: version 1.8.0 and higher require the `memory_sizes` and `memory_heuristics` mappings to specify `metaspace` rather than `permgen`. | `jvmkill.repository_root` | The URL of the `jvmkill` repository index ([details][repositories]). -| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [bionic][jvmkill-bionic]. +| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [jammy][jvmkill-jammy]. | `memory_calculator` | Memory calculator defaults, described below under "Memory". ### Additional Resources @@ -155,10 +155,10 @@ JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=99199 ``` [`config/sap_machine_jre.yml`]: ../config/sap_machine_jre.yml -[bionic]: https://java-buildpack.cloudfoundry.org/openjdk/bionic/x86_64/index.yml +[jammy]: https://java-buildpack.cloudfoundry.org/openjdk/jammy/x86_64/index.yml [Configuration and Extension]: ../README.md#configuration-and-extension [Java Buildpack Memory Calculator]: https://github.com/cloudfoundry/java-buildpack-memory-calculator -[jvmkill-bionic]: https://java-buildpack.cloudfoundry.org/jvmkill/bionic/x86_64/index.yml +[jvmkill-jammy]: https://java-buildpack.cloudfoundry.org/jvmkill/jammy/x86_64/index.yml [Memory Calculator's README]: https://github.com/cloudfoundry/java-buildpack-memory-calculator [repositories]: extending-repositories.md [SapMachine]: https://sapmachine.io diff --git a/docs/jre-zing_jre.md b/docs/jre-zing_jre.md index 8e4b097317..c29adb9595 100644 --- a/docs/jre-zing_jre.md +++ b/docs/jre-zing_jre.md @@ -36,7 +36,7 @@ cf restage | `jre.repository_root` | The URL of the Azul Platform Prime repository index ([details][repositories]). | `jre.version` | The version of Java runtime to use. Note: version 1.8.0 and higher require the `memory_sizes` and `memory_heuristics` mappings to specify `metaspace` rather than `permgen`. | `jvmkill.repository_root` | The URL of the `jvmkill` repository index ([details][repositories]). -| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [bionic][jvmkill-bionic]. +| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [jammy][jvmkill-jammy]. | `memory_calculator` | Memory calculator defaults, described below under "Memory". ### Additional Resources @@ -138,7 +138,7 @@ JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=99199 [Azul Platform Prime]: https://www.azul.com/products/prime/ [Configuration and Extension]: ../README.md#configuration-and-extension [Java Buildpack Memory Calculator]: https://github.com/cloudfoundry/java-buildpack-memory-calculator -[jvmkill-bionic]: https://java-buildpack.cloudfoundry.org/jvmkill/bionic/x86_64/index.yml +[jvmkill-jammy]: https://java-buildpack.cloudfoundry.org/jvmkill/jammy/x86_64/index.yml [Memory Calculator's README]: https://github.com/cloudfoundry/java-buildpack-memory-calculator [repositories]: extending-repositories.md [version syntax]: extending-repositories.md#version-syntax-and-ordering diff --git a/docs/jre-zulu_jre.md b/docs/jre-zulu_jre.md index cc70bec43b..8d5bbb5bdd 100644 --- a/docs/jre-zulu_jre.md +++ b/docs/jre-zulu_jre.md @@ -35,7 +35,7 @@ cf restage | `jre.repository_root` | The URL of the Zulu repository index ([details][repositories]). | `jre.version` | The version of Java runtime to use. Note: version 1.8.0 and higher require the `memory_sizes` and `memory_heuristics` mappings to specify `metaspace` rather than `permgen`. | `jvmkill.repository_root` | The URL of the `jvmkill` repository index ([details][repositories]). -| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [bionic][jvmkill-bionic]. +| `jvmkill.version` | The version of `jvmkill` to use. Candidate versions can be found in the listings for [jammy][jvmkill-jammy]. | `memory_calculator` | Memory calculator defaults, described below under "Memory". ### Additional Resources @@ -164,7 +164,7 @@ JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=99199 [Azul Zulu]: https://www.azul.com/products/zulu/ [Configuration and Extension]: ../README.md#configuration-and-extension [Java Buildpack Memory Calculator]: https://github.com/cloudfoundry/java-buildpack-memory-calculator -[jvmkill-bionic]: https://java-buildpack.cloudfoundry.org/jvmkill/bionic/x86_64/index.yml +[jvmkill-jammy]: https://java-buildpack.cloudfoundry.org/jvmkill/jammy/x86_64/index.yml [Memory Calculator's README]: https://github.com/cloudfoundry/java-buildpack-memory-calculator [repositories]: extending-repositories.md [version syntax]: extending-repositories.md#version-syntax-and-ordering diff --git a/lib/java_buildpack/container/tomcat/tomcat_geode_store.rb b/lib/java_buildpack/container/tomcat/tomcat_geode_store.rb index 5973f26fe3..c3b8c69fd9 100644 --- a/lib/java_buildpack/container/tomcat/tomcat_geode_store.rb +++ b/lib/java_buildpack/container/tomcat/tomcat_geode_store.rb @@ -129,7 +129,8 @@ def cache_client_xml_path end def create_cache_client_xml - document = REXML::Document.new('') + document = REXML::Document.new + document << REXML::XMLDecl.new('1.0', 'UTF-8') add_client_cache document write_xml cache_client_xml_path, document end diff --git a/lib/java_buildpack/framework/multi_buildpack.rb b/lib/java_buildpack/framework/multi_buildpack.rb index 1b0500d4a8..a1c97f7617 100644 --- a/lib/java_buildpack/framework/multi_buildpack.rb +++ b/lib/java_buildpack/framework/multi_buildpack.rb @@ -269,7 +269,7 @@ def add_system_properties(java_opts) end def config(config_file) - YAML.load_file(config_file) + YAML.load_file(config_file, permitted_classes: [Symbol], aliases: true) end def config_file(dep_directory) diff --git a/lib/java_buildpack/repository/repository_index.rb b/lib/java_buildpack/repository/repository_index.rb index 17529c351d..728ac7d480 100644 --- a/lib/java_buildpack/repository/repository_index.rb +++ b/lib/java_buildpack/repository/repository_index.rb @@ -39,7 +39,7 @@ def initialize(repository_root) .chomp('/') cache.get("#{canonical repository_root}#{INDEX_PATH}") do |file| - @index = YAML.load_file(file) + @index = YAML.load_file(file, permitted_classes: [Symbol], aliases: true) @logger.debug { @index } end end diff --git a/lib/java_buildpack/util/configuration_utils.rb b/lib/java_buildpack/util/configuration_utils.rb index 687ebaa7c7..9bad2b07fb 100644 --- a/lib/java_buildpack/util/configuration_utils.rb +++ b/lib/java_buildpack/util/configuration_utils.rb @@ -119,14 +119,14 @@ def header(file) def load_configuration(file, operator_provided, operator_var_name, user_provided, user_var_name, clean_nil_values, should_log) - configuration = YAML.load_file(file) + configuration = YAML.load_file(file, permitted_classes: [Symbol], aliases: true) logger.debug { "Configuration from #{file}: #{configuration}" } if should_log if operator_provided begin operator_provided_value = YAML.safe_load(operator_provided) configuration = merge_configuration(configuration, operator_provided_value, operator_var_name, should_log) - rescue Psych::SyntaxError => e + rescue Psych::SyntaxError, Psych::DisallowedClass => e raise "Default configuration value in environment variable #{operator_var_name} has invalid syntax: #{e}" end end @@ -135,7 +135,7 @@ def load_configuration(file, operator_provided, operator_var_name, user_provided begin user_provided_value = YAML.safe_load(user_provided) configuration = merge_configuration(configuration, user_provided_value, user_var_name, should_log) - rescue Psych::SyntaxError => e + rescue Psych::SyntaxError, Psych::DisallowedClass => e raise "User configuration value in environment variable #{user_var_name} has invalid syntax: #{e}" end logger.debug { "Configuration from #{file} modified with: #{user_provided}" } if should_log diff --git a/lib/java_buildpack/util/tokenized_version.rb b/lib/java_buildpack/util/tokenized_version.rb index dacd564d83..12e0e82dc0 100644 --- a/lib/java_buildpack/util/tokenized_version.rb +++ b/lib/java_buildpack/util/tokenized_version.rb @@ -93,10 +93,7 @@ def major_or_minor_and_tail(s) tokens = s.match(/^([^.]+)(?:\.(.*))?/) - # disable as we still have to support Ruby 2.5, remove & update when we drop Bionic support - # rubocop:disable Style/SlicingWithRange - major_or_minor, tail = tokens[1..-1] - # rubocop:enable Style/SlicingWithRange + major_or_minor, tail = tokens[1..] raise "Invalid major or minor version '#{major_or_minor}'" unless valid_major_minor_or_micro major_or_minor end @@ -113,10 +110,7 @@ def micro_and_qualifier(s) tokens = s.match(/^([^_]+)(?:_(.*))?/) - # disable as we still have to support Ruby 2.5, remove & update when we drop Bionic support - # rubocop:disable Style/SlicingWithRange - micro, qualifier = tokens[1..-1] - # rubocop:enable Style/SlicingWithRange + micro, qualifier = tokens[1..] raise "Invalid micro version '#{micro}'" unless valid_major_minor_or_micro micro raise "Invalid qualifier '#{qualifier}'" unless valid_qualifier qualifier diff --git a/rakelib/package.rb b/rakelib/package.rb index f3948ee189..3635f27d55 100644 --- a/rakelib/package.rb +++ b/rakelib/package.rb @@ -76,7 +76,7 @@ def self.version BUILDPACK_VERSION = JavaBuildpack::BuildpackVersion.new(false).freeze - PLATFORMS = %w[bionic jammy].freeze + PLATFORMS = %w[jammy noble].freeze STAGING_DIR = "#{BUILD_DIR}/staging".freeze diff --git a/spec/fixtures/container_no_tomcat_version_geode_store_context_after.xml b/spec/fixtures/container_no_tomcat_version_geode_store_context_after.xml index 4dac5ae1c8..6eec7d93fe 100644 --- a/spec/fixtures/container_no_tomcat_version_geode_store_context_after.xml +++ b/spec/fixtures/container_no_tomcat_version_geode_store_context_after.xml @@ -14,7 +14,7 @@ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. - --> + --> diff --git a/spec/fixtures/container_tomcat_geode_store_context_after.xml b/spec/fixtures/container_tomcat_geode_store_context_after.xml index 8eb45842b4..5eb5387deb 100644 --- a/spec/fixtures/container_tomcat_geode_store_context_after.xml +++ b/spec/fixtures/container_tomcat_geode_store_context_after.xml @@ -14,7 +14,7 @@ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. - --> + --> diff --git a/spec/fixtures/container_tomcat_redis_store_context_after.xml b/spec/fixtures/container_tomcat_redis_store_context_after.xml index 6fdfc7bf0a..d762cf8cfb 100644 --- a/spec/fixtures/container_tomcat_redis_store_context_after.xml +++ b/spec/fixtures/container_tomcat_redis_store_context_after.xml @@ -14,7 +14,7 @@ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. - --> + --> diff --git a/spec/java_buildpack/framework/java_memory_assistant_spec.rb b/spec/java_buildpack/framework/java_memory_assistant_spec.rb index 6390202362..46ec183291 100644 --- a/spec/java_buildpack/framework/java_memory_assistant_spec.rb +++ b/spec/java_buildpack/framework/java_memory_assistant_spec.rb @@ -73,3 +73,9 @@ class StubJavaMemoryAssistant < JavaBuildpack::Framework::JavaMemoryAssistant public :command, :sub_components, :supports? end + +def sub_configuration_context(configuration) + c = context.clone + c[:configuration] = configuration + c +end diff --git a/spec/java_buildpack/util/cache/download_cache_spec.rb b/spec/java_buildpack/util/cache/download_cache_spec.rb index c082596df5..b482e8834b 100644 --- a/spec/java_buildpack/util/cache/download_cache_spec.rb +++ b/spec/java_buildpack/util/cache/download_cache_spec.rb @@ -326,18 +326,7 @@ .to_return(status: 200, body: 'foo-cached', headers: { Etag: 'foo-etag', 'Last-Modified' => 'foo-last-modified' }) allow(Net::HTTP).to receive(:Proxy).and_call_original - - # behavior changed between ruby 2 & 3 with how default hash kwargs are passed - # this causes different arguments for the mock based on the ruby version - # Remove this when we drop support for ruby 2 - case RUBY_VERSION - when /2\.\d+\.\d+/ - allow(Net::HTTP).to receive(:start).with('foo-uri', 80, {}).and_call_original - when /3\.\d+\.\d+/ - allow(Net::HTTP).to receive(:start).with('foo-uri', 80).and_call_original - else - raise 'unexpected ruby version' - end + allow(Net::HTTP).to receive(:start).with('foo-uri', 80).and_call_original download_cache.get(uri) {} end @@ -348,18 +337,7 @@ allow(ca_certs_directory).to receive(:exist?).and_return(true) allow(Net::HTTP).to receive(:Proxy).and_call_original - - # behavior changed between ruby 2 & 3 with how default hash kwargs are passed - # this causes different arguments for the mock based on the ruby version - # Remove this when we drop support for ruby 2 - case RUBY_VERSION - when /2\.\d+\.\d+/ - allow(Net::HTTP).to receive(:start).with('foo-uri', 80, {}).and_call_original - when /3\.\d+\.\d+/ - allow(Net::HTTP).to receive(:start).with('foo-uri', 80).and_call_original - else - raise 'unexpected ruby version' - end + allow(Net::HTTP).to receive(:start).with('foo-uri', 80).and_call_original download_cache.get(uri) {} end diff --git a/spec/java_buildpack/util/filtering_pathname_spec.rb b/spec/java_buildpack/util/filtering_pathname_spec.rb index 730cf66be6..0fdf972073 100644 --- a/spec/java_buildpack/util/filtering_pathname_spec.rb +++ b/spec/java_buildpack/util/filtering_pathname_spec.rb @@ -409,15 +409,15 @@ end it 'raises error if getwd is used' do - expect { described_class.getwd }.to raise_error(/undefined method `getwd'/) + expect { described_class.getwd }.to raise_error(NoMethodError, /undefined method [`']getwd'/) end it 'raises error if glob is used' do - expect { described_class.glob '' }.to raise_error(/undefined method `glob'/) + expect { described_class.glob '' }.to raise_error(NoMethodError, /undefined method [`']glob'/) end it 'raises error if pwd is used' do - expect { described_class.pwd }.to raise_error(/undefined method `pwd'/) + expect { described_class.pwd }.to raise_error(NoMethodError, /undefined method [`']pwd'/) end def create_file(filename) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c6b0021bf5..6012db5df9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require 'tmpdir' require 'webmock/rspec' WebMock.disable_net_connect!(allow: 'codeclimate.com')