Skip to content

Commit

Permalink
(PDB-5622) Select Java 11+ on Platform 8
Browse files Browse the repository at this point in the history
Does not change PE package builds.

Add a puppet-platform-version argument to EZBake defaulting to 7 (which
maintains the current dependency list) when building for Puppet Platform
8 select newer more appropriate JDK's for each platform. Fails for
unrecognized Platform versions so that we remember to select appropriate
JDKs.

Selecting JDK 11 for SLES 12 means that we will only be compatible with
the most recent (and supported) SP 5.
  • Loading branch information
austb committed Apr 5, 2023
1 parent ad656db commit 91349fa
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).

## [Unreleased]
Added:
* Add `puppet-platform-version` parameter, defaulting to 7, to allow EZBake
to pick newer java versions for newer platforms

Removed:
* (EZ-149) Removed debian 9 from build targets
* (maint) Removed pl-el-6-i386 and base-xenial-i386.cow as build defaults for foss.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module EZBake
:project => {{{project}}},
:version => {{{packaging-version}}},
:release => {{{packaging-release}}},
:platform_version => {{{puppet-platform-version}}},
:real_name => {{{real-name}}},
:user => {{{user}}},
:numeric_uid_gid => {{{numeric-uid-gid}}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ case $os in
esac

# bash will eat your spaces, so let's array. see http://mywiki.wooledge.org/BashFAQ/050 for more fun.
params=("--user" "<%= EZBake::Config[:user] -%>" "--group" "<%= EZBake::Config[:group] -%>" "--chdir" "$dir" "--realname" "<%= EZBake::Config[:real_name] -%>" "--operating-system" "$os" "--name" "<%= EZBake::Config[:project] -%>" "--package-version" "<%= EZBake::Config[:version] -%>" "--release" "<%= EZBake::Config[:release] -%>")
params=("--user" "<%= EZBake::Config[:user] -%>" "--group" "<%= EZBake::Config[:group] -%>" "--chdir" "$dir" "--realname" "<%= EZBake::Config[:real_name] -%>" "--operating-system" "$os" "--name" "<%= EZBake::Config[:project] -%>" "--package-version" "<%= EZBake::Config[:version] -%>" "--release" "<%= EZBake::Config[:release] -%>" "--platform-version" "<%= EZBake::Config[:platform_version] -%>")
if [ -n "$os_version" ]; then params+=("--os-version" "$os_version"); fi
if [ -n "$os_dist" ]; then params+=("--dist" "$os_dist"); fi

Expand Down
51 changes: 47 additions & 4 deletions resources/puppetlabs/lein-ezbake/template/global/ext/fpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
options.sles = 0
options.java = 'java-1.8.0-openjdk-headless'
options.release = 1
options.platform_version = 0
options.is_pe = false
options.replaces = {}
options.additional_dependencies = []
Expand Down Expand Up @@ -49,6 +50,9 @@
opts.on('--release RELEASE', 'RELEASE of the package') do |r|
options.release = r
end
opts.on('--platform-version VERSION', Integer, 'VERSION of the puppet platform this builds for') do |v|
options.platform_version = v
end
opts.on('--[no-]enterprise-build', 'Whether or not this is a PE build') do |e|
options.is_pe = e
end
Expand Down Expand Up @@ -176,6 +180,18 @@
options.systemd = 1
options.systemd_el = 1
elsif options.operating_system == :el && options.os_version >= 7 # systemd el
if ! options.is_pe
options.java =
case options.platform_version
when 8
'java-11-openjdk-headless'
when 6..7
'java-8-openjdk-headless'
else
fail "Unknown Puppet Platform Version #{options.platform_version}"
end
end

options.systemd = 1
options.systemd_el = 1
elsif options.operating_system == :el # old el
Expand All @@ -188,7 +204,17 @@
options.systemd = 1
options.systemd_sles = 1
options.sles = 1
options.java = 'java-1_8_0-openjdk-headless'
if ! options.is_pe
options.java =
case options.platform_version
when 8
'java-11-openjdk-headless'
when 6..7
'java-1_8_0-openjdk-headless'
else
fail "Unknown Puppet Platform Version #{options.platform_version}"
end
end
elsif options.operating_system == :sles #old sles
options.sysvinit = 1
options.old_sles = 1
Expand Down Expand Up @@ -286,10 +312,27 @@
if options.dist != "#{options.operating_system}#{options.os_version}"
options.release = "#{options.release}#{options.dist}"
end
options.java = 'openjdk-8-jre-headless'

if options.dist =~ /buster|bullseye/ # debian 10+ uses java11
options.java = 'openjdk-11-jre-headless'
if ! options.is_pe
options.java =
case options.platform_version
when 8
# debian 10/11 and Ubuntu 18/20/22 use java11
if options.dist =~ /buster|bullseye|bionic|focal|jammy/
'openjdk-11-jre-headless'
elsif options.dist =~ /bookworm/
# Debian 12 uses java 17
'openjdk-17-jre-headless'
end
when 6..7
if options.dist =~ /buster|bullseye/ # debian 10+ uses java11
'openjdk-11-jre-headless'
else
'openjdk-8-jre-headless'
end
else
fail "Unknown Puppet Platform Version #{options.platform_version}"
end
end

fpm_opts << '--deb-build-depends cdbs'
Expand Down
2 changes: 2 additions & 0 deletions src/puppetlabs/ezbake/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
{(schema/optional-key :user) schema/Str
(schema/optional-key :numeric-uid-gid) schema/Int
(schema/optional-key :group) schema/Str
(schema/optional-key :puppet-platform-version) schema/Int
(schema/optional-key :bootstrap-source) BootstrapSource
(schema/optional-key :create-dirs) [schema/Str]
(schema/optional-key :build-type) schema/Str
Expand Down Expand Up @@ -575,6 +576,7 @@ Additional uberjar dependencies:
:packaging-release (-> (:version lein-project)
(generate-package-release-from-version timestamp)
as-ruby-literal)
:puppet-platform-version (local->ruby :puppet-platform-version 7)
:real-name (-> (:name lein-project) get-real-name as-ruby-literal)
:user (local->ruby :user (:name lein-project))
:numeric-uid-gid (local->ruby :numeric-uid-gid nil)
Expand Down
1 change: 1 addition & 0 deletions test/unit/puppetlabs/ezbake/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
:debian-pre-start-action "[]"
:debian-preinst "[]"
:real-name "'dummy'"
:puppet-platform-version "7"
:debian-postinst "[]"}]
;; Using diff may make it easier (with some additional
;; pretty-printing) to spot small differences.
Expand Down

0 comments on commit 91349fa

Please sign in to comment.