Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ NEO4JVERSION=4.4.0 make tag-ubi9-enterprise

## The build script

The build script [build-docker-image.sh](./build-docker-image.sh) will take these options and produce a Neo4j image and a neo4j-admin image, for the combination you request.
The build script [build-docker-image.sh](./build-scripts/build-docker-image.sh) will take these options and produce a Neo4j image and a neo4j-admin image, for the combination you request.
For example:
```bash
# debian based 4.4.22 community edition:
Expand All @@ -63,7 +63,7 @@ The resulting images will have a randomly generated tag, which is written into t

## Using the Convenience Makefile

The [Makefile](./Makefile) is a wrapper around the [build-docker-image.sh](./build-docker-image.sh).
The [Makefile](./Makefile) is a wrapper around [build-docker-image.sh](./build-scripts/build-docker-image.sh).
It mostly just adds extra functionality to help you build lots of images at once, or does extra steps like tagging, testing and generating release files.

The four actions it can do are:
Expand All @@ -75,12 +75,12 @@ The four actions it can do are:
For each action, it can be broken down by base image and community/enterprise type.
For example `build`, has the following make targets:
* `build`. Builds *every* variant.
* `build-debian`. Builds debian community and enterprise.
* `build-ubi9`. Builds redhat-ubi9 community and enterprise.
* `build-debian-community`
* `build-debian-enterprise`
* `build-ubi9-community`
* `build-ubi9-enterprise`
* `build-trixie`. Builds debian community and enterprise.
* `build-ubi10`. Builds redhat-ubi9 community and enterprise.
* `build-trixie-community`
* `build-trixie-enterprise`
* `build-ubi10-community`
* `build-ubi10-enterprise`

The other actions have the same targets.

Expand Down Expand Up @@ -140,7 +140,7 @@ $ NEO4JVERSION=5.5.0-SNAPSHOT make clean build

# Running the Tests

The tests are written in java, and require Maven plus JDK 17 (any JDK distributions should work, we use OpenJDK).
The tests are written in java, and require Maven plus JDK 21 (any JDK distributions should work, we use OpenJDK).

The tests require some information about the image before they can test it.
These can be passed as an environment variable or a command line parameter when invoking maven:
Expand All @@ -157,7 +157,7 @@ These can be passed as an environment variable or a command line parameter when

## Using Maven
The Makefile can run the entire test suite.
1. Make sure `java --version` is java 17.
1. Make sure `java --version` is java 21.
2. `NEO4JVERSION=<VERSION> make test-<BASE OS>` This is a make target that will run these commands:
```bash
mvn test -Dimage=$(cat build/<BASE OS>/coredb/.image-id-enterprise) -Dadminimage=$(cat build/<BASE OS>/neo4j-admin/.image-id-enterprise) -Dedition=enterprise -Dversion=${NEO4JVERSION}
Expand All @@ -166,7 +166,7 @@ mvn test -Dimage=$(cat build/<BASE OS>/coredb/.image-id-community) -Dadminimage=

## In Intellij

1. Make sure the project SDK is java 17.
1. Make sure the project SDK is java 21.
3. Install the [EnvFile](https://plugins.jetbrains.com/plugin/7861-envfile) Intellij plugin.
5. Under Run Configurations edit the Template JUnit configuration:
1. Select the "EnvFile" tab
Expand Down Expand Up @@ -194,10 +194,5 @@ TESTCONTAINERS_RYUK_DISABLED=true;
TESTCONTAINERS_CHECKS_DISABLE=true
```

# Troubleshooting
## cannot find symbol `com.sun.security.auth.module.UnixSystem`

This can happen if you switch from java 17 to java 11 (or the other way) and then try to rebuild the tests in Intellij.

Check that the `java.version` property in the [pom.xml file](../master/pom.xml) is set to 17.

52 changes: 40 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test-%-community: build-%-community

## building

build: build-bullseye build-ubi9
build: build-ubi9 build-ubi10 build-bullseye build-trixie
.PHONY: build

build-bullseye: build-bullseye-community build-bullseye-enterprise
Expand All @@ -44,9 +44,18 @@ build-bullseye-community: build/bullseye/coredb/community/.sentinel
.PHONY: build-bullseye-community
build-bullseye-enterprise: build/bullseye/coredb/enterprise/.sentinel
.PHONY: build-bullseye-enterprise

build/bullseye/coredb/%/.sentinel::
> ./build-docker-image.sh $(NEO4JVERSION) "${*}" "bullseye"
> ./build-scripts/build-docker-image.sh $(NEO4JVERSION) "${*}" "bullseye"
> touch $@

build-trixie: build-trixie-community build-trixie-enterprise
.PHONY: build-trixie
build-trixie-community: build/trixie/coredb/community/.sentinel
.PHONY: build-trixie-community
build-trixie-enterprise: build/trixie/coredb/enterprise/.sentinel
.PHONY: build-trixie-enterprise
build/trixie/coredb/%/.sentinel::
> ./build-scripts/build-docker-image.sh $(NEO4JVERSION) "${*}" "trixie"
> touch $@

build-ubi9: build-ubi9-community build-ubi9-enterprise
Expand All @@ -55,20 +64,33 @@ build-ubi9-community: build/ubi9/coredb/community/.sentinel
.PHONY: build-ubi9-community
build-ubi9-enterprise: build/ubi9/coredb/enterprise/.sentinel
.PHONY: build-ubi9-enterprise

build/ubi9/coredb/%/.sentinel::
> ./build-docker-image.sh $(NEO4JVERSION) "${*}" "ubi9"
> ./build-scripts/build-docker-image.sh $(NEO4JVERSION) "${*}" "ubi9"
> touch $@

build-ubi10: build-ubi10-community build-ubi10-enterprise
.PHONY: build-ubi10
build-ubi10-community: build/ubi10/coredb/community/.sentinel
.PHONY: build-ubi10-community
build-ubi10-enterprise: build/ubi10/coredb/enterprise/.sentinel
.PHONY: build-ubi10-enterprise
build/ubi10/coredb/%/.sentinel::
> ./build-scripts/build-docker-image.sh $(NEO4JVERSION) "${*}" "ubi10"
> touch $@

## tagging

tag: tag-bullseye tag-ubi9
tag: tag-ubi9 tag-ubi10 tag-bullseye tag-trixie
.PHONY: tag

tag-bullseye: tag-bullseye-community tag-bullseye-enterprise
.PHONY: tag-bullseye
tag-trixie: tag-trixie-community tag-trixie-enterprise
.PHONY: tag-trixie
tag-ubi9: tag-ubi9-community tag-ubi9-enterprise
.PHONY: tag-ubi9
tag-ubi10: tag-ubi10-community tag-ubi10-enterprise
.PHONY: tag-ubi10

tag-%-community: build-%-community
> docker tag $$(cat ./build/${*}/coredb/.image-id-community) neo4j:$(NEO4JVERSION)-${*}
Expand All @@ -83,15 +105,21 @@ tag-%-enterprise: build-%-enterprise
## packaging and release

# create release images and loadable images
package: package-bullseye package-ubi9
package: package-ubi9 package-ubi10 package-bullseye package-trixie
.PHONY: package

package-bullseye: package-bullseye-community package-bullseye-enterprise package-bullseye-release-artifacts
.PHONY: package-bullseye

package-trixie: package-trixie-community package-trixie-enterprise package-trixie-release-artifacts
.PHONY: package-trixie

package-ubi9: package-ubi9-community package-ubi9-enterprise package-ubi9-release-artifacts
.PHONY: package-ubi9

package-ubi10: package-ubi10-community package-ubi10-enterprise package-ubi10-release-artifacts
.PHONY: package-ubi10

package-%-community: tag-%-community
> mkdir -p out
> docker save neo4j:$(NEO4JVERSION)-${*} > out/neo4j-community-$(NEO4JVERSION)-${*}-docker-loadable.tar
Expand All @@ -110,16 +138,16 @@ package-%-release-artifacts: build-%-community build-%-enterprise
> find out/${*} -name ".sentinel" -delete


# keep "debian" targets as an alias for bullseye until we update the build pipelines
# keep "debian" targets as an alias for latest debian
build-debian: build-debian-community build-debian-enterprise
.PHONY: build-debian
build-debian-community: build-bullseye-community
build-debian-community: build-trixie-community
> mkdir -p build/debian/
> cp --recursive build/bullseye/* build/debian/
> cp --recursive build/trixie/* build/debian/
.PHONY: build-debian-community
build-debian-enterprise: build-bullseye-enterprise
build-debian-enterprise: build-trixie-enterprise
> mkdir -p build/debian/
> cp --recursive build/bullseye/* build/debian/
> cp --recursive build/trixie/* build/debian/
.PHONY: build-debian-enterprise
tag-debian: tag-debian-community tag-debian-enterprise
.PHONY: tag-debian
Expand Down
21 changes: 8 additions & 13 deletions build-docker-image.sh → build-scripts/build-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ set -eu -o pipefail

ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "$ROOT_DIR/build-utils-common-functions.sh"
BUILD_DIR=${ROOT_DIR}/build
SRC_DIR=${ROOT_DIR}/docker-image-src
BUILD_DIR=${ROOT_DIR}/../build
SRC_DIR=${ROOT_DIR}/../docker-image-src
# shellcheck disable=SC2034 # Used in docker-common-functions.sh
TAR_CACHE=${ROOT_DIR}/in
TAR_CACHE=${ROOT_DIR}/../in

function usage
{
Expand Down Expand Up @@ -106,16 +106,11 @@ sed -i -e "s|%%NEO4J_TARBALL%%|$(tarball_name ${NEO4JVERSION} ${NEO4JEDITION})|"
sed -i -e "s|%%NEO4J_EDITION%%|${NEO4JEDITION}|" "${ADMIN_LOCALCXT_DIR}/Dockerfile"
sed -i -e "s|%%NEO4J_DIST_SITE%%|${DISTRIBUTION_SITE}|" "${ADMIN_LOCALCXT_DIR}/Dockerfile"

# add deprecation warning if needed
if [ "${IMAGE_OS}" = "ubi8" ]; then
dep_msg="echo \>\&2 \"\n=======================================================\n
Neo4j Red Hat UBI8 images are deprecated in favour of Red Hat UBI9.\n
Update your codebase to use Neo4j Docker image tags ending with -ubi9 instead of -ubi8.\n\n
This is the last Neo4j image available on Red Hat UBI8.\n
By continuing to use UBI8 tagged Neo4j images you will not get further updates, \n
including new features and security fixes.\n\n
This message can not be suppressed.\n
=======================================================\n\"\n"
# add deprecation warnings if needed
if contains_element "${IMAGE_OS}" "${DEPRECATED_IMAGE_OS[@]}"; then
echo "Image base ${IMAGE_OS} is deprecated, adding warnings."
source "$ROOT_DIR/deprecation-warnings.sh"
dep_msg=$(deprecation_message "${IMAGE_OS}" "${NEO4JVERSION}")
sed -i -e "s/#%%DEPRECATION_WARNING_PLACEHOLDER%%/$(echo ${dep_msg} | sed -z 's/\n/\\n/g')/" "${COREDB_LOCALCXT_DIR}/local-package/docker-entrypoint.sh"
sed -i -e "s/#%%DEPRECATION_WARNING_PLACEHOLDER%%/$(echo ${dep_msg} | sed -z 's/\n/\\n/g')/" "${ADMIN_LOCALCXT_DIR}/local-package/docker-entrypoint.sh"
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Common functions used by build-docker-image.sh and publish-neo4j-admin-image.sh

SUPPORTED_IMAGE_OS=("bullseye" "ubi9")
EDITIONS=("community" "enterprise")
DISTRIBUTION_SITE="https://dist.neo4j.org"

Expand Down Expand Up @@ -86,3 +85,24 @@ function fetch_tarball
wget ${DISTRIBUTION_SITE}/${tar_name} -O "$(cached_tarball ${version} ${edition})"
fi
}

echo "Calculating supported base images"
if [[ -z ${NEO4JVERSION:-""} ]]; then
echo >&2 "NEO4JVERSION is unset. Either set it in the environment or pass as argument to this script."
exit 0
fi

case "$(get_branch_from_version ${NEO4JVERSION})" in
calver | 5 )
SUPPORTED_IMAGE_OS=("bullseye" "trixie" "ubi9" "ubi10")
DEPRECATED_IMAGE_OS=("bullseye" "ubi8" "ubi9")
;;
4.4 )
SUPPORTED_IMAGE_OS=("bullseye" "ubi9")
DEPRECATED_IMAGE_OS=("ubi8")
;;
*)
SUPPORTED_IMAGE_OS=("bullseye")
DEPRECATED_IMAGE_OS=()
;;
esac
129 changes: 129 additions & 0 deletions build-scripts/deprecation-warnings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/bin/bash
set -eu -o pipefail

function get_removed_in_version_5
{
local image_os=${1}

case ${image_os} in
"ubi8" )
echo "5.20.0"
;;
"ubi9" )
echo "5.26.21"
;;
"bullseye" )
echo "5.26.21"
;;
esac
}

function get_removed_in_version_calver
{
local image_os=${1}

case ${image_os} in
ubi9 )
echo "2026.03.0"
;;
bullseye )
echo "2026.03.0"
;;
esac
}

function get_update_to_image
{
local image_os=${1}
case ${image_os} in
ubi9 )
echo "ubi10"
;;
bullseye )
echo "trixie"
;;
esac
}

function deprecation_early_warning_message
{
local image_os="${1}"
local update_to="$(get_update_to_image $image_os)"

case ${image_os} in
ubi8 | ubi9 )
echo "if [ \"\${NEO4J_DEPRECATION_WARNING:-yes}\" != \"suppress\" ]; then\n
\techo \>\&2 \"\n=======================================================\n
Neo4j Red Hat ${image_os^^} images are deprecated in favour of Red Hat ${update_to^^}.\n
Update your codebase to use Neo4j Docker image tags ending with -${update_to} instead of -${image_os}.\n\n
Neo4j $(get_removed_in_version_calver $image_os) will be the last version to get a Red Hat ${image_os^^} docker image release.\n\n
To suppress this warning set environment variable NEO4J_DEPRECATION_WARNING=suppress.\n
=======================================================\n\"\n
fi"
;;
bullseye )
echo "if [ \"\${NEO4J_DEPRECATION_WARNING:-yes}\" != \"suppress\" ]; then\n
\techo \>\&2 \"\n=======================================================\n
Neo4j Debian ${image_os^^} images are deprecated in favour of Debian ${update_to^^}.\n
Update your codebase to use Neo4j Docker image tags ending with -${update_to} instead of -${image_os}.\n\n
Neo4j $(get_removed_in_version_calver $image_os) will be the last version to get a Debian ${image_os^^} docker image release.\n\n
To suppress this warning set environment variable NEO4J_DEPRECATION_WARNING=suppress.\n
=======================================================\n\"\n
fi"
;;
esac
}

function deprecation_final_warning_message
{
local image_os="${1}"
local update_to="$(get_update_to_image $image_os)"

case ${image_os} in
ubi8 | ubi9 )
echo "echo \>\&2 \"\n=======================================================\n
Neo4j Red Hat ${image_os^^} images are deprecated in favour of Red Hat ${update_to^^}.\n
Update your codebase to use Neo4j Docker image tags ending with -${update_to} instead of -${image_os}.\n\n
This is the last Neo4j image available on Red Hat ${image_os^^}.\n
By continuing to use ${image_os^^} tagged Neo4j images you will not get further updates, \n
including new features and security fixes.\n\n
This message can not be suppressed.\n
=======================================================\n\"\n"
;;
bullseye )
echo "echo \>\&2 \"\n=======================================================\n
Neo4j Debian ${image_os^^} images are deprecated in favour of Debian ${update_to^^}.\n
Update your codebase to use Neo4j Docker image tags ending with -${update_to} instead of -${image_os}.\n\n
This is the last Neo4j image available on Debian ${image_os^^}.\n
By continuing to use ${image_os^^} tagged Neo4j images you will not get further updates, \n
including new features and security fixes.\n\n
This message can not be suppressed.\n
=======================================================\n\"\n"
;;
esac
}

function deprecation_message
{
local image_os="${1}"
local neo4j_version="${2}"
local branch=$(get_branch_from_version ${neo4j_version})
local deprecated_in_version

# Find which neo4j version the image OS will last appear in
if [ "${branch}" == "calver" ]; then
deprecated_in_version="$(get_removed_in_version_calver ${image_os})"
elif [ "${branch}" == "5" ]; then
deprecated_in_version="$(get_removed_in_version_5 ${image_os})"
else
echo >&2 "Cannot generate deprecation message for ${image_os} and neo4j ${branch}."
return 1
fi
# if the deprecated_in_version is the one currently being built,
# then give final warning instead of early warning.
if [ "${neo4j_version}" == "${deprecated_in_version}" ]; then
deprecation_final_warning_message "${image_os}"
else
deprecation_early_warning_message "${image_os}"
fi
}
Loading