Skip to content
Merged
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
56 changes: 15 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#
# Builds and tests every push to main and every pull request.
#
# The engine jars this plugin compiles against are not on the public repsy
# mirror at 4.6.0, so they come from the published OIE distribution, the same
# tarball scripts/install-engine-jars.sh uses for local builds. The tarball is
# cached by tag, so it is downloaded once and reused until the pinned version
# changes.
# The engine jars this plugin compiles against come from the published OIE
# distribution, installed by scripts/install-engine-jars.sh, the same script
# local builds use, which checks the tarball against the SHA-256 pinned in the
# POM (oie.dist.sha256). The tarball is cached by engine version, so it is
# downloaded once and reused until the pinned version changes.

name: Build

Expand Down Expand Up @@ -38,57 +38,31 @@ jobs:
java-version: ${{ matrix.java }}
cache: maven

# The engine version lives in exactly one place, the POM's mc.version. Hardcoding
# it here as well meant a future engine bump could leave CI installing 4.6.0 jars
# while the build compiled against something else, with nothing to catch it.
# The release tag and tarball name are mechanical transforms of that version, so
# if OIE ever changes its asset naming the download 404s loudly rather than
# resolving something stale.
# The engine version lives in exactly one place, the POM's mc.version, and the
# tarball's SHA-256 beside it; the cache is keyed by that version.
- name: Resolve the engine version from the POM
id: engine
run: |
MC_VERSION="$(mvn -q -N help:evaluate -Dexpression=mc.version -DforceStdout)"
MC_VERSION="$(mvn -q -N org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=mc.version -DforceStdout)"
if [ -z "$MC_VERSION" ]; then
echo "::error::Could not read mc.version from pom.xml"
exit 1
fi
echo "mc_version=$MC_VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v${MC_VERSION}" >> "$GITHUB_OUTPUT"
echo "tarball=oie_unix_${MC_VERSION//./_}.tar.gz" >> "$GITHUB_OUTPUT"

- name: Cache OIE distribution
id: oie-cache
uses: actions/cache@v4
with:
path: ${{ steps.engine.outputs.tarball }}
key: oie-dist-${{ steps.engine.outputs.tag }}
path: .oie-dist
key: oie-dist-${{ steps.engine.outputs.mc_version }}

- name: Download OIE distribution
if: steps.oie-cache.outputs.cache-hit != 'true'
env:
OIE_TAG: ${{ steps.engine.outputs.tag }}
OIE_TARBALL: ${{ steps.engine.outputs.tarball }}
run: curl -fSL -o "$OIE_TARBALL" "https://github.com/OpenIntegrationEngine/engine/releases/download/${OIE_TAG}/${OIE_TARBALL}"

# The same four jars scripts/install-engine-jars.sh installs locally.
# The script local builds use: it downloads the distribution if the cache
# missed, checks it against the SHA-256 in the POM, and installs the four
# engine jars.
- name: Install engine jars into the local Maven repo
env:
OIE_TARBALL: ${{ steps.engine.outputs.tarball }}
MC_VERSION: ${{ steps.engine.outputs.mc_version }}
run: |
tar xzf "$OIE_TARBALL" \
oie/server-lib/mirth-server.jar \
oie/server-lib/mirth-client-core.jar \
oie/server-lib/donkey/donkey-server.jar \
oie/client-lib/mirth-client.jar
for pair in \
"mirth-server:oie/server-lib/mirth-server.jar" \
"mirth-client-core:oie/server-lib/mirth-client-core.jar" \
"donkey-server:oie/server-lib/donkey/donkey-server.jar" \
"mirth-client:oie/client-lib/mirth-client.jar"; do
a="${pair%%:*}"; p="${pair#*:}"
mvn -q install:install-file -Dfile="$p" -DgroupId=com.mirth.connect -DartifactId="$a" -Dversion="$MC_VERSION" -Dpackaging=jar
done
OIE_DIST_CACHE: ${{ github.workspace }}/.oie-dist
run: ./scripts/install-engine-jars.sh

- name: Build and test
run: mvn -B -ntp clean verify
Expand Down
36 changes: 7 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,47 +98,25 @@ jobs:
- name: Resolve the engine version from the POM
id: engine
run: |
MC_VERSION="$(mvn -q -N help:evaluate -Dexpression=mc.version -DforceStdout)"
MC_VERSION="$(mvn -q -N org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=mc.version -DforceStdout)"
if [ -z "$MC_VERSION" ]; then
echo "::error::Could not read mc.version from pom.xml"
exit 1
fi
echo "mc_version=$MC_VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v${MC_VERSION}" >> "$GITHUB_OUTPUT"
echo "tarball=oie_unix_${MC_VERSION//./_}.tar.gz" >> "$GITHUB_OUTPUT"

- name: Cache OIE distribution
id: oie-cache
uses: actions/cache@v4
with:
path: ${{ steps.engine.outputs.tarball }}
key: oie-dist-${{ steps.engine.outputs.tag }}

- name: Download OIE distribution
if: steps.oie-cache.outputs.cache-hit != 'true'
env:
OIE_TAG: ${{ steps.engine.outputs.tag }}
OIE_TARBALL: ${{ steps.engine.outputs.tarball }}
run: curl -fSL -o "$OIE_TARBALL" "https://github.com/OpenIntegrationEngine/engine/releases/download/${OIE_TAG}/${OIE_TARBALL}"
path: .oie-dist
key: oie-dist-${{ steps.engine.outputs.mc_version }}

# The same script build.yml and local builds use: it checks the distribution against
# the SHA-256 in the POM before installing the engine jars from it.
- name: Install engine jars into the local Maven repo
env:
OIE_TARBALL: ${{ steps.engine.outputs.tarball }}
MC_VERSION: ${{ steps.engine.outputs.mc_version }}
run: |
tar xzf "$OIE_TARBALL" \
oie/server-lib/mirth-server.jar \
oie/server-lib/mirth-client-core.jar \
oie/client-lib/mirth-client.jar \
oie/server-lib/donkey/donkey-server.jar
for pair in \
"mirth-server:oie/server-lib/mirth-server.jar" \
"mirth-client-core:oie/server-lib/mirth-client-core.jar" \
"mirth-client:oie/client-lib/mirth-client.jar" \
"donkey-server:oie/server-lib/donkey/donkey-server.jar"; do
a="${pair%%:*}"; p="${pair#*:}"
mvn -q install:install-file -Dfile="$p" -DgroupId=com.mirth.connect -DartifactId="$a" -Dversion="$MC_VERSION" -Dpackaging=jar
done
OIE_DIST_CACHE: ${{ github.workspace }}/.oie-dist
run: ./scripts/install-engine-jars.sh

- name: Build
run: mvn -B -ntp -DskipTests package
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Install it from the OIE Community Store, or download the latest release ZIP from
mvn verify
```

The script installs `mirth-server`, `donkey-server`, `mirth-client-core`, and `mirth-client` into your local Maven repository, taken from the published OIE release matching the POM's `mc.version` and checked against that release's `sha256sums`. Run it once per engine version.
The script installs `mirth-server`, `donkey-server`, `mirth-client-core`, and `mirth-client` into your local Maven repository, taken from the published OIE release matching the POM's `mc.version` and checked against the SHA-256 pinned in the POM (`oie.dist.sha256`); CI runs the same script. Run it once per engine version.

## License

Expand Down
12 changes: 10 additions & 2 deletions docs/design-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Why parts of this plugin are shaped the way they are, and what the test suite does and does not guarantee. Written for someone changing the code, so that decisions made deliberately are not undone by accident.

Last updated 2026-08-04 (1.3.0).
Last updated 2026-10-25.

---

Expand Down Expand Up @@ -78,8 +78,16 @@ The obstacle is testability rather than effort, and it is worth understanding be

Authorization behavior was verified manually against a running role-based server for 1.3.0: the permission appears in the role editor, a role without it is denied, and a channel-restricted role sees only its own channels with the exclusion notice and a matching skipped count. That is point-in-time evidence, not ongoing coverage, and should be repeated on any change to the authorization path.

**CI** (`.github/workflows/build.yml`) runs on every push to `main` and every pull request. It resolves the engine version from the POM's `mc.version`, installs the engine jars from the published OIE distribution tarball, and runs `mvn clean verify`. A final step fails the build if no surefire reports were produced, so a change that silently skips the suite cannot pass as green.
**CI** (`.github/workflows/build.yml`) runs on every push to `main` and every pull request. It resolves the engine version from the POM's `mc.version`, installs the engine jars with `scripts/install-engine-jars.sh`, which checks the published OIE distribution tarball against `oie.dist.sha256` first, and runs `mvn clean verify`. A final step fails the build if no surefire reports were produced, so a change that silently skips the suite cannot pass as green.

**Expected build warning**, not a defect: `SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"` during tests. No SLF4J binder is on the test classpath, because logging is provided by the engine at runtime.

**Known build-environment limitation:** the project uses `${revision}` for CI-friendly versioning without `flatten-maven-plugin`, so installed POMs contain the literal placeholder. The reactor build is unaffected, but per-module tooling such as `dependency:build-classpath` cannot resolve a sibling module.

---

## 2026-10-25: compiled against OIE 4.7.0

Release 1.5.0 targets OIE 4.7.0 but was compiled against the 4.6.0 engine jars, because 4.7.0 wasn't published when it shipped. The engine APIs this plugin uses are the same in both. OIE 4.7.0 was published on 2026-10-21. Its tag is commit `f9ba73e28`, and its `oie_unix_4_7_0.tar.gz` has the SHA-256 `ab08558873dc6be1e474afaacc46efe94d29c945cd3381c10d0ae548ecb429de`, the same commit and tarball 1.5.0 was tested against, so that testing applies to the published engine. `mc.version` is now 4.7.0 and `plugin.supported.mc.versions` is back to `${mc.version}`, which ends the split.

That SHA-256 is now pinned in the POM as `oie.dist.sha256`. `scripts/install-engine-jars.sh` used to check the tarball against the `sha256sums` file it downloaded from the same release, which only shows the two downloads agree with each other. It now checks against the pinned value, and CI runs the script instead of keeping its own copy of the jar list.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<properties>
<revision>1.5.0</revision>

<!-- Temporary: 1.5.0 targets OIE 4.7.0 but compiles against the 4.6.0 engine jars,
because 4.7.0 wasn't published when it shipped. The engine APIs oie-source-code-search
uses are the same in both (checked 2026-10-16). In the next release, set mc.version
to 4.7.0 and set this back to ${mc.version}. -->
<plugin.supported.mc.versions>4.7.0</plugin.supported.mc.versions>
<plugin.supported.mc.versions>${mc.version}</plugin.supported.mc.versions>

<mc.version>4.6.0</mc.version>
<mc.version>4.7.0</mc.version>
<!-- SHA-256 of the OIE distribution for mc.version (oie_unix_<version>.tar.gz), from
the release's sha256sums file. scripts/install-engine-jars.sh checks the download
against it before taking the engine jars from it. Update it with mc.version. -->
<oie.dist.sha256>ab08558873dc6be1e474afaacc46efe94d29c945cd3381c10d0ae548ecb429de</oie.dist.sha256>
<javax-servlet.version>3.1.0</javax-servlet.version>
<javax-rs-api.version>2.0.1</javax-rs-api.version>
<xstream.version>1.4.20</xstream.version>
Expand Down
38 changes: 19 additions & 19 deletions scripts/install-engine-jars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,35 @@
#
# Installs the four OIE engine jars this plugin builds against into the local
# Maven repository, taken from the published OIE distribution for the POM's
# mc.version. CI builds from the same tarball (.github/workflows/build.yml).
# Run it once per engine version.
# mc.version. CI runs this script too (.github/workflows/build.yml and
# release.yml). Run it once per engine version.
#
# Usage:
# ./scripts/install-engine-jars.sh
#
# The tarball is downloaded into target/oie-dist/ (gitignored, reused until the
# next mvn clean) and checked against the release's own sha256sums before
# anything is installed. Works on Linux and macOS.
# The tarball is checked against the SHA-256 in the POM (oie.dist.sha256) before
# anything is installed. It is downloaded into $OIE_DIST_CACHE when set (CI
# caches that directory), otherwise target/oie-dist/ (gitignored, reused until
# the next mvn clean). Works on Linux and macOS.

set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

MC_VERSION="$(mvn -q -N help:evaluate -Dexpression=mc.version -DforceStdout)"
MC_VERSION="$(mvn -q -N org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=mc.version -DforceStdout)"
if [[ -z "${MC_VERSION}" ]]; then
echo "error: could not read mc.version from pom.xml" >&2
exit 1
fi
# A missing property comes back as "null object or invalid expression", not empty.
EXPECTED_SHA256="$(mvn -q -N org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=oie.dist.sha256 -DforceStdout)"
if [[ ! "${EXPECTED_SHA256}" =~ ^[0-9a-f]{64}$ ]]; then
echo "error: pom.xml oie.dist.sha256 is '${EXPECTED_SHA256}', not a SHA-256" >&2
exit 1
fi
TARBALL="oie_unix_${MC_VERSION//./_}.tar.gz"
BASE_URL="https://github.com/OpenIntegrationEngine/engine/releases/download/v${MC_VERSION}"
DIST_DIR="target/oie-dist"
DIST_DIR="${OIE_DIST_CACHE:-target/oie-dist}"

# sha256sum on Linux, shasum on macOS.
sha256() {
Expand All @@ -37,21 +44,14 @@ sha256() {
}

mkdir -p "${DIST_DIR}"
curl -fsSL -o "${DIST_DIR}/sha256sums" "${BASE_URL}/sha256sums"
# Lines read "<hash> *<file>" (binary mode) or "<hash> <file>".
expected="$(awk -v f="${TARBALL}" '{ n = $2; sub(/^\*/, "", n) } n == f { print $1 }' "${DIST_DIR}/sha256sums")"
if [[ -z "${expected}" ]]; then
echo "error: ${TARBALL} is not listed in ${BASE_URL}/sha256sums" >&2
exit 1
fi

if [[ ! -f "${DIST_DIR}/${TARBALL}" || "$(sha256 "${DIST_DIR}/${TARBALL}")" != "${expected}" ]]; then
if [[ ! -f "${DIST_DIR}/${TARBALL}" || "$(sha256 "${DIST_DIR}/${TARBALL}")" != "${EXPECTED_SHA256}" ]]; then
echo "downloading ${TARBALL} from ${BASE_URL}"
curl -fSL -o "${DIST_DIR}/${TARBALL}" "${BASE_URL}/${TARBALL}"
fi
actual="$(sha256 "${DIST_DIR}/${TARBALL}")"
if [[ "${actual}" != "${expected}" ]]; then
echo "error: ${TARBALL} sha256 is ${actual}, the release lists ${expected}" >&2
if [[ "${actual}" != "${EXPECTED_SHA256}" ]]; then
echo "error: ${TARBALL} sha256 is ${actual}, but pom.xml oie.dist.sha256 is ${EXPECTED_SHA256}." >&2
echo "After an mc.version change, set oie.dist.sha256 from ${BASE_URL}/sha256sums." >&2
exit 1
fi

Expand All @@ -73,7 +73,7 @@ for entry in "${JARS[@]}"; do
artifact="${entry%%:*}"
jar_path="${DIST_DIR}/${entry#*:}"
echo "installing ${artifact}-${MC_VERSION}"
mvn -q install:install-file \
mvn -q org.apache.maven.plugins:maven-install-plugin:3.1.4:install-file \
-Dfile="${jar_path}" \
-DgroupId=com.mirth.connect \
-DartifactId="${artifact}" \
Expand Down
Loading