Skip to content

Commit

Permalink
Use Java 17 with openHAB 4 (#413)
Browse files Browse the repository at this point in the history
Related to openhab/openhab-core#2994

Signed-off-by: Wouter Born <github@maindrain.net>
  • Loading branch information
wborn authored Dec 19, 2022
1 parent 1520a39 commit fb4c8c7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The following Docker platforms are supported (automatically determined):
* `linux/arm64`
* `linux/arm/v7`

There is no `linux/arm/v7` Alpine image for openHAB 3 because the openjdk11 package is unavailable for this platform.
There is no `linux/arm/v7` Alpine image for openHAB 3 (or newer) because the required openjdk package is unavailable for this platform.

## Usage

Expand Down Expand Up @@ -321,9 +321,9 @@ When the container runs in server mode you can also add a console logger so it p

`docker logs openhab`

To use a console logger with openHAB 3.x, edit `userdata/etc/log4j2.xml` and add the following appender to the "Root logger" and "openhab.event" logger configurations: `<AppenderRef ref="STDOUT"/>`
To use a console logger with openHAB 3 (or newer), edit `userdata/etc/log4j2.xml` and add the following appender to the "Root logger" and "openhab.event" logger configurations: `<AppenderRef ref="STDOUT"/>`

To use a console logger with openHAB 2.x, edit `userdata/etc/org.ops4j.pax.logging.cfg` and then:
To use a console logger with openHAB 2, edit `userdata/etc/org.ops4j.pax.logging.cfg` and then:

* Update the appenderRefs line to: `log4j2.rootLogger.appenderRefs = out, osgi, console`
* Add the following line: `log4j2.rootLogger.appenderRef.console.ref = STDOUT`
Expand Down
2 changes: 1 addition & 1 deletion alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ RUN JAVA_HOME=$(ls -d /usr/lib/jvm/*jdk*) && \
# Set permissions for openHAB. Export TERM variable. See issue #30 for details!
RUN version="$(echo $OPENHAB_VERSION | sed 's/snapshot/SNAPSHOT/g')" && \
if [ $(echo $version | grep -E '^.+\.(M|RC).+$') ]; then url="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/${version}/openhab-${version}.zip"; \
elif [ $(echo $version | grep -E '^3\..+-SNAPSHOT$') ]; then url="https://ci.openhab.org/job/openHAB3-Distribution/lastSuccessfulBuild/artifact/distributions/openhab/target/openhab-${version}.zip"; \
elif [ $(echo $version | grep -E '^4\..+-SNAPSHOT$') ]; then url="https://ci.openhab.org/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab/target/openhab-${version}.zip"; \
else url="https://openhab.jfrog.io/openhab/libs-release/org/openhab/distro/openhab/${version}/openhab-${version}.zip"; fi && \
wget -nv -O /tmp/openhab.zip "$url" && \
unzip -q /tmp/openhab.zip -d "${OPENHAB_HOME}" -x "*.bat" "*.ps1" "*.psm1" && \
Expand Down
2 changes: 1 addition & 1 deletion alpine/update
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup() {

# Download snapshots from Jenkins and download milestones and releases using openHAB redirect.
if test "${oh_version#*-SNAPSHOT}" != "${oh_version}"; then
addons_download_location="https://ci.openhab.org/job/openHAB3-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-addons/target/openhab-addons-${oh_version}.kar"
addons_download_location="https://ci.openhab.org/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-addons/target/openhab-addons-${oh_version}.kar"
elif [ "${oh_version}" = "$current_version" ]; then
echo "You are already on openHAB $current_version" >&2
exit 1
Expand Down
2 changes: 1 addition & 1 deletion debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ RUN wget -nv -O - https://packages.adoptium.net/artifactory/api/gpg/key/public |
# Set permissions for openHAB. Export TERM variable. See issue #30 for details!
RUN version="$(echo $OPENHAB_VERSION | sed 's/snapshot/SNAPSHOT/g')" && \
if [ $(echo $version | grep -E '^.+\.(M|RC).+$') ]; then url="https://openhab.jfrog.io/openhab/libs-milestone-local/org/openhab/distro/openhab/${version}/openhab-${version}.zip"; \
elif [ $(echo $version | grep -E '^3\..+-SNAPSHOT$') ]; then url="https://ci.openhab.org/job/openHAB3-Distribution/lastSuccessfulBuild/artifact/distributions/openhab/target/openhab-${version}.zip"; \
elif [ $(echo $version | grep -E '^4\..+-SNAPSHOT$') ]; then url="https://ci.openhab.org/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab/target/openhab-${version}.zip"; \
else url="https://openhab.jfrog.io/openhab/libs-release/org/openhab/distro/openhab/${version}/openhab-${version}.zip"; fi && \
wget -nv -O /tmp/openhab.zip "$url" && \
unzip -q /tmp/openhab.zip -d "${OPENHAB_HOME}" -x "*.bat" "*.ps1" "*.psm1" && \
Expand Down
2 changes: 1 addition & 1 deletion debian/update
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup() {

# Download snapshots from Jenkins and download milestones and releases using openHAB redirect.
if test "${oh_version#*-SNAPSHOT}" != "${oh_version}"; then
addons_download_location="https://ci.openhab.org/job/openHAB3-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-addons/target/openhab-addons-${oh_version}.kar"
addons_download_location="https://ci.openhab.org/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-addons/target/openhab-addons-${oh_version}.kar"
elif [ "${oh_version}" = "$current_version" ]; then
echo "You are already on openHAB $current_version" >&2
exit 1
Expand Down
12 changes: 9 additions & 3 deletions helper-functions
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ platforms() {
local version="$1"
local base="$2"

if [[ "$version" =~ ^3.*$ ]] && [ "$base" == "alpine" ]; then
# There is no linux/arm/v7 Alpine image for openHAB 3 because the openjdk11 package is unavailable for this architecture
if [ "$base" == "alpine" ]; then
# There is no linux/arm/v7 Alpine image for openHAB 3 (or newer) because the required openjdk package is unavailable for this architecture
echo "linux/amd64,linux/arm64"
else
echo "linux/amd64,linux/arm64,linux/arm/v7"
Expand Down Expand Up @@ -217,7 +217,13 @@ build() {
local dist="$2"
local push="$3"

local build_arg_options="--build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") --build-arg VCS_REF=$(git rev-parse HEAD) --build-arg JAVA_VERSION=11 --build-arg OPENHAB_VERSION=$openhab_version"
local java_version=""
case $openhab_version in
3.*) java_version="11";;
*) java_version="17";;
esac

local build_arg_options="--build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") --build-arg VCS_REF=$(git rev-parse HEAD) --build-arg JAVA_VERSION=$java_version --build-arg OPENHAB_VERSION=$openhab_version"
local tags=$(tags $openhab_version $dist)
local tag_options=${tags//$(docker_repo)/--tag $(docker_repo)}
local build_options="$build_arg_options --platform $(platforms $openhab_version $dist) $tag_options --progress plain $push"
Expand Down

0 comments on commit fb4c8c7

Please sign in to comment.