Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
cd851b0
Decouples Federated Persistence layer from controller and service lay…
BA-MBSE Mar 17, 2023
9e17c7b
Remove redundant commit save
BA-MBSE Mar 20, 2023
240359a
CodeQL updates
BA-MBSE Mar 20, 2023
d1cd63d
More CodeQL changes
BA-MBSE Mar 20, 2023
1cc6a06
Added timeout to database delete statement
BA-MBSE Mar 22, 2023
9ddd679
Removing overarching transactional annotations
BA-MBSE Mar 27, 2023
bc41d28
Removed transactional annotations from DefaultPermissionService
BA-MBSE Mar 28, 2023
ff3d4fd
Removed @Transactional annotation from modules that are not tasked wi…
BA-MBSE Mar 28, 2023
b6a0ede
Fixes for failing crud tests
BA-MBSE Mar 29, 2023
9808317
Increased request delay for crud tests
BA-MBSE Mar 29, 2023
a9595f6
Working on fixing permissions test failures
BA-MBSE Mar 30, 2023
23848a0
increased delay in permissions test
BA-MBSE Mar 31, 2023
b07f73b
Fixing problem with bean creation for permissions delegates that was …
BA-MBSE Mar 31, 2023
307a8b9
Fixed artifacts behavior
BA-MBSE Apr 4, 2023
8eb0abb
extending artifacts test delay to 1000 ms
BA-MBSE Apr 4, 2023
a95b385
Fixing elastic test failures
BA-MBSE Apr 5, 2023
066a212
Fixing groups test failures
BA-MBSE Apr 5, 2023
87d24ad
Merge branch 'develop' into ba_persistence_refactor
BA-MBSE Apr 5, 2023
2c0daeb
Merge branch 'ba_persistence_refactor' of https://github.com/BA-MBSE/…
HuiJun Feb 7, 2024
f5ef049
Merge commit '4e4e8586b744bc371db774f2b7115647003d2965' into feature/…
Feb 13, 2024
fe50baf
fix NodePersistence.findById interface argument names
Feb 13, 2024
ceb011f
fix FederatedNodeChangeDomain superclass constructor call
Feb 13, 2024
d042a36
change CommitPersistence.elementHistory interface so DefaultCommitSer…
Feb 13, 2024
1190f31
remove redundant groups read from CameoViewService
Feb 13, 2024
8fab816
remove posted _childViews handling from CameoViewService, this was ha…
Feb 13, 2024
5db7179
continue if no permission to change project org on project update
Feb 13, 2024
1d7513f
reduce amount of commits gotten to test for new project in DefaultCom…
Feb 14, 2024
4db7311
add commitId to node get responses in DefaultNodeService and CameoNod…
Feb 14, 2024
d706aa4
removed duplicated convertJsonToMap function in DefaultNodeService, m…
Feb 14, 2024
322eb78
prevent adding change info to commit if element isn't actually being …
Feb 14, 2024
3ae6efb
fix setting initial commit of added element, prefix deleted key with _
Feb 14, 2024
7e83e9c
fix processElementDeleted
Feb 14, 2024
0340a0d
use commitDAO interface in FederatedNodeChangeDomain instead of commi…
Feb 14, 2024
f453d79
clean up unused things in FederatedNodeChangeDomain
Feb 14, 2024
cd4791e
uncomment child views handling so tests run for now
Feb 15, 2024
aaa1324
if searching by commit id doesn't work, try getting by id directly
Feb 15, 2024
9a9bd03
reduce test delay back to 500
Feb 15, 2024
cd7248f
support updating existing ref's json properties, will resurrect if pr…
Feb 21, 2024
0f5e331
fix updating org name
Feb 21, 2024
1974151
prevent project update from updating schema
Feb 21, 2024
6a49df8
fix setting commit id from commitJson id
Feb 21, 2024
9345bb5
sort commits by descending
Feb 21, 2024
7064a3c
check if commitId is latest for gets and pass in null if it is for pe…
Feb 24, 2024
a30da31
remove any _deleted flag in element to be updated
Feb 24, 2024
7831189
set returned elements refId to match requested refId
Feb 24, 2024
4a91807
set refIds for cameo element gets
Feb 24, 2024
064512b
allow update even if previous element not found
Feb 24, 2024
c76802c
handle if element json not found during gets
Feb 24, 2024
13f1ad7
remove addChildViews delay
Feb 24, 2024
a52046c
throw error if project can't hard delete
Feb 24, 2024
c6aecc5
update project permissions after changing orgs if needed
Feb 24, 2024
1af38d9
continue with element delete even if json not found
Feb 24, 2024
f7ac4a8
Merge pull request #272 from Open-MBEE/release/4.0.20
HuiJun Mar 7, 2024
814b718
Merge commit 'f7ac4a8af45c3f3347eec2a2b4d0e9a5fe12f144' into fix/pers…
Mar 10, 2024
e8fc607
add more tests for branching behavior
Mar 11, 2024
0749f05
Added commands for generation of jacoco .xml report
karicordes Mar 11, 2024
6d36ac8
Merge branch 'develop' of github.com:karicordes/exec-mms into develop
karicordes Mar 11, 2024
81718ea
Changed file path to gather classes
karicordes Mar 11, 2024
5bcce0f
Fixed scan to depend on build_and_test, moved xml report to scan
karicordes Mar 12, 2024
b7c0efd
Command to create directory to copy to
karicordes Mar 12, 2024
ca31054
Changed Dockerfile; scan step to attach workspace
karicordes Mar 12, 2024
83ec1f6
Merge pull request #275 from Open-MBEE/jacoco
dlamoris Mar 12, 2024
b58f138
Merge commit '83ec1f6db8a540e1c8bade294c49fa62a62cec25' into fix/pers…
Mar 17, 2024
13318b9
use returned instance from spring data repository save
Mar 19, 2024
e51fa08
fix branch not found behavior when init branch perms
Mar 25, 2024
a55b5ca
remove unused things in FederatedPermissionUpdatesResponseBuilder
Mar 30, 2024
f178665
remove unneeded element delete processing
Mar 31, 2024
7162f86
users list is available to authenticated users
Mar 31, 2024
844e9eb
tweak commit update in case twc module is used
Mar 31, 2024
7858dfb
commit fail cleanup
Mar 31, 2024
26300d3
fix commit delete
Mar 31, 2024
404ef00
in FederatedNodeChangeDomain.primeNodeChangeInfo, add to any existing…
Mar 31, 2024
27f056a
only further process transacted elements but keep other existing info…
Mar 31, 2024
fce5e38
Merge pull request #260 from Open-MBEE/fix/persistence_refactor_fixes
dlamoris Apr 9, 2024
7de6dd0
Merge pull request #259 from Open-MBEE/feature/persistence_refactor
dlamoris Apr 9, 2024
2c51e17
fix commit retrieval loop
Enquier Apr 17, 2024
4c5de36
add missing set to delete
Enquier Apr 18, 2024
28fbf1d
stronger comparison
Enquier Apr 18, 2024
2f943dc
fix for user creation when logging in via twc, updated twc readme
May 7, 2024
de6ab64
add config to optimize for federated persistance behavior
May 14, 2024
b66a96c
fix test
May 14, 2024
263f14d
optimize more commit get
May 14, 2024
7978229
fix return commit id in cameo elements get
May 20, 2024
d5d6e4d
Merge pull request #279 from Open-MBEE/fix/federated-optimization
dlamoris May 21, 2024
fbfb634
fix based on discussion in dev tagup
Enquier May 21, 2024
f0423a7
Merge pull request #278 from Open-MBEE/bugfix/commit-loop
dlamoris May 21, 2024
312ed94
chore: restore the build and move the image to eclipse-temurin 17 JRE
devin-ai-integration[bot] Nov 13, 2026
a513314
chore: use Apache-2.0 S3Mock as the compose S3 service instead of MinIO
devin-ai-integration[bot] Nov 13, 2026
d4724ce
chore: keep S3Mock objects across a restart of the compose service
devin-ai-integration[bot] Nov 13, 2026
35303cf
chore: patch-level dependency bumps within Spring Boot 2.7
devin-ai-integration[bot] Nov 13, 2026
e8299f1
feat: support Elasticsearch 9 and OpenSearch 3 through the shared RES…
devin-ai-integration[bot] Nov 13, 2026
46a342d
ci: trigger CircleCI through the GitHub App pipeline
devin-ai-integration[bot] Nov 13, 2026
7cbd26b
ci: use the sonarcloud orb 4.0.0, whose scanner bundles its own JRE
devin-ai-integration[bot] Nov 13, 2026
ee3a3d1
Merge branch 'chore/build-fix-base-image' into chore/patch-level-depe…
devin-ai-integration[bot] Nov 13, 2026
077f43c
Merge branch 'chore/patch-level-dependency-bumps' into feature/elasti…
devin-ai-integration[bot] Nov 13, 2026
49b45e1
ci: check out a full clone so the SonarQube scan can blame files
devin-ai-integration[bot] Nov 13, 2026
bbda49c
Merge branch 'chore/build-fix-base-image' into chore/patch-level-depe…
devin-ai-integration[bot] Nov 13, 2026
001018e
Merge branch 'chore/patch-level-dependency-bumps' into feature/elasti…
devin-ai-integration[bot] Nov 13, 2026
9caa8e1
Merge pull request #280 from Open-MBEE/chore/build-fix-base-image
HuiJun Nov 13, 2026
2ec8259
Merge pull request #281 from Open-MBEE/chore/patch-level-dependency-b…
HuiJun Nov 13, 2026
95acaef
Merge pull request #282 from Open-MBEE/feature/elasticsearch-opensear…
HuiJun Nov 13, 2026
fcbe475
test: repair the twc and crud unit tests that fail on develop
devin-ai-integration[bot] Nov 13, 2026
ffecce2
Migrate to Spring Boot 3.5, Gradle 8, Jakarta EE, Hibernate 6 and AWS…
devin-ai-integration[bot] Nov 13, 2026
9040cb0
Close the S3 client when bucket initialization fails
devin-ai-integration[bot] Nov 13, 2026
1852ff5
Add script and operator guide for migrating Elasticsearch 7 indices
devin-ai-integration[bot] Nov 13, 2026
18c7e5e
Fail on partial shard answers and size bulk requests in bytes
devin-ai-integration[bot] Nov 13, 2026
ffc9dd5
Register the ElementVersion schema referenced by Commit in the OpenAP…
devin-ai-integration[bot] Nov 14, 2026
b3c0f3f
Merge pull request #283 from Open-MBEE/fix/stale-unit-test-mocks
HuiJun Nov 14, 2026
8f7f052
fix: accept the wildcard CORS origin when credentials are allowed
devin-ai-integration[bot] Nov 14, 2026
6b1aae5
Make SpringDocRequestBuilder static and build the default AWS credent…
devin-ai-integration[bot] Nov 14, 2026
a4cba01
Merge pull request #286 from Open-MBEE/fix/cors-wildcard-origin-login
HuiJun Nov 15, 2026
3943c78
Merge pull request #284 from Open-MBEE/chore/spring-boot-3-migration
HuiJun Nov 15, 2026
d7564c4
Merge pull request #285 from Open-MBEE/feature/elasticsearch-7-migrat…
HuiJun Nov 15, 2026
c60c795
ci: publish to Maven Central through the Central Portal
devin-ai-integration[bot] Nov 17, 2026
849cff0
Merge pull request #287 from Open-MBEE/ci/maven-central-portal-publis…
HuiJun Nov 17, 2026
faf0642
chore: update versions for release 4.1.0
devin-ai-integration[bot] Nov 17, 2026
5be20c0
fix: webhook project scoping, OAuth request state, no-op transactions…
devin-ai-integration[bot] Nov 17, 2026
085732d
Merge pull request #289 from Open-MBEE/fix/release-review-findings
HuiJun Nov 17, 2026
0d36949
Merge remote-tracking branch 'origin/develop' into release/4.1.0
devin-ai-integration[bot] Nov 17, 2026
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
145 changes: 136 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1
orbs:
docker: circleci/docker@2.1.1
sonarcloud: sonarsource/sonarcloud@2.0.0
sonarcloud: sonarsource/sonarcloud@4.0.0
executors:
openjdk_executor:
docker:
Expand All @@ -10,22 +10,60 @@ executors:
_JAVA_OPTIONS: "-Xmx3g"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"

commands:
require_publishing_credentials:
steps:
- run:
name: Require the publishing credentials
command: |
# Names only, never values.
for name in CENTRAL_TOKEN_USERNAME CENTRAL_TOKEN_PASSWORD GPG_PRIVATE_KEY GPG_PASSPHRASE; do
if [ -z "${!name:-}" ]; then
echo "Error: ${name} is not set; the 'Maven Central' context supplies it."
exit 1
fi
done
export_signing_key:
steps:
- run:
name: Hand the signing key to Gradle
command: |
# The context may hold the key ASCII-armoured or base64-encoded on one line; Gradle needs it armoured.
umask 077
case "$GPG_PRIVATE_KEY" in
*"-----BEGIN PGP PRIVATE KEY BLOCK-----"*) printf '%s\n' "$GPG_PRIVATE_KEY" > /tmp/signing-key.asc ;;
*) printf '%s' "$GPG_PRIVATE_KEY" | tr -d ' \n' | base64 -d > /tmp/signing-key.asc ;;
esac
if ! grep -q -- '-----BEGIN PGP PRIVATE KEY BLOCK-----' /tmp/signing-key.asc; then
echo "Error: GPG_PRIVATE_KEY is neither an armoured private key nor its base64 encoding."
exit 1
fi
echo 'export ORG_GRADLE_PROJECT_signingKey="$(cat /tmp/signing-key.asc)"' >> "$BASH_ENV"
echo 'export ORG_GRADLE_PROJECT_signingPassword="$GPG_PASSPHRASE"' >> "$BASH_ENV"

jobs:
build_and_test:
executor:
name: docker/docker
working_directory: /home/circleci/mms
steps:
- checkout
# A full clone, because the scan job blames files from the persisted .git.
- checkout:
method: full

- setup_remote_docker

- run:
name: "Create and start all services from the docker-compose configuration"
command: |
cp example/src/main/resources/application.properties.example ./example/src/main/resources/application.properties
mkdir -p jacocoJars
curl -L -o ./jacocoJars/jacocoagent.jar "https://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.8.7/org.jacoco.agent-0.8.7-runtime.jar"
curl -L -o ./jacocoJars/jacococli.jar "https://repo1.maven.org/maven2/org/jacoco/org.jacoco.cli/0.8.7/org.jacoco.cli-0.8.7-nodeps.jar"
export MMS_JAVA_OPTIONS="-XX:MaxRAMPercentage=90.0 -javaagent:/mms/jacocoJars/jacocoagent.jar=destfile=/mms/jacocoOutput/jacoco-it.exec,output=file"
docker-compose up --build -d
docker run --network container:mms curlimages/curl --retry 8 --retry-delay 10 --retry-max-time 90 --retry-connrefused http://mms:8080/healthcheck
docker run --network container:mms curlimages/curl --retry 20 --retry-delay 6 --retry-all-errors http://elasticsearch:9200

- run:
name: "Run and test Postman Collection"
Expand All @@ -35,14 +73,29 @@ jobs:
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run crud.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run getAtCommits.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run makeBranchFromCommit.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run cameo.postman_collection.json -e test-env.json --delay-request 1000
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run cameo.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run jupyter.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run localauth.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run permissions.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run search.postman_collection.json -e test-env.json --delay-request 1000
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run artifacts.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run elastic.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run groups.postman_collection.json -e test-env.json --delay-request 500

docker stop mms
mkdir -p jacocoOutput
docker cp mms:/mms/jacocoOutput/jacoco-it.exec ./jacocoOutput/jacoco-it.exec

- run:
name: "Run the search collections against OpenSearch"
command: |
docker-compose down -v
docker-compose -f docker-compose.yml -f docker-compose.opensearch.yml up -d --scale elasticsearch=0
docker run --network container:mms curlimages/curl --retry 8 --retry-delay 10 --retry-max-time 90 --retry-connrefused http://mms:8080/healthcheck
docker run --network container:mms curlimages/curl --retry 20 --retry-delay 6 --retry-all-errors http://opensearch:9200
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run crud.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run search.postman_collection.json -e test-env.json --delay-request 1000
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run elastic.postman_collection.json -e test-env.json --delay-request 500

- persist_to_workspace:
root: /home/circleci/
Expand All @@ -53,30 +106,98 @@ jobs:
executor: openjdk_executor
working_directory: /home/circleci/mms
steps:
- checkout
- attach_workspace:
at: ~/
- run:
name: Build classes to scan
command: ./gradlew build -x test
command: |
./gradlew build -x test
mkdir -p TEMPORARYclassfiles
cp -r */build/classes/java/main/* TEMPORARYclassfiles/
java -jar jacocoJars/jacococli.jar report jacocoOutput/jacoco-it.exec --classfiles TEMPORARYclassfiles/ --xml ./jacocoOutput/jacocoXMLReport
rm -r TEMPORARYclassfiles

- sonarcloud/scan

# Publishing uses the organization's 'Maven Central' context: a Central Portal user token
# (CENTRAL_TOKEN_USERNAME, CENTRAL_TOKEN_PASSWORD) and the release signing key
# (GPG_PRIVATE_KEY, GPG_PASSPHRASE).
deploy_snapshot:
executor: openjdk_executor
working_directory: /home/circleci/mms
steps:
- attach_workspace:
at: ~/
- require_publishing_credentials
- export_signing_key
- run:
name: Deploy snapshot to sonatype
command: ./gradlew -PossrhUsername=$OSSRH_USERNAME -PossrhPassword=$OSSRH_PASSWORD -PsigningKey="$SIGNING_KEY" -PsigningPassword=$SIGNING_PASSWORD publish
name: Deploy snapshot to the Central Portal snapshot repository
command: |
export ORG_GRADLE_PROJECT_centralUsername="$CENTRAL_TOKEN_USERNAME"
export ORG_GRADLE_PROJECT_centralPassword="$CENTRAL_TOKEN_PASSWORD"
./gradlew publish

# A Maven Central version can never be replaced, so everything that can fail runs before the
# upload: the credentials, the version check, and building and signing every module.
deploy_release:
executor: openjdk_executor
working_directory: /home/circleci/mms
steps:
- attach_workspace:
at: ~/
- require_publishing_credentials
- run:
name: Deploy release to sonatype
command: ./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PossrhUsername=$OSSRH_USERNAME -PossrhPassword=$OSSRH_PASSWORD -PsigningKey="$SIGNING_KEY" -PsigningPassword=$SIGNING_PASSWORD --info --stacktrace publish
name: Refuse a version already on Maven Central
command: |
code=$(curl -s -o /dev/null -w '%{http_code}' "https://repo1.maven.org/maven2/org/openmbee/mms/core/${CIRCLE_TAG}/")
case "$code" in
404) echo "org.openmbee.mms ${CIRCLE_TAG} is not on Maven Central yet" ;;
200) echo "Error: org.openmbee.mms ${CIRCLE_TAG} is already on Maven Central and cannot be replaced."; exit 1 ;;
*) echo "Error: could not ask Maven Central (HTTP $code); nothing was published."; exit 1 ;;
esac
- export_signing_key
- run:
name: Build and sign the deployment bundle
command: |
./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG --stacktrace cleanCentralStaging centralBundle
bundle=build/central/central-bundle.zip
poms=$(unzip -Z1 "$bundle" | grep -c '\.pom$')
signed=$(unzip -Z1 "$bundle" | grep -c '\.pom\.asc$')
echo "$poms modules, $signed signed"
if [ "$poms" -eq 0 ] || [ "$poms" -ne "$signed" ]; then
echo "Error: the bundle is empty or not every module is signed; nothing was published."
exit 1
fi
- run:
name: Upload the bundle and wait until Maven Central publishes it
no_output_timeout: 35m
command: |
# The token travels in a curl config file, never on a command line.
auth=$(mktemp)
printf 'header = "Authorization: Bearer %s"\n' "$(printf '%s:%s' "$CENTRAL_TOKEN_USERNAME" "$CENTRAL_TOKEN_PASSWORD" | base64 -w0)" > "$auth"
api=https://central.sonatype.com/api/v1/publisher
code=$(curl -sS -K "$auth" -o /tmp/deployment-id -w '%{http_code}' \
--form bundle=@build/central/central-bundle.zip \
"$api/upload?publishingType=AUTOMATIC&name=mms-${CIRCLE_TAG}")
if [ "$code" != 201 ]; then
echo "Error: the Central Portal refused the upload (HTTP $code)."
cat /tmp/deployment-id
exit 1
fi
id=$(cat /tmp/deployment-id)
echo "Deployment $id uploaded"
for attempt in $(seq 1 180); do
status=$(curl -sS -K "$auth" -X POST "$api/status?id=$id" || true)
state=$(printf '%s' "$status" | jq -r '.deploymentState // empty' 2>/dev/null || true)
echo "$(date -u +%H:%M:%S) ${state:-no answer}"
case "$state" in
PUBLISHED) exit 0 ;;
FAILED) printf '%s\n' "$status"; exit 1 ;;
esac
sleep 10
done
echo "Error: deployment $id was not published within 30 minutes; check it at https://central.sonatype.com/publishing/deployments."
exit 1

workflows:
version: 2
Expand All @@ -87,6 +208,8 @@ workflows:
tags:
only: /[0-9.]+(-(a|b|rc)[0-9]+)?/
- scan:
requires:
- build_and_test
filters:
tags:
only: /[0-9.]+(-(a|b|rc)[0-9]+)?/
Expand All @@ -95,12 +218,16 @@ workflows:
- deploy_snapshot:
requires:
- build_and_test
context:
- Maven Central
filters:
branches:
only: /((release|hotfix|support)/[0-9.]+(-(a|b|rc)[0-9]+)?|develop)/
- deploy_release:
requires:
- build_and_test
context:
- Maven Central
filters:
tags:
only: /[0-9.]+(-(a|b|rc)[0-9]+)?/
Expand Down
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gradle
.idea
**/build
**/out
jacocoOutput
12 changes: 6 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v7

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 11
java-version: 17

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql.yml
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
FROM openjdk:17.0.2-slim as build
FROM eclipse-temurin:17-jdk AS build
COPY . /mms
WORKDIR /mms
RUN ./gradlew --no-daemon bootJar --warning-mode all
RUN find . -type f -name 'example-*.jar' -not -iname '*javadoc*' -not -iname '*sources*' -not -iname '*plain*' -exec cp '{}' '/app.jar' ';' \
&& mkdir -p jacocoJars

RUN find . -type f -name example-*.jar -not -iname '*javadoc*' -not -iname '*sources*' -exec cp '{}' '/app.jar' ';'
ENV JDK_JAVA_OPTIONS "-XX:MaxRAMPercentage=90.0"
FROM eclipse-temurin:17-jre
RUN groupadd --system mms && useradd --system --gid mms --home-dir /mms mms \
&& mkdir -p /mms/jacocoOutput && chown -R mms:mms /mms
WORKDIR /mms
COPY --from=build /app.jar /app.jar
# Optional JaCoCo agent for integration coverage; enable it through JDK_JAVA_OPTIONS.
COPY --from=build /mms/jacocoJars /mms/jacocoJars
USER mms
ENV JDK_JAVA_OPTIONS="-XX:MaxRAMPercentage=90.0"
ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "-jar", "/app.jar"]
EXPOSE 8080
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ or Mysql
Elasticsearch
^^^^^^^^^^^^^

Install Elasticsearch 7.8. If you use Docker instructions are available here: `Setting up Elasticsearch with Docker <https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html>`_
Install Elasticsearch 9 or OpenSearch 3. MMS talks to either one over the REST API they share, so the ``elasticsearch.*`` properties select the server by host and port alone. If you use Docker instructions are available here: `Setting up Elasticsearch with Docker <https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html>`_

.. code-block::

docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.8.1
docker run -d -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" docker.elastic.co/elasticsearch/elasticsearch:9.5.6


Artifacts Storage
^^^^^^^^^^^^^^^^^

.. code-block::

docker run -d -p 9000:9000 -e "MINIO_ACCESS_KEY=admintest" -e "MINIO_SECRET_KEY=admintest" minio/minio server /data
docker run -d -p 9000:9090 adobe/s3mock:5.2.3


IntelliJ IDEA
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.openmbee.mms.artifacts.crud;

public class ArtifactsContext {
private static ThreadLocal<Boolean> artifactContext = new ThreadLocal<>();

public static void setArtifactContext(Boolean isArtifactContext) {
artifactContext.set(isArtifactContext);
}

public static boolean isArtifactContext() {
return Boolean.TRUE.equals(artifactContext.get());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.openmbee.mms.artifacts.crud;

import org.openmbee.mms.artifacts.json.ArtifactJson;
import org.openmbee.mms.core.services.NodeChangeInfo;
import org.openmbee.mms.crud.domain.NodeUpdateFilter;
import org.openmbee.mms.json.ElementJson;
import org.springframework.stereotype.Component;

@Component
public class ArtifactsPersistenceNodeUpdateFilter implements NodeUpdateFilter {
@Override
public boolean filterUpdate(NodeChangeInfo nodeChangeInfo, ElementJson updated, ElementJson existing) {
if(ArtifactsContext.isArtifactContext()) {
return true;
}
//Ensure artifacts aren't cleared or added by the regular element update process
if(existing.containsKey(ArtifactJson.ARTIFACTS)) {
updated.put(ArtifactJson.ARTIFACTS, existing.get(ArtifactJson.ARTIFACTS));
} else {
updated.remove(ArtifactJson.ARTIFACTS);
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public void acceptHook(Object payload) {
ElementUpdateHook elementUpdateHook = (ElementUpdateHook) payload;
if(elementUpdateHook.getElements() != null) {
//Ignore any artifact changes coming in outside of the Artifacts Controller
elementUpdateHook.getElements().parallelStream().forEach(v -> {
v.remove(ArtifactJson.ARTIFACTS);
});
elementUpdateHook.getElements().parallelStream().forEach(v ->
v.remove(ArtifactJson.ARTIFACTS)
);
}
}
}
Loading