From a897d657295dbb4ee1d6b647fdb3495b7a1306f5 Mon Sep 17 00:00:00 2001 From: ushcode Date: Thu, 3 Jul 2025 15:03:59 +0100 Subject: [PATCH 01/27] fix after merge hell --- .github/dependabot.yml | 20 +++++ .github/scripts/check-version.sh | 95 ++++++++++++++++++++ .github/scripts/increment-package-version.sh | 35 ++++++++ .github/workflows/check-version.yml | 60 +++++++++++++ .github/workflows/docker-ci.yml | 72 +++++++++++++++ .github/workflows/tag-version.yml | 48 ++++++++++ VERSION | 1 + 7 files changed, 331 insertions(+) create mode 100644 .github/dependabot.yml create mode 100755 .github/scripts/check-version.sh create mode 100755 .github/scripts/increment-package-version.sh create mode 100644 .github/workflows/check-version.yml create mode 100644 .github/workflows/docker-ci.yml create mode 100644 .github/workflows/tag-version.yml create mode 100644 VERSION diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..c6a4534c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directories: + - "stack-clients" + - "stack-data-uploader" + - "stack-manager" + schedule: + interval: "weekly" + - package-ecosystem: "docker" + directories: + - "stack-clients" + - "stack-data-uploader" + - "stack-manager" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/scripts/check-version.sh b/.github/scripts/check-version.sh new file mode 100755 index 00000000..5c911cf4 --- /dev/null +++ b/.github/scripts/check-version.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +VERSION=$(cat -s "VERSION" 2>/dev/null) +MAIN_VERSION=$(curl -s "https://raw.githubusercontent.com/TheWorldAvatar/stack/main/VERSION") +MAIN_VERSION=1.49.0 + +if [ "$VERSION" == "" ]; then + echo -e "\e[31mError\e[0m: VERSION file is empty. Please ensure the correct version number is written here. Version currently on main is: $MAIN_VERSION" + exit 1 +fi +echo "Version set in this PR: $VERSION" +echo "Version on main: $MAIN_VERSION" + +# Get the VERSION file from the main branch of the repo, check that this new version is updated ie does not match +if [ "$VERSION" == "$MAIN_VERSION" ]; then + echo -e "\e[31mError\e[0m: VERSION specified on this branch matches that on main. Update the VERSION file before merging." + exit 1 +fi + +# Check that there's no -SNAPSHOT qualifier and that the version follows the semantic versioning pattern +if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo -e "\e[31mError\e[0m: VERSION must follow the semantic versioning pattern x.y.z where x, y, and z are numbers" + exit 1 +fi + +# Check that the new version is incremented correctly +IFS='.' read -r -a MAIN_VERSION_PARTS <<<"$MAIN_VERSION" +IFS='.' read -r -a VERSION_PARTS <<<"$VERSION" + +# Check for valid patch increment (x.y.z+1) +PATCH_INCREMENT=$((MAIN_VERSION_PARTS[2] + 1)) +if [ "${VERSION_PARTS[0]}" -eq "${MAIN_VERSION_PARTS[0]}" ] && + [ "${VERSION_PARTS[1]}" -eq "${MAIN_VERSION_PARTS[1]}" ] && + [ "${VERSION_PARTS[2]}" -eq "$PATCH_INCREMENT" ]; then + VALID_INCREMENT=true +fi + +# Check for valid minor increment (x.y+1.0) +MINOR_INCREMENT=$((MAIN_VERSION_PARTS[1] + 1)) +if [ "${VERSION_PARTS[0]}" -eq "${MAIN_VERSION_PARTS[0]}" ] && + [ "${VERSION_PARTS[1]}" -eq "$MINOR_INCREMENT" ] && + [ "${VERSION_PARTS[2]}" -eq 0 ]; then + VALID_INCREMENT=true +fi + +# Check for valid major increment (x+1.0.0) +MAJOR_INCREMENT=$((MAIN_VERSION_PARTS[0] + 1)) +if [ "${VERSION_PARTS[0]}" -eq "$MAJOR_INCREMENT" ] && + [ "${VERSION_PARTS[1]}" -eq 0 ] && + [ "${VERSION_PARTS[2]}" -eq 0 ]; then + VALID_INCREMENT=true +fi + +if [ "$VALID_INCREMENT" != true ]; then + echo -e "\e[31mError\e[0m: VERSION must be properly incremented. Valid increments are: patch (x.y.z+1), minor (x.y+1.0), or major (x+1.0.0)" + exit 1 +fi + +# Update version in POM files +POM_FILES=( + "stack-clients/pom.xml" + "stack-manager/pom.xml" + "stack-data-uploader/pom.xml" +) + +for POM in "${POM_FILES[@]}"; do + if [ -f "$POM" ]; then + sed -i -E "0,/[0-9]+\.[0-9]+\.[0-9]+<\/version>/s//$VERSION<\/version>/" "$POM" + echo "Updated version in $POM to $VERSION" + else + echo -e "\e[31mError\e[0m: $POM not found" + exit 1 + fi +done + +# Update image version in docker-compose.yml files +DOCKER_COMPOSE_FILES=( + "stack-clients/docker-compose.yml" + "stack-manager/docker-compose.yml" + "stack-data-uploader/docker-compose.yml" +) + +for DOCKER_COMPOSE in "${DOCKER_COMPOSE_FILES[@]}"; do + if [ -f "$DOCKER_COMPOSE" ]; then + sed -i.bak -E "s|(image: .+:).+|\1$VERSION|" "$DOCKER_COMPOSE" && rm "$DOCKER_COMPOSE.bak" + echo "Updated image version in $DOCKER_COMPOSE to $VERSION" + else + echo -e "\e[31mError\e[0m: $DOCKER_COMPOSE not found" + exit 1 + fi +done + +echo -e "\e[32mVersion incremented\e[0m, compose file and package.json updated. Next step in this action will commit the changes" + +exit 0 diff --git a/.github/scripts/increment-package-version.sh b/.github/scripts/increment-package-version.sh new file mode 100755 index 00000000..49250848 --- /dev/null +++ b/.github/scripts/increment-package-version.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Update image version in docker-compose.yml +DOCKER_COMPOSE_CLIENT="stack-clients/docker-compose.yml" +DOCKER_COMPOSE_MANAGER="stack-manager/docker-compose.yml" +DOCKER_COMPOSE_UPLOADER="stack-data-uploader/docker-compose.yml" + +POM_CLIENT="stack-clients/pom.xml" +POM_MANAGER="stack-manager/pom.xml" +POM_UPLOADER="stack-data-uploader/pom.xml" + +POM_FILES=("$POM_CLIENT" "$POM_MANAGER" "$POM_UPLOADER") +COMPOSE_FILES=("$DOCKER_COMPOSE_CLIENT" "$DOCKER_COMPOSE_MANAGER" "$DOCKER_COMPOSE_UPLOADER") + +for compose in "${COMPOSE_FILES[@]}"; do + if [ -f "$compose" ]; then + sed -i.bak -E "s|(image: .+:).+|\1$VERSION|" "$compose" && rm "$compose.bak" + echo "Updated image version in $compose to $VERSION" + else + echo -e "\e[31mError\e[0m: $compose not found" + exit 1 + fi +done + +for pom in "${POM_FILES[@]}"; do + if [ -f "$pom" ]; then + sed -i.bak -E "s|().+()|\1$VERSION\2|" "$pom" && rm "$pom.bak" + echo "Updated version in $pom to $VERSION" + else + echo -e "\e[31mError\e[0m: $pom not found" + exit 1 + fi +done + +echo -e "\e[32mVersion incremented\e[0m, compose file updated. Next step in this action will commit the changes" diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml new file mode 100644 index 00000000..e2a7b440 --- /dev/null +++ b/.github/workflows/check-version.yml @@ -0,0 +1,60 @@ +name: Check and Consolidate Version + +on: + pull_request: + branches: + - main + paths: + - stack-clients/src** + - stack-manager/src** + - stack-data-uploader/src** + +jobs: + check-version: + if: github.actor != 'dependabot[bot]' + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Set up Git + run: | + git config --global user.email "stack-bot@noreply.theworldavatar.io" + git config --global user.name "twa-stack-bot" + + - name: Check VERSION file + run: | + chmod +x .github/scripts/check-version.sh + .github/scripts/check-version.sh + + - name: Save version to github environment + run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV + + - name: Set VERSION in pom.xml and docker-compose.yml + run: | + chmod +x .github/scripts/increment-package-version.sh + .github/scripts/increment-package-version.sh + + - name: Check for changes + id: changes + run: | + git checkout ${{ github.head_ref }} + git add stack-clients/pom.xml stack-manager/pom.xml stack-data-uploader/pom.xml stack-clients/docker-compose.yml stack-manager/docker-compose.yml stack-data-uploader/docker-compose.yml + if ! git diff-index --quiet HEAD --; then + echo "::set-output name=changes::changes" + fi + + - name: Push auto incremented version changes + if: steps.changes.outputs.changes == 'changes' + run: | + git commit -m "Update version to $VERSION in package files" + git push origin ${{ github.head_ref }} + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml new file mode 100644 index 00000000..52e62509 --- /dev/null +++ b/.github/workflows/docker-ci.yml @@ -0,0 +1,72 @@ +name: Docker Image CI + +on: + push: + branches: main + paths: + - code/** + workflow_dispatch: + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + permissions: + packages: write + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set version variables from file + id: read-version + run: | + if [ -f VERSION ]; then + VERSION=$(cat VERSION) + else + echo "VERSION file not found" + exit 1 + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "MAJOR=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_ENV + echo "MINOR=$(echo $VERSION | cut -d. -f1).$(echo $VERSION | cut -d. -f2)" >> $GITHUB_ENV + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build stack clients docker image and push to ghcr + uses: docker/build-push-action@v6 + with: + file: stack-clients/Dockerfile + push: true + tags: | + ghcr.io/theworldavatar/stack-clients:latest + ghcr.io/theworldavatar/stack-clients:${{ env.VERSION }} + ghcr.io/theworldavatar/stack-clients:${{ env.MAJOR }} + ghcr.io/theworldavatar/stack-clients:${{ env.MINOR }} + + - name: Build stack manager docker image and push to ghcr + uses: docker/build-push-action@v6 + with: + file: stack-manager/Dockerfile + push: true + tags: | + ghcr.io/theworldavatar/stack-manager:latest + ghcr.io/theworldavatar/stack-manager:${{ env.VERSION }} + ghcr.io/theworldavatar/stack-manager:${{ env.MAJOR }} + ghcr.io/theworldavatar/stack-manager:${{ env.MINOR }} + + - name: Build stack data uploader docker image and push to ghcr + uses: docker/build-push-action@v6 + with: + file: stack-data-uploader/Dockerfile + push: true + tags: | + ghcr.io/theworldavatar/stack-data-uploader:latest + ghcr.io/theworldavatar/stack-data-uploader:${{ env.VERSION }} + ghcr.io/theworldavatar/stack-data-uploader:${{ env.MAJOR }} + ghcr.io/theworldavatar/stack-data-uploader:${{ env.MINOR }} diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml new file mode 100644 index 00000000..932e85f3 --- /dev/null +++ b/.github/workflows/tag-version.yml @@ -0,0 +1,48 @@ +name: Tag Version + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + tag-version: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Git + run: | + git config --global user.email "stack-bot@noreply.theworldavatar.io" + git config --global user.name "twa-stack-bot" + + - name: Save version to environment + run: | + if [ -f VERSION ]; then + echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV + else + echo "VERSION file not found" && exit 1 + fi + + - name: Check if tag exists + id: check_tag + run: | + if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then + echo "TAG_EXISTS=true" >> $GITHUB_ENV + else + echo "TAG_EXISTS=false" >> $GITHUB_ENV + fi + + - name: Create tag + if: env.TAG_EXISTS == 'false' + run: | + git tag -a "v${{ env.VERSION }}" -m "Version ${{ env.VERSION }}" + git push origin "v${{ env.VERSION }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..c8bb6112 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.49.1 \ No newline at end of file From d5e89b2ec0368e9214a2cab8c4e3b1b348c2c211 Mon Sep 17 00:00:00 2001 From: ushcode Date: Thu, 3 Jul 2025 16:07:46 +0100 Subject: [PATCH 02/27] fix versioning script to target the correct artefactIDs --- .github/scripts/check-version.sh | 42 +++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check-version.sh b/.github/scripts/check-version.sh index 5c911cf4..e72aaf8c 100755 --- a/.github/scripts/check-version.sh +++ b/.github/scripts/check-version.sh @@ -1,9 +1,16 @@ #!/bin/bash -VERSION=$(cat -s "VERSION" 2>/dev/null) MAIN_VERSION=$(curl -s "https://raw.githubusercontent.com/TheWorldAvatar/stack/main/VERSION") MAIN_VERSION=1.49.0 +# Check if MAIN_VERSION is a semantic version number +if ! [[ "$MAIN_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "No version set on main, skipping version check" + exit 0 +fi + +VERSION=$(cat -s "VERSION" 2>/dev/null) + if [ "$VERSION" == "" ]; then echo -e "\e[31mError\e[0m: VERSION file is empty. Please ensure the correct version number is written here. Version currently on main is: $MAIN_VERSION" exit 1 @@ -17,7 +24,7 @@ if [ "$VERSION" == "$MAIN_VERSION" ]; then exit 1 fi -# Check that there's no -SNAPSHOT qualifier and that the version follows the semantic versioning pattern +# Check that VERSION follows the semantic versioning pattern if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo -e "\e[31mError\e[0m: VERSION must follow the semantic versioning pattern x.y.z where x, y, and z are numbers" exit 1 @@ -65,7 +72,36 @@ POM_FILES=( for POM in "${POM_FILES[@]}"; do if [ -f "$POM" ]; then - sed -i -E "0,/[0-9]+\.[0-9]+\.[0-9]+<\/version>/s//$VERSION<\/version>/" "$POM" + ARTIFACT_ID=$(basename "$(dirname "$POM")") + # Update the main for the artifact + awk -v ver="$VERSION" -v aid="$ARTIFACT_ID" ' + BEGIN { found=0 } + // { + if ($0 ~ "" aid "") found=1 + else found=0 + } + found && /[0-9]+\.[0-9]+\.[0-9]+<\/version>/ && !done[aid] { + sub(/[0-9]+\.[0-9]+\.[0-9]+<\/version>/, "" ver "") + done[aid]=1 + } + { print } + ' "$POM" > "$POM.tmp" && mv "$POM.tmp" "$POM" + + # If this is stack-manager or stack-data-uploader, update stack-clients dependency version robustly + if [[ "$ARTIFACT_ID" == "stack-manager" || "$ARTIFACT_ID" == "stack-data-uploader" ]]; then + awk -v ver="$VERSION" ' + BEGIN { in_dep=0; found=0 } + // { in_dep=1; found=0 } + in_dep && /stack-clients<\/artifactId>/ { found=1 } + in_dep && found && /[0-9]+\.[0-9]+\.[0-9]+<\/version>/ { + sub(/[0-9]+\.[0-9]+\.[0-9]+<\/version>/, "" ver "") + found=0 + } + /<\/dependency>/ { in_dep=0; found=0 } + { print } + ' "$POM" > "$POM.tmp" && mv "$POM.tmp" "$POM" + fi + echo "Updated version in $POM to $VERSION" else echo -e "\e[31mError\e[0m: $POM not found" From 331aa63c5bbe427b7988a55c7fec53b3900c159a Mon Sep 17 00:00:00 2001 From: ushcode Date: Thu, 3 Jul 2025 16:27:42 +0100 Subject: [PATCH 03/27] restore working version workflow --- .github/workflows/check-version.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml index e2a7b440..f70f9230 100644 --- a/.github/workflows/check-version.yml +++ b/.github/workflows/check-version.yml @@ -8,6 +8,7 @@ on: - stack-clients/src** - stack-manager/src** - stack-data-uploader/src** + - VERSION jobs: check-version: @@ -22,26 +23,23 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} + token: ${{ secrets.CI_TRIGGER_PAT_USHCODE }} + ## By default, actions/checkout uses the GITHUB_TOKEN secret, but this does not trigger CI which is required after this action, otherwise if the final commit is the twa-bot one, it will not check linting etc before a merge. This PAT ensures that CI is run - name: Set up Git run: | git config --global user.email "stack-bot@noreply.theworldavatar.io" git config --global user.name "twa-stack-bot" - - name: Check VERSION file + - name: Check version incrementation run: | chmod +x .github/scripts/check-version.sh .github/scripts/check-version.sh - - name: Save version to github environment + - name: Save version to environment run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - name: Set VERSION in pom.xml and docker-compose.yml - run: | - chmod +x .github/scripts/increment-package-version.sh - .github/scripts/increment-package-version.sh - - - name: Check for changes + - name: Check if package files have been changed by action id: changes run: | git checkout ${{ github.head_ref }} @@ -55,6 +53,6 @@ jobs: run: | git commit -m "Update version to $VERSION in package files" git push origin ${{ github.head_ref }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.CI_TRIGGER_PAT_USHCODE }} + ## Again, use the PAT to trigger CI \ No newline at end of file From 3df0b373a2cfd8d6a550e868a92d2d5a857ee769 Mon Sep 17 00:00:00 2001 From: twa-stack-bot Date: Thu, 3 Jul 2025 15:28:18 +0000 Subject: [PATCH 04/27] Update version to 1.49.1 in package files --- stack-clients/docker-compose.yml | 2 +- stack-clients/pom.xml | 4 ++-- stack-data-uploader/docker-compose.yml | 2 +- stack-data-uploader/pom.xml | 6 +++--- stack-manager/docker-compose.yml | 2 +- stack-manager/pom.xml | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/stack-clients/docker-compose.yml b/stack-clients/docker-compose.yml index 3c7f0b2a..0404c5e8 100644 --- a/stack-clients/docker-compose.yml +++ b/stack-clients/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-client: - image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.0 + image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.1 secrets: - blazegraph_password - postgis_password diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index 6e47c0ff..05f90fe0 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-clients - 1.49.0 + 1.49.1 Stack Clients https://theworldavatar.io @@ -226,4 +226,4 @@ - \ No newline at end of file + diff --git a/stack-data-uploader/docker-compose.yml b/stack-data-uploader/docker-compose.yml index d40112d1..b5c44cdb 100644 --- a/stack-data-uploader/docker-compose.yml +++ b/stack-data-uploader/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-data-uploader: - image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.0 + image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.1 secrets: - blazegraph_password - postgis_password diff --git a/stack-data-uploader/pom.xml b/stack-data-uploader/pom.xml index 9c735fcd..d3483fa4 100644 --- a/stack-data-uploader/pom.xml +++ b/stack-data-uploader/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-data-uploader - 1.49.0 + 1.49.1 Stack Data Uploader https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.0 + 1.49.1 @@ -102,4 +102,4 @@ - \ No newline at end of file + diff --git a/stack-manager/docker-compose.yml b/stack-manager/docker-compose.yml index 57b7a53e..6c4684a0 100644 --- a/stack-manager/docker-compose.yml +++ b/stack-manager/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-manager: - image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.0 + image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.1 environment: EXTERNAL_PORT: "${EXTERNAL_PORT-3838}" STACK_BASE_DIR: "${STACK_BASE_DIR}" diff --git a/stack-manager/pom.xml b/stack-manager/pom.xml index d6c8e900..89dba94a 100644 --- a/stack-manager/pom.xml +++ b/stack-manager/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-manager - 1.49.0 + 1.49.1 Stack Manager https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.0 + 1.49.1 @@ -103,4 +103,4 @@ - \ No newline at end of file + From f4c2d32530950eb12d0839cdb49e5a59010b9bd1 Mon Sep 17 00:00:00 2001 From: ushcode Date: Thu, 3 Jul 2025 16:37:26 +0100 Subject: [PATCH 05/27] try get checker working --- .github/workflows/check-version.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml index f70f9230..c1154c9d 100644 --- a/.github/workflows/check-version.yml +++ b/.github/workflows/check-version.yml @@ -4,11 +4,11 @@ on: pull_request: branches: - main - paths: - - stack-clients/src** - - stack-manager/src** - - stack-data-uploader/src** - - VERSION + # paths: + # - stack-clients/src** + # - stack-manager/src** + # - stack-data-uploader/src** + # - VERSION jobs: check-version: @@ -45,7 +45,7 @@ jobs: git checkout ${{ github.head_ref }} git add stack-clients/pom.xml stack-manager/pom.xml stack-data-uploader/pom.xml stack-clients/docker-compose.yml stack-manager/docker-compose.yml stack-data-uploader/docker-compose.yml if ! git diff-index --quiet HEAD --; then - echo "::set-output name=changes::changes" + echo "changes=changes" >> $GITHUB_OUTPUT fi - name: Push auto incremented version changes From 734100b8ec31a549cf892d8e5070d00a8f2eed63 Mon Sep 17 00:00:00 2001 From: ushcode Date: Thu, 3 Jul 2025 16:43:20 +0100 Subject: [PATCH 06/27] again --- .github/scripts/check-version.sh | 77 +------------------- .github/scripts/increment-package-version.sh | 39 ++++++++-- .github/workflows/check-version.yml | 28 +++---- 3 files changed, 51 insertions(+), 93 deletions(-) diff --git a/.github/scripts/check-version.sh b/.github/scripts/check-version.sh index e72aaf8c..31c6f73e 100755 --- a/.github/scripts/check-version.sh +++ b/.github/scripts/check-version.sh @@ -1,16 +1,9 @@ #!/bin/bash +VERSION=$(cat -s "VERSION" 2>/dev/null) MAIN_VERSION=$(curl -s "https://raw.githubusercontent.com/TheWorldAvatar/stack/main/VERSION") MAIN_VERSION=1.49.0 -# Check if MAIN_VERSION is a semantic version number -if ! [[ "$MAIN_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "No version set on main, skipping version check" - exit 0 -fi - -VERSION=$(cat -s "VERSION" 2>/dev/null) - if [ "$VERSION" == "" ]; then echo -e "\e[31mError\e[0m: VERSION file is empty. Please ensure the correct version number is written here. Version currently on main is: $MAIN_VERSION" exit 1 @@ -24,7 +17,7 @@ if [ "$VERSION" == "$MAIN_VERSION" ]; then exit 1 fi -# Check that VERSION follows the semantic versioning pattern +# Check that there's no -SNAPSHOT qualifier and that the version follows the semantic versioning pattern if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo -e "\e[31mError\e[0m: VERSION must follow the semantic versioning pattern x.y.z where x, y, and z are numbers" exit 1 @@ -62,70 +55,4 @@ if [ "$VALID_INCREMENT" != true ]; then echo -e "\e[31mError\e[0m: VERSION must be properly incremented. Valid increments are: patch (x.y.z+1), minor (x.y+1.0), or major (x+1.0.0)" exit 1 fi - -# Update version in POM files -POM_FILES=( - "stack-clients/pom.xml" - "stack-manager/pom.xml" - "stack-data-uploader/pom.xml" -) - -for POM in "${POM_FILES[@]}"; do - if [ -f "$POM" ]; then - ARTIFACT_ID=$(basename "$(dirname "$POM")") - # Update the main for the artifact - awk -v ver="$VERSION" -v aid="$ARTIFACT_ID" ' - BEGIN { found=0 } - // { - if ($0 ~ "" aid "") found=1 - else found=0 - } - found && /[0-9]+\.[0-9]+\.[0-9]+<\/version>/ && !done[aid] { - sub(/[0-9]+\.[0-9]+\.[0-9]+<\/version>/, "" ver "") - done[aid]=1 - } - { print } - ' "$POM" > "$POM.tmp" && mv "$POM.tmp" "$POM" - - # If this is stack-manager or stack-data-uploader, update stack-clients dependency version robustly - if [[ "$ARTIFACT_ID" == "stack-manager" || "$ARTIFACT_ID" == "stack-data-uploader" ]]; then - awk -v ver="$VERSION" ' - BEGIN { in_dep=0; found=0 } - // { in_dep=1; found=0 } - in_dep && /stack-clients<\/artifactId>/ { found=1 } - in_dep && found && /[0-9]+\.[0-9]+\.[0-9]+<\/version>/ { - sub(/[0-9]+\.[0-9]+\.[0-9]+<\/version>/, "" ver "") - found=0 - } - /<\/dependency>/ { in_dep=0; found=0 } - { print } - ' "$POM" > "$POM.tmp" && mv "$POM.tmp" "$POM" - fi - - echo "Updated version in $POM to $VERSION" - else - echo -e "\e[31mError\e[0m: $POM not found" - exit 1 - fi -done - -# Update image version in docker-compose.yml files -DOCKER_COMPOSE_FILES=( - "stack-clients/docker-compose.yml" - "stack-manager/docker-compose.yml" - "stack-data-uploader/docker-compose.yml" -) - -for DOCKER_COMPOSE in "${DOCKER_COMPOSE_FILES[@]}"; do - if [ -f "$DOCKER_COMPOSE" ]; then - sed -i.bak -E "s|(image: .+:).+|\1$VERSION|" "$DOCKER_COMPOSE" && rm "$DOCKER_COMPOSE.bak" - echo "Updated image version in $DOCKER_COMPOSE to $VERSION" - else - echo -e "\e[31mError\e[0m: $DOCKER_COMPOSE not found" - exit 1 - fi -done - -echo -e "\e[32mVersion incremented\e[0m, compose file and package.json updated. Next step in this action will commit the changes" - exit 0 diff --git a/.github/scripts/increment-package-version.sh b/.github/scripts/increment-package-version.sh index 49250848..2ab0d557 100755 --- a/.github/scripts/increment-package-version.sh +++ b/.github/scripts/increment-package-version.sh @@ -22,12 +22,41 @@ for compose in "${COMPOSE_FILES[@]}"; do fi done -for pom in "${POM_FILES[@]}"; do - if [ -f "$pom" ]; then - sed -i.bak -E "s|().+()|\1$VERSION\2|" "$pom" && rm "$pom.bak" - echo "Updated version in $pom to $VERSION" +for POM in "${POM_FILES[@]}"; do + if [ -f "$POM" ]; then + ARTIFACT_ID=$(basename "$(dirname "$POM")") + # Update the main for the artifact + awk -v ver="$VERSION" -v aid="$ARTIFACT_ID" ' + BEGIN { found=0 } + // { + if ($0 ~ "" aid "") found=1 + else found=0 + } + found && /[0-9]+\.[0-9]+\.[0-9]+<\/version>/ && !done[aid] { + sub(/[0-9]+\.[0-9]+\.[0-9]+<\/version>/, "" ver "") + done[aid]=1 + } + { print } + ' "$POM" > "$POM.tmp" && mv "$POM.tmp" "$POM" + + # If this is stack-manager or stack-data-uploader, update stack-clients dependency version robustly + if [[ "$ARTIFACT_ID" == "stack-manager" || "$ARTIFACT_ID" == "stack-data-uploader" ]]; then + awk -v ver="$VERSION" ' + BEGIN { in_dep=0; found=0 } + // { in_dep=1; found=0 } + in_dep && /stack-clients<\/artifactId>/ { found=1 } + in_dep && found && /[0-9]+\.[0-9]+\.[0-9]+<\/version>/ { + sub(/[0-9]+\.[0-9]+\.[0-9]+<\/version>/, "" ver "") + found=0 + } + /<\/dependency>/ { in_dep=0; found=0 } + { print } + ' "$POM" > "$POM.tmp" && mv "$POM.tmp" "$POM" + fi + + echo "Updated version in $POM to $VERSION" else - echo -e "\e[31mError\e[0m: $pom not found" + echo -e "\e[31mError\e[0m: $POM not found" exit 1 fi done diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml index c1154c9d..e2a7b440 100644 --- a/.github/workflows/check-version.yml +++ b/.github/workflows/check-version.yml @@ -4,11 +4,10 @@ on: pull_request: branches: - main - # paths: - # - stack-clients/src** - # - stack-manager/src** - # - stack-data-uploader/src** - # - VERSION + paths: + - stack-clients/src** + - stack-manager/src** + - stack-data-uploader/src** jobs: check-version: @@ -23,29 +22,32 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - token: ${{ secrets.CI_TRIGGER_PAT_USHCODE }} - ## By default, actions/checkout uses the GITHUB_TOKEN secret, but this does not trigger CI which is required after this action, otherwise if the final commit is the twa-bot one, it will not check linting etc before a merge. This PAT ensures that CI is run - name: Set up Git run: | git config --global user.email "stack-bot@noreply.theworldavatar.io" git config --global user.name "twa-stack-bot" - - name: Check version incrementation + - name: Check VERSION file run: | chmod +x .github/scripts/check-version.sh .github/scripts/check-version.sh - - name: Save version to environment + - name: Save version to github environment run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - name: Check if package files have been changed by action + - name: Set VERSION in pom.xml and docker-compose.yml + run: | + chmod +x .github/scripts/increment-package-version.sh + .github/scripts/increment-package-version.sh + + - name: Check for changes id: changes run: | git checkout ${{ github.head_ref }} git add stack-clients/pom.xml stack-manager/pom.xml stack-data-uploader/pom.xml stack-clients/docker-compose.yml stack-manager/docker-compose.yml stack-data-uploader/docker-compose.yml if ! git diff-index --quiet HEAD --; then - echo "changes=changes" >> $GITHUB_OUTPUT + echo "::set-output name=changes::changes" fi - name: Push auto incremented version changes @@ -53,6 +55,6 @@ jobs: run: | git commit -m "Update version to $VERSION in package files" git push origin ${{ github.head_ref }} + env: - GITHUB_TOKEN: ${{ secrets.CI_TRIGGER_PAT_USHCODE }} - ## Again, use the PAT to trigger CI \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b57ee36221b0e5875364a980e69558aa38ef5e92 Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 13:29:57 +0100 Subject: [PATCH 07/27] lint error for ci workflow --- .github/workflows/docker-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 52e62509..f3a6872a 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -2,7 +2,8 @@ name: Docker Image CI on: push: - branches: main + branches: + - main paths: - code/** workflow_dispatch: From 55a13b675be55db0f09541fa8288a69d5d5d3c51 Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 13:30:29 +0100 Subject: [PATCH 08/27] check version --- .github/scripts/check-version.sh | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/check-version.sh b/.github/scripts/check-version.sh index 31c6f73e..0bb3cbd3 100755 --- a/.github/scripts/check-version.sh +++ b/.github/scripts/check-version.sh @@ -2,7 +2,7 @@ VERSION=$(cat -s "VERSION" 2>/dev/null) MAIN_VERSION=$(curl -s "https://raw.githubusercontent.com/TheWorldAvatar/stack/main/VERSION") -MAIN_VERSION=1.49.0 +MAIN_VERSION=1.49.1 if [ "$VERSION" == "" ]; then echo -e "\e[31mError\e[0m: VERSION file is empty. Please ensure the correct version number is written here. Version currently on main is: $MAIN_VERSION" diff --git a/VERSION b/VERSION index c8bb6112..934070c5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.49.1 \ No newline at end of file +1.49.2 \ No newline at end of file From 22a70a8b4ca7609b215030da2de24c6f255f5209 Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 14:06:26 +0100 Subject: [PATCH 09/27] test wihtout path check --- .github/workflows/check-version.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml index e2a7b440..2890c48b 100644 --- a/.github/workflows/check-version.yml +++ b/.github/workflows/check-version.yml @@ -4,10 +4,10 @@ on: pull_request: branches: - main - paths: - - stack-clients/src** - - stack-manager/src** - - stack-data-uploader/src** + # paths: + # - stack-clients/src** + # - stack-manager/src** + # - stack-data-uploader/src** jobs: check-version: From f1e2231c18983f92fbd2c41ff4ae411f2acb2327 Mon Sep 17 00:00:00 2001 From: twa-stack-bot Date: Tue, 8 Jul 2025 13:06:41 +0000 Subject: [PATCH 10/27] Update version to 1.49.2 in package files --- stack-clients/docker-compose.yml | 2 +- stack-clients/pom.xml | 2 +- stack-data-uploader/docker-compose.yml | 2 +- stack-data-uploader/pom.xml | 4 ++-- stack-manager/docker-compose.yml | 2 +- stack-manager/pom.xml | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stack-clients/docker-compose.yml b/stack-clients/docker-compose.yml index 0404c5e8..ca6166f8 100644 --- a/stack-clients/docker-compose.yml +++ b/stack-clients/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-client: - image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.1 + image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.2 secrets: - blazegraph_password - postgis_password diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index 05f90fe0..232d1895 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-clients - 1.49.1 + 1.49.2 Stack Clients https://theworldavatar.io diff --git a/stack-data-uploader/docker-compose.yml b/stack-data-uploader/docker-compose.yml index b5c44cdb..a55ee8f9 100644 --- a/stack-data-uploader/docker-compose.yml +++ b/stack-data-uploader/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-data-uploader: - image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.1 + image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.2 secrets: - blazegraph_password - postgis_password diff --git a/stack-data-uploader/pom.xml b/stack-data-uploader/pom.xml index d3483fa4..436bb94e 100644 --- a/stack-data-uploader/pom.xml +++ b/stack-data-uploader/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-data-uploader - 1.49.1 + 1.49.2 Stack Data Uploader https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.1 + 1.49.2 diff --git a/stack-manager/docker-compose.yml b/stack-manager/docker-compose.yml index 6c4684a0..74899740 100644 --- a/stack-manager/docker-compose.yml +++ b/stack-manager/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-manager: - image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.1 + image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.2 environment: EXTERNAL_PORT: "${EXTERNAL_PORT-3838}" STACK_BASE_DIR: "${STACK_BASE_DIR}" diff --git a/stack-manager/pom.xml b/stack-manager/pom.xml index 89dba94a..ecded4b5 100644 --- a/stack-manager/pom.xml +++ b/stack-manager/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-manager - 1.49.1 + 1.49.2 Stack Manager https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.1 + 1.49.2 From 4430b8e1a157e7a45359c7335e011e6e87cf3fa1 Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 14:21:56 +0100 Subject: [PATCH 11/27] cleanup after actions tests, will be squashed --- .github/scripts/check-version.sh | 1 - .github/workflows/check-version.yml | 8 ++++---- .vscode/settings.json | 3 +++ VERSION | 2 +- stack-clients/docker-compose.yml | 2 +- stack-clients/pom.xml | 2 +- stack-data-uploader/docker-compose.yml | 2 +- stack-data-uploader/pom.xml | 4 ++-- stack-manager/docker-compose.yml | 2 +- stack-manager/pom.xml | 4 ++-- 10 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.github/scripts/check-version.sh b/.github/scripts/check-version.sh index 0bb3cbd3..518b6c8c 100755 --- a/.github/scripts/check-version.sh +++ b/.github/scripts/check-version.sh @@ -2,7 +2,6 @@ VERSION=$(cat -s "VERSION" 2>/dev/null) MAIN_VERSION=$(curl -s "https://raw.githubusercontent.com/TheWorldAvatar/stack/main/VERSION") -MAIN_VERSION=1.49.1 if [ "$VERSION" == "" ]; then echo -e "\e[31mError\e[0m: VERSION file is empty. Please ensure the correct version number is written here. Version currently on main is: $MAIN_VERSION" diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml index 2890c48b..e2a7b440 100644 --- a/.github/workflows/check-version.yml +++ b/.github/workflows/check-version.yml @@ -4,10 +4,10 @@ on: pull_request: branches: - main - # paths: - # - stack-clients/src** - # - stack-manager/src** - # - stack-data-uploader/src** + paths: + - stack-clients/src** + - stack-manager/src** + - stack-data-uploader/src** jobs: check-version: diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..c5f3f6b9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/VERSION b/VERSION index 934070c5..223852a8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.49.2 \ No newline at end of file +1.49.0 \ No newline at end of file diff --git a/stack-clients/docker-compose.yml b/stack-clients/docker-compose.yml index ca6166f8..3c7f0b2a 100644 --- a/stack-clients/docker-compose.yml +++ b/stack-clients/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-client: - image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.2 + image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.0 secrets: - blazegraph_password - postgis_password diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index 232d1895..d4c2f3a8 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-clients - 1.49.2 + 1.49.0 Stack Clients https://theworldavatar.io diff --git a/stack-data-uploader/docker-compose.yml b/stack-data-uploader/docker-compose.yml index a55ee8f9..d40112d1 100644 --- a/stack-data-uploader/docker-compose.yml +++ b/stack-data-uploader/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-data-uploader: - image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.2 + image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.0 secrets: - blazegraph_password - postgis_password diff --git a/stack-data-uploader/pom.xml b/stack-data-uploader/pom.xml index 436bb94e..83d95827 100644 --- a/stack-data-uploader/pom.xml +++ b/stack-data-uploader/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-data-uploader - 1.49.2 + 1.49.0 Stack Data Uploader https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.2 + 1.49.0 diff --git a/stack-manager/docker-compose.yml b/stack-manager/docker-compose.yml index 74899740..57b7a53e 100644 --- a/stack-manager/docker-compose.yml +++ b/stack-manager/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-manager: - image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.2 + image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.0 environment: EXTERNAL_PORT: "${EXTERNAL_PORT-3838}" STACK_BASE_DIR: "${STACK_BASE_DIR}" diff --git a/stack-manager/pom.xml b/stack-manager/pom.xml index ecded4b5..13d24a3a 100644 --- a/stack-manager/pom.xml +++ b/stack-manager/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-manager - 1.49.2 + 1.49.0 Stack Manager https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.2 + 1.49.0 From 9e2b9f2ccc76d074c5d3936cba4748621c993908 Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 15:00:07 +0100 Subject: [PATCH 12/27] trigger CI on PR for test --- .github/workflows/docker-ci.yml | 3 +++ VERSION | 2 +- stack-clients/docker-compose.yml | 2 +- stack-clients/pom.xml | 2 +- stack-data-uploader/docker-compose.yml | 2 +- stack-data-uploader/pom.xml | 4 ++-- stack-manager/docker-compose.yml | 2 +- stack-manager/pom.xml | 4 ++-- 8 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index f3a6872a..65be8029 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -7,6 +7,9 @@ on: paths: - code/** workflow_dispatch: + pull_request: + branches: + - main jobs: build-and-push-image: diff --git a/VERSION b/VERSION index 223852a8..05f433fe 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.49.0 \ No newline at end of file +1.49.0-docker-CI-test \ No newline at end of file diff --git a/stack-clients/docker-compose.yml b/stack-clients/docker-compose.yml index 3c7f0b2a..84ee0173 100644 --- a/stack-clients/docker-compose.yml +++ b/stack-clients/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-client: - image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.0 + image: ghcr.io/theworldavatar/stack-client${IMAGE_SUFFIX}:1.49.0-docker-CI-test secrets: - blazegraph_password - postgis_password diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index d4c2f3a8..7a809c6a 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-clients - 1.49.0 + 1.49.0-docker-CI-test Stack Clients https://theworldavatar.io diff --git a/stack-data-uploader/docker-compose.yml b/stack-data-uploader/docker-compose.yml index d40112d1..36253236 100644 --- a/stack-data-uploader/docker-compose.yml +++ b/stack-data-uploader/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-data-uploader: - image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.0 + image: ghcr.io/theworldavatar/stack-data-uploader${IMAGE_SUFFIX}:1.49.0-docker-CI-test secrets: - blazegraph_password - postgis_password diff --git a/stack-data-uploader/pom.xml b/stack-data-uploader/pom.xml index 83d95827..743656f4 100644 --- a/stack-data-uploader/pom.xml +++ b/stack-data-uploader/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-data-uploader - 1.49.0 + 1.49.0-docker-CI-test Stack Data Uploader https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.0 + 1.49.0-docker-CI-test diff --git a/stack-manager/docker-compose.yml b/stack-manager/docker-compose.yml index 57b7a53e..d00ff676 100644 --- a/stack-manager/docker-compose.yml +++ b/stack-manager/docker-compose.yml @@ -1,6 +1,6 @@ services: stack-manager: - image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.0 + image: ghcr.io/theworldavatar/stack-manager${IMAGE_SUFFIX}:1.49.0-docker-CI-test environment: EXTERNAL_PORT: "${EXTERNAL_PORT-3838}" STACK_BASE_DIR: "${STACK_BASE_DIR}" diff --git a/stack-manager/pom.xml b/stack-manager/pom.xml index 13d24a3a..7f0687b7 100644 --- a/stack-manager/pom.xml +++ b/stack-manager/pom.xml @@ -7,7 +7,7 @@ com.cmclinnovations stack-manager - 1.49.0 + 1.49.0-docker-CI-test Stack Manager https://theworldavatar.io @@ -38,7 +38,7 @@ com.cmclinnovations stack-clients - 1.49.0 + 1.49.0-docker-CI-test From 3b2d9cdd6d7112772a453e97ddd640214e21e986 Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 17:11:08 +0100 Subject: [PATCH 13/27] fix context in docker action --- .github/workflows/docker-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 65be8029..4125b7bc 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -45,6 +45,7 @@ jobs: - name: Build stack clients docker image and push to ghcr uses: docker/build-push-action@v6 with: + context: stack-clients file: stack-clients/Dockerfile push: true tags: | @@ -56,6 +57,7 @@ jobs: - name: Build stack manager docker image and push to ghcr uses: docker/build-push-action@v6 with: + context: stack-manager file: stack-manager/Dockerfile push: true tags: | @@ -67,6 +69,7 @@ jobs: - name: Build stack data uploader docker image and push to ghcr uses: docker/build-push-action@v6 with: + context: stack-data-uploader file: stack-data-uploader/Dockerfile push: true tags: | From a492f3451b209e065e2838848738543e7419419f Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 17:44:36 +0100 Subject: [PATCH 14/27] pass secrets into dockerfiles --- .github/workflows/docker-ci.yml | 17 +++++++++++++++++ stack-clients/Dockerfile | 18 +++++++++++++++--- stack-data-uploader/Dockerfile | 20 +++++++++++++------- stack-manager/Dockerfile | 20 +++++++++++++------- 4 files changed, 58 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 4125b7bc..38d0f649 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -42,6 +42,21 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Generate Maven settings.xml for GitHub Packages + run: | + mkdir -p $HOME/.m2 + cat > $HOME/.m2/settings.xml < + + + github + ${{ github.actor }} + ${{ secrets.GITHUB_TOKEN }} + + + + EOF + - name: Build stack clients docker image and push to ghcr uses: docker/build-push-action@v6 with: @@ -53,6 +68,8 @@ jobs: ghcr.io/theworldavatar/stack-clients:${{ env.VERSION }} ghcr.io/theworldavatar/stack-clients:${{ env.MAJOR }} ghcr.io/theworldavatar/stack-clients:${{ env.MINOR }} + secrets: | + maven_settings=${{ github.workspace }}/.m2/settings.xml - name: Build stack manager docker image and push to ghcr uses: docker/build-push-action@v6 diff --git a/stack-clients/Dockerfile b/stack-clients/Dockerfile index 1bd4356e..84d2069f 100644 --- a/stack-clients/Dockerfile +++ b/stack-clients/Dockerfile @@ -1,16 +1,28 @@ +# syntax=docker/dockerfile:1.4 + # First stage: download the Java dependencies and build #================================================================================================== FROM maven:3.8.3-adoptopenjdk-11 AS builder -# Copy in Maven settings templates and credentials +# Use BuildKit secret for settings.xml if available, else use local credentials +# Copy in Maven settings templates and credentials for local builds COPY docker/credentials /root/credentials COPY docker/.m2 /root/.m2 +# If a secret settings.xml is provided, use it (for CI); otherwise, use the local one +RUN --mount=type=secret,id=maven_settings,required=false \ + if [ -f /run/secrets/maven_settings ]; then \ + cp /run/secrets/maven_settings /root/.m2/settings.xml; \ + fi + # Populate settings templates with credentials WORKDIR /root/.m2 # (Note that | rather than / is used as the sed delimiter, since encrypted passwords can contain the former, but not the latter -RUN sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml -RUN sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml +RUN --mount=type=secret,id=maven_settings,required=false \ + if [ ! -f /root/.m2/settings.xml ]; then \ + sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml && \ + sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml; \ + fi # Copy in Java source and build WORKDIR /root/code diff --git a/stack-data-uploader/Dockerfile b/stack-data-uploader/Dockerfile index 6f6149de..cce3fe0f 100644 --- a/stack-data-uploader/Dockerfile +++ b/stack-data-uploader/Dockerfile @@ -1,20 +1,26 @@ +# syntax=docker/dockerfile:1.4 # First stage: download the Java dependencies and build #================================================================================================== FROM maven:3.8.3-adoptopenjdk-11 AS builder -# Copy in Maven settings templates and credentials +# Copy in Maven settings templates and credentials for local builds COPY docker/credentials /root/credentials COPY docker/.m2 /root/.m2 -# Populate settings templates with credentials +# Use BuildKit secret for settings.xml if available, else use local credentials +RUN --mount=type=secret,id=maven_settings,required=false \ + if [ -f /run/secrets/maven_settings ]; then \ + cp /run/secrets/maven_settings /root/.m2/settings.xml; \ + fi + WORKDIR /root/.m2 -# (Note that | rather than / is used as the sed delimiter, since encrypted passwords can contain the former, but not the latter -RUN sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml -RUN sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml +RUN --mount=type=secret,id=maven_settings,required=false \ + if [ ! -f /root/.m2/settings.xml ]; then \ + sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml && \ + sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml; \ + fi -# Copy in Java source and build WORKDIR /root/code - # Copy just the pom.xml file COPY pom.xml ./pom.xml diff --git a/stack-manager/Dockerfile b/stack-manager/Dockerfile index 6f6149de..cce3fe0f 100644 --- a/stack-manager/Dockerfile +++ b/stack-manager/Dockerfile @@ -1,20 +1,26 @@ +# syntax=docker/dockerfile:1.4 # First stage: download the Java dependencies and build #================================================================================================== FROM maven:3.8.3-adoptopenjdk-11 AS builder -# Copy in Maven settings templates and credentials +# Copy in Maven settings templates and credentials for local builds COPY docker/credentials /root/credentials COPY docker/.m2 /root/.m2 -# Populate settings templates with credentials +# Use BuildKit secret for settings.xml if available, else use local credentials +RUN --mount=type=secret,id=maven_settings,required=false \ + if [ -f /run/secrets/maven_settings ]; then \ + cp /run/secrets/maven_settings /root/.m2/settings.xml; \ + fi + WORKDIR /root/.m2 -# (Note that | rather than / is used as the sed delimiter, since encrypted passwords can contain the former, but not the latter -RUN sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml -RUN sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml +RUN --mount=type=secret,id=maven_settings,required=false \ + if [ ! -f /root/.m2/settings.xml ]; then \ + sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml && \ + sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml; \ + fi -# Copy in Java source and build WORKDIR /root/code - # Copy just the pom.xml file COPY pom.xml ./pom.xml From 17a167d4fe533b9163328dbfb51cc5c08be00e34 Mon Sep 17 00:00:00 2001 From: ushcode Date: Tue, 8 Jul 2025 18:03:26 +0100 Subject: [PATCH 15/27] try alternate settings.xml file --- .github/workflows/docker-ci.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 38d0f649..976fad34 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -43,19 +43,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Generate Maven settings.xml for GitHub Packages - run: | - mkdir -p $HOME/.m2 - cat > $HOME/.m2/settings.xml < - - - github - ${{ github.actor }} - ${{ secrets.GITHUB_TOKEN }} - - - - EOF + uses: s4u/maven-settings-action@v3.1.0 - name: Build stack clients docker image and push to ghcr uses: docker/build-push-action@v6 From b312bdfa1179d7088280b547fd01fe3f1a419e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ois=C3=ADn?= Date: Wed, 9 Jul 2025 13:53:46 +0100 Subject: [PATCH 16/27] bash debug scripts --- .vscode/launch.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..c6211b58 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "bashdb", + "request": "launch", + "name": "Bash-Debug (select script from list of sh files)", + "cwd": "${workspaceFolder}", + "program": "${command:SelectScriptName}", + "args": [] + } + ] +} \ No newline at end of file From c94823e11f3009ddf81ece9198115c2ece98e11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ois=C3=ADn?= Date: Wed, 9 Jul 2025 13:55:46 +0100 Subject: [PATCH 17/27] reinstate issue management nodes in Poms for dependabot --- stack-clients/pom.xml | 8 +++++++- stack-data-uploader/pom.xml | 8 +++++++- stack-manager/pom.xml | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index 7a809c6a..b2e4f8a0 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -10,7 +10,13 @@ 1.49.0-docker-CI-test Stack Clients - https://theworldavatar.io + https://github.com/TheWorldAvatar/stack + + https://github.com/TheWorldAvatar/stack + + + https://github.com/TheWorldAvatar/stack/issues + uk.ac.cam.cares.jps diff --git a/stack-data-uploader/pom.xml b/stack-data-uploader/pom.xml index 743656f4..96994b70 100644 --- a/stack-data-uploader/pom.xml +++ b/stack-data-uploader/pom.xml @@ -10,7 +10,13 @@ 1.49.0-docker-CI-test Stack Data Uploader - https://theworldavatar.io + https://github.com/TheWorldAvatar/stack-data-uploader + + https://github.com/TheWorldAvatar/stack-data-uploader + + + https://github.com/TheWorldAvatar/stack-data-uploader/issues + uk.ac.cam.cares.jps diff --git a/stack-manager/pom.xml b/stack-manager/pom.xml index 7f0687b7..b8e6050f 100644 --- a/stack-manager/pom.xml +++ b/stack-manager/pom.xml @@ -10,7 +10,13 @@ 1.49.0-docker-CI-test Stack Manager - https://theworldavatar.io + https://github.com/TheWorldAvatar/stack-manager + + https://github.com/TheWorldAvatar/stack-manager + + + https://github.com/TheWorldAvatar/stack-manager/issues + uk.ac.cam.cares.jps From bd4e6474dff24efc74bd15030591a75a0d1e9084 Mon Sep 17 00:00:00 2001 From: ushcode Date: Fri, 11 Jul 2025 10:43:14 +0100 Subject: [PATCH 18/27] comment out local build settings --- stack-clients/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stack-clients/Dockerfile b/stack-clients/Dockerfile index 84d2069f..506767ef 100644 --- a/stack-clients/Dockerfile +++ b/stack-clients/Dockerfile @@ -6,8 +6,9 @@ FROM maven:3.8.3-adoptopenjdk-11 AS builder # Use BuildKit secret for settings.xml if available, else use local credentials # Copy in Maven settings templates and credentials for local builds -COPY docker/credentials /root/credentials -COPY docker/.m2 /root/.m2 + +# COPY docker/credentials /root/credentials +# COPY docker/.m2 /root/.m2 # If a secret settings.xml is provided, use it (for CI); otherwise, use the local one RUN --mount=type=secret,id=maven_settings,required=false \ From 75b9701d5c0f53ae5a49506c63e5605ac1027d4f Mon Sep 17 00:00:00 2001 From: ushcode Date: Fri, 11 Jul 2025 11:13:39 +0100 Subject: [PATCH 19/27] try a simpler build --- .github/workflows/docker-ci.yml | 21 +++++++-- .vscode/settings.json | 22 +++++++++- stack-clients/Dockerfile | 75 +++------------------------------ stack-data-uploader/Dockerfile | 57 +++---------------------- stack-manager/Dockerfile | 13 +++--- 5 files changed, 54 insertions(+), 134 deletions(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 976fad34..ea27d260 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -42,8 +42,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Generate Maven settings.xml for GitHub Packages - uses: s4u/maven-settings-action@v3.1.0 + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: '11' + + - name: Build with Maven (stack-clients) + working-directory: stack-clients + run: mvn clean package --update-snapshots -DskipTests - name: Build stack clients docker image and push to ghcr uses: docker/build-push-action@v6 @@ -56,8 +63,10 @@ jobs: ghcr.io/theworldavatar/stack-clients:${{ env.VERSION }} ghcr.io/theworldavatar/stack-clients:${{ env.MAJOR }} ghcr.io/theworldavatar/stack-clients:${{ env.MINOR }} - secrets: | - maven_settings=${{ github.workspace }}/.m2/settings.xml + + - name: Build with Maven (stack-manager) + working-directory: stack-manager + run: mvn clean package --update-snapshots -DskipTests - name: Build stack manager docker image and push to ghcr uses: docker/build-push-action@v6 @@ -71,6 +80,10 @@ jobs: ghcr.io/theworldavatar/stack-manager:${{ env.MAJOR }} ghcr.io/theworldavatar/stack-manager:${{ env.MINOR }} + - name: Build with Maven (stack-data-uploader) + working-directory: stack-data-uploader + run: mvn clean package --update-snapshots -DskipTests + - name: Build stack data uploader docker image and push to ghcr uses: docker/build-push-action@v6 with: diff --git a/.vscode/settings.json b/.vscode/settings.json index c5f3f6b9..2080be73 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,23 @@ { - "java.configuration.updateBuildConfiguration": "interactive" + "java.configuration.updateBuildConfiguration": "interactive", + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#208ba5", + "activityBar.background": "#208ba5", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#851a70", + "activityBarBadge.foreground": "#e7e7e7", + "commandCenter.border": "#e7e7e799", + "sash.hoverBorder": "#208ba5", + "statusBar.background": "#18677a", + "statusBar.foreground": "#e7e7e7", + "statusBarItem.hoverBackground": "#208ba5", + "statusBarItem.remoteBackground": "#18677a", + "statusBarItem.remoteForeground": "#e7e7e7", + "titleBar.activeBackground": "#18677a", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveBackground": "#18677a99", + "titleBar.inactiveForeground": "#e7e7e799" + }, + "peacock.color": "#18677a" } \ No newline at end of file diff --git a/stack-clients/Dockerfile b/stack-clients/Dockerfile index 506767ef..c352a725 100644 --- a/stack-clients/Dockerfile +++ b/stack-clients/Dockerfile @@ -1,78 +1,15 @@ -# syntax=docker/dockerfile:1.4 - -# First stage: download the Java dependencies and build -#================================================================================================== -FROM maven:3.8.3-adoptopenjdk-11 AS builder - -# Use BuildKit secret for settings.xml if available, else use local credentials -# Copy in Maven settings templates and credentials for local builds - -# COPY docker/credentials /root/credentials -# COPY docker/.m2 /root/.m2 - -# If a secret settings.xml is provided, use it (for CI); otherwise, use the local one -RUN --mount=type=secret,id=maven_settings,required=false \ - if [ -f /run/secrets/maven_settings ]; then \ - cp /run/secrets/maven_settings /root/.m2/settings.xml; \ - fi - -# Populate settings templates with credentials -WORKDIR /root/.m2 -# (Note that | rather than / is used as the sed delimiter, since encrypted passwords can contain the former, but not the latter -RUN --mount=type=secret,id=maven_settings,required=false \ - if [ ! -f /root/.m2/settings.xml ]; then \ - sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml && \ - sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml; \ - fi - -# Copy in Java source and build -WORKDIR /root/code - -# Copy just the pom.xml file -COPY pom.xml ./pom.xml - -# Retrieve all of the dependencies -RUN --mount=type=cache,id=stack-mvn,target=/root/.m2/repository,sharing=locked mvn clean dependency:resolve --update-snapshots - -# Copy in the code -COPY src ./src/ - -# Ensure that the latest versions of SNAPSHOT dependencies are always used -ARG CACHEBUST=1 - -RUN --mount=type=cache,id=stack-mvn,target=/root/.m2/repository,sharing=locked mvn package --update-snapshots -DskipTests - -FROM builder AS test - -RUN --mount=type=cache,id=stack-mvn,target=/root/.m2/repository2,sharing=locked mkdir -p /root/.m2/repository && cp -r /root/.m2/repository2/* /root/.m2/repository - -ENV TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock -ENV TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal - -CMD ["mvn", "test"] - -FROM builder AS deploy - -RUN --mount=type=cache,id=stack-mvn,target=/root/.m2/repository,sharing=locked mvn deploy -DskipTests - -#================================================================================================== - # Second stage: copy the output into a clean image #================================================================================================== -FROM adoptopenjdk/openjdk11:jre-11.0.13_8 AS agent - -# Copy in the entrypoint script -COPY docker/entrypoint.sh /entrypoint.sh +FROM adoptopenjdk/openjdk11:jre-11.0.13_8 WORKDIR /app -# Copy the downloaded dependencies from the builder -COPY --from=deploy /root/code/target/*.jar /app -# Copy the downloaded dependencies from the builder -COPY --from=deploy /root/code/target/lib /app/lib +# Copy the built JAR and lib directory from the Maven build +COPY target/*.jar /app/ +COPY target/lib /app/lib -# Copy the main jar from the builder -COPY --from=builder /root/code/target/stack-clients*.jar /app +# Copy the entrypoint script +COPY docker/entrypoint.sh /entrypoint.sh # Port for Java debugging EXPOSE 5005 diff --git a/stack-data-uploader/Dockerfile b/stack-data-uploader/Dockerfile index cce3fe0f..bf9a9209 100644 --- a/stack-data-uploader/Dockerfile +++ b/stack-data-uploader/Dockerfile @@ -1,62 +1,15 @@ # syntax=docker/dockerfile:1.4 -# First stage: download the Java dependencies and build -#================================================================================================== -FROM maven:3.8.3-adoptopenjdk-11 AS builder - -# Copy in Maven settings templates and credentials for local builds -COPY docker/credentials /root/credentials -COPY docker/.m2 /root/.m2 - -# Use BuildKit secret for settings.xml if available, else use local credentials -RUN --mount=type=secret,id=maven_settings,required=false \ - if [ -f /run/secrets/maven_settings ]; then \ - cp /run/secrets/maven_settings /root/.m2/settings.xml; \ - fi - -WORKDIR /root/.m2 -RUN --mount=type=secret,id=maven_settings,required=false \ - if [ ! -f /root/.m2/settings.xml ]; then \ - sed -i "s|MASTER_PASSWORD|$(mvn --encrypt-master-password master_password)|" settings-security.xml && \ - sed -i "s|REPO_USERNAME|$(cat ../credentials/repo_username.txt)|;s|REPO_PASSWORD|$(cat ../credentials/repo_password.txt|xargs mvn --encrypt-password)|" settings.xml; \ - fi - -WORKDIR /root/code -# Copy just the pom.xml file -COPY pom.xml ./pom.xml - -# Retrieve all of the dependencies -RUN --mount=type=cache,id=stack-mvn,target=/root/.m2/repository,sharing=locked mvn clean dependency:resolve --update-snapshots - -# Copy in the code -COPY src ./src/ - -# Ensure that the latest versions of SNAPSHOT dependencies are always used -ARG CACHEBUST=1 - -RUN --mount=type=cache,id=stack-mvn,target=/root/.m2/repository,sharing=locked mvn package --update-snapshots - -FROM builder AS test - -RUN --mount=type=cache,id=stack-mvn,target=/root/.m2/repository2,sharing=locked mkdir -p /root/.m2/repository && cp -r /root/.m2/repository2/* /root/.m2/repository - -CMD ["mvn", "test"] - -#================================================================================================== - # Second stage: copy the output into a clean image #================================================================================================== -FROM adoptopenjdk/openjdk11:jre-11.0.13_8 AS agent - -# Copy in the entrypoint script -COPY docker/entrypoint.sh /entrypoint.sh +FROM adoptopenjdk/openjdk11:jre-11.0.13_8 WORKDIR /app -# Copy the downloaded dependencies from the builder -COPY --from=builder /root/code/target/lib /app/lib +COPY target/*.jar /app/ +COPY target/lib /app/lib + +COPY docker/entrypoint.sh /entrypoint.sh -# Port for Java debugging EXPOSE 5005 -# Run the entrypoint script ENTRYPOINT ["/entrypoint.sh"] diff --git a/stack-manager/Dockerfile b/stack-manager/Dockerfile index cce3fe0f..34820838 100644 --- a/stack-manager/Dockerfile +++ b/stack-manager/Dockerfile @@ -45,18 +45,15 @@ CMD ["mvn", "test"] # Second stage: copy the output into a clean image #================================================================================================== -FROM adoptopenjdk/openjdk11:jre-11.0.13_8 AS agent - -# Copy in the entrypoint script -COPY docker/entrypoint.sh /entrypoint.sh +FROM adoptopenjdk/openjdk11:jre-11.0.13_8 WORKDIR /app -# Copy the downloaded dependencies from the builder -COPY --from=builder /root/code/target/lib /app/lib +COPY target/*.jar /app/ +COPY target/lib /app/lib + +COPY docker/entrypoint.sh /entrypoint.sh -# Port for Java debugging EXPOSE 5005 -# Run the entrypoint script ENTRYPOINT ["/entrypoint.sh"] From b842a5c1ef7aa361bec3166672a4a2dc61be6295 Mon Sep 17 00:00:00 2001 From: ushcode Date: Fri, 11 Jul 2025 11:40:11 +0100 Subject: [PATCH 20/27] better jdk setup --- .github/workflows/docker-ci.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index ea27d260..89511e26 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -34,24 +34,25 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV echo "MAJOR=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_ENV echo "MINOR=$(echo $VERSION | cut -d. -f1).$(echo $VERSION | cut -d. -f2)" >> $GITHUB_ENV - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - + - name: Set up JDK 11 uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: '11' - + cache: 'maven' + - name: Build with Maven (stack-clients) working-directory: stack-clients run: mvn clean package --update-snapshots -DskipTests + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build stack clients docker image and push to ghcr uses: docker/build-push-action@v6 with: From e0e81e468a53da054fcbada88d92e3f0297bbd43 Mon Sep 17 00:00:00 2001 From: ushcode Date: Fri, 11 Jul 2025 11:41:40 +0100 Subject: [PATCH 21/27] fix permissions --- .github/workflows/docker-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 89511e26..2b276eb5 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -11,6 +11,10 @@ on: branches: - main +permissions: + contents: write + packages: write + jobs: build-and-push-image: runs-on: ubuntu-latest From 5198ecd4e18f71ce76e751c80a008b1d5d52fff8 Mon Sep 17 00:00:00 2001 From: ushcode Date: Fri, 11 Jul 2025 12:09:51 +0100 Subject: [PATCH 22/27] switch from adopt to temurin --- .github/workflows/docker-ci.yml | 2 +- stack-clients/Dockerfile | 3 +-- stack-data-uploader/Dockerfile | 3 +-- stack-manager/Dockerfile | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 2b276eb5..24354037 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -42,7 +42,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v4 with: - distribution: 'adopt' + distribution: temurin java-version: '11' cache: 'maven' diff --git a/stack-clients/Dockerfile b/stack-clients/Dockerfile index c352a725..b722e7ea 100644 --- a/stack-clients/Dockerfile +++ b/stack-clients/Dockerfile @@ -1,7 +1,6 @@ # Second stage: copy the output into a clean image #================================================================================================== -FROM adoptopenjdk/openjdk11:jre-11.0.13_8 - +FROM eclipse-temurin:11-jre WORKDIR /app # Copy the built JAR and lib directory from the Maven build diff --git a/stack-data-uploader/Dockerfile b/stack-data-uploader/Dockerfile index bf9a9209..43153073 100644 --- a/stack-data-uploader/Dockerfile +++ b/stack-data-uploader/Dockerfile @@ -1,8 +1,7 @@ # syntax=docker/dockerfile:1.4 # Second stage: copy the output into a clean image #================================================================================================== -FROM adoptopenjdk/openjdk11:jre-11.0.13_8 - +FROM eclipse-temurin:11-jre WORKDIR /app COPY target/*.jar /app/ diff --git a/stack-manager/Dockerfile b/stack-manager/Dockerfile index 34820838..53c69e2f 100644 --- a/stack-manager/Dockerfile +++ b/stack-manager/Dockerfile @@ -45,8 +45,7 @@ CMD ["mvn", "test"] # Second stage: copy the output into a clean image #================================================================================================== -FROM adoptopenjdk/openjdk11:jre-11.0.13_8 - +FROM eclipse-temurin:11-jre WORKDIR /app COPY target/*.jar /app/ From eeb924f58ce74914c14a69156b13753624f74211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ois=C3=ADn?= Date: Mon, 14 Jul 2025 11:56:55 +0100 Subject: [PATCH 23/27] try setup maven-settings --- .github/workflows/docker-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 24354037..5a7f4e29 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -26,6 +26,8 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - uses: s4u/maven-settings-action@v3.1.0 + - name: Set version variables from file id: read-version run: | From d2bd329af3808aa0dc139a83c09cc063046c01a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ois=C3=ADn?= Date: Mon, 14 Jul 2025 18:08:08 +0100 Subject: [PATCH 24/27] use a PAT saved to org secrets --- .github/workflows/docker-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index 5a7f4e29..15bc4137 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -27,6 +27,13 @@ jobs: uses: actions/checkout@v4 - uses: s4u/maven-settings-action@v3.1.0 + with: + servers: | + [{ + "id": "github", + "username": "${{ github.actor }}", + "password": "${{ secrets.GHCR_PAT }}" + }] - name: Set version variables from file id: read-version From 8d6113ba975811fcb619911e0a308c5c88a4fc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ois=C3=ADn?= Date: Mon, 14 Jul 2025 18:10:20 +0100 Subject: [PATCH 25/27] rm star in * --- stack-clients/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index b2e4f8a0..671986d6 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -35,7 +35,7 @@ github The World Avatar Maven Repository - https://maven.pkg.github.com/TheWorldAvatar/* + https://maven.pkg.github.com/TheWorldAvatar/ From db03b2fdcd976e6756edc5d7cd528395b947b89c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ois=C3=ADn?= Date: Mon, 14 Jul 2025 18:27:28 +0100 Subject: [PATCH 26/27] restore * --- stack-clients/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index 671986d6..bf7a6c25 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -35,7 +35,7 @@ github The World Avatar Maven Repository - https://maven.pkg.github.com/TheWorldAvatar/ + https://maven.pkg.github.com/TheWorldAvatar/*/ From 268b3b2052ca8540bc5ac754bc35d60fea747ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ois=C3=ADn?= Date: Mon, 14 Jul 2025 18:29:21 +0100 Subject: [PATCH 27/27] no / --- stack-clients/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-clients/pom.xml b/stack-clients/pom.xml index bf7a6c25..b2e4f8a0 100644 --- a/stack-clients/pom.xml +++ b/stack-clients/pom.xml @@ -35,7 +35,7 @@ github The World Avatar Maven Repository - https://maven.pkg.github.com/TheWorldAvatar/*/ + https://maven.pkg.github.com/TheWorldAvatar/*