From 4ff72a3353a776977c80b099043fd4c056c838da Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Wed, 25 Feb 2026 11:35:39 +1100 Subject: [PATCH 01/12] setting script in readme --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/README.md b/README.md index 79f2aec4..e1bde3a9 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,43 @@ The server module contains the implementation of those interfaces, for details p |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | score | The min score value of the return record, the higher the value, the more relevance it will be. By default the score isn't set, it is Elastic Search field not STAC field | +# Use AWS CodeArtifact +We are using AWS CodeArtifact to get stacmodel dependency deployed by es-indexer. +Since AWS CodeArtifact is private repository, and AWS CodeArtifact doesn't support direct mvn login, +you need to do some extra configuration to get the dependency. + +1. Add settings.xml. Please run the following command (One-time configuration, you can skip this step if you already have settings.xml in your .m2 folder, but make sure the content is correct): +```bash +cd ~/.m2 +cat > settings.xml << 'EOF' + + + + + codeartifact + aws + ${env.CODEARTIFACT_AUTH_TOKEN} + + + + + + use-codeartifact + + + codeartifact + https://-.d.codeartifact..amazonaws.com/maven// + + + + + + use-codeartifact + + + +EOF +``` # Sort From 5f6d2f513d2b9c38c1c500c186b35827ec92b8ca Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Wed, 25 Feb 2026 11:55:34 +1100 Subject: [PATCH 02/12] script for getting codeartifact token --- mvnw-artifact | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 mvnw-artifact diff --git a/mvnw-artifact b/mvnw-artifact new file mode 100755 index 00000000..e0fdca2c --- /dev/null +++ b/mvnw-artifact @@ -0,0 +1,22 @@ +#!/usr/bin/env sh +# mvnw-artifact: fetch AWS CodeArtifact token, then delegate to ./mvnw + +[ -f ".mvn/codeartifact.env" ] && . ".mvn/codeartifact.env" + +if [ -z "${CODEARTIFACT_AUTH_TOKEN:-}" ]; then + if command -v aws >/dev/null 2>&1 && + [ -n "${CA_DOMAIN:-}" ] && [ -n "${CA_DOMAIN_OWNER:-}" ] && [ -n "${CA_REGION:-}" ]; then + CA_DURATION_SECONDS="${CA_DURATION_SECONDS:-43200}" + CODEARTIFACT_AUTH_TOKEN="$( + aws codeartifact get-authorization-token \ + --domain "$CA_DOMAIN" \ + --domain-owner "$CA_DOMAIN_OWNER" \ + --region "$CA_REGION" \ + --duration-seconds "$CA_DURATION_SECONDS" \ + --query authorizationToken --output text 2>/dev/null || true + )" + export CODEARTIFACT_AUTH_TOKEN + fi +fi + +exec "$(dirname "$0")/mvnw" "$@" \ No newline at end of file From 27057556ce733ae38f9b913b4e6ed8a2d4ab4b49 Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Wed, 25 Feb 2026 14:39:31 +1100 Subject: [PATCH 03/12] add wrapper properties --- .mvn/wrapper/maven-wrapper.properties | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .mvn/wrapper/maven-wrapper.properties diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..7d479520 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip From ebea8427e33ee677300f9bca94da1b8c4901ed83 Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Wed, 25 Feb 2026 14:40:27 +1100 Subject: [PATCH 04/12] add step to get repo url --- mvnw-artifact | 22 ---------------------- mvnw-ca | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 22 deletions(-) delete mode 100755 mvnw-artifact create mode 100755 mvnw-ca diff --git a/mvnw-artifact b/mvnw-artifact deleted file mode 100755 index e0fdca2c..00000000 --- a/mvnw-artifact +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env sh -# mvnw-artifact: fetch AWS CodeArtifact token, then delegate to ./mvnw - -[ -f ".mvn/codeartifact.env" ] && . ".mvn/codeartifact.env" - -if [ -z "${CODEARTIFACT_AUTH_TOKEN:-}" ]; then - if command -v aws >/dev/null 2>&1 && - [ -n "${CA_DOMAIN:-}" ] && [ -n "${CA_DOMAIN_OWNER:-}" ] && [ -n "${CA_REGION:-}" ]; then - CA_DURATION_SECONDS="${CA_DURATION_SECONDS:-43200}" - CODEARTIFACT_AUTH_TOKEN="$( - aws codeartifact get-authorization-token \ - --domain "$CA_DOMAIN" \ - --domain-owner "$CA_DOMAIN_OWNER" \ - --region "$CA_REGION" \ - --duration-seconds "$CA_DURATION_SECONDS" \ - --query authorizationToken --output text 2>/dev/null || true - )" - export CODEARTIFACT_AUTH_TOKEN - fi -fi - -exec "$(dirname "$0")/mvnw" "$@" \ No newline at end of file diff --git a/mvnw-ca b/mvnw-ca new file mode 100755 index 00000000..ce874ab2 --- /dev/null +++ b/mvnw-ca @@ -0,0 +1,50 @@ +#!/usr/bin/env sh +# mvnw-ca: fetch AWS CodeArtifact token and repo URL + +[ -f ".mvn/codeartifact.env" ] && . ".mvn/codeartifact.env" + +if command -v aws >/dev/null 2>&1 && + [ -n "${CA_DOMAIN:-}" ] && [ -n "${CA_DOMAIN_OWNER:-}" ] && [ -n "${CA_REGION:-}" ]; then + + # Get auth token if not set + if [ -z "${CODEARTIFACT_AUTH_TOKEN:-}" ]; then + CA_DURATION_SECONDS="${CA_DURATION_SECONDS:-43200}" + CODEARTIFACT_AUTH_TOKEN="$( + aws codeartifact get-authorization-token \ + --domain "$CA_DOMAIN" \ + --domain-owner "$CA_DOMAIN_OWNER" \ + --region "$CA_REGION" \ + --duration-seconds "$CA_DURATION_SECONDS" \ + --query authorizationToken --output text 2>/dev/null || true + )" + export CODEARTIFACT_AUTH_TOKEN + fi + + echo "DEBUG: CODEARTIFACT_AUTH_TOKEN=${CODEARTIFACT_AUTH_TOKEN}" + echo "DEBUG: CA_REPOSITORY=${CA_REPOSITORY:-[NOT SET]}" + # Get repository URL if not set + if [ -z "${CODEARTIFACT_REPO_URL:-}" ] && [ -n "${CA_REPOSITORY:-}" ]; then + CODEARTIFACT_REPO_URL="$( + aws codeartifact get-repository-endpoint \ + --domain "$CA_DOMAIN" \ + --domain-owner "$CA_DOMAIN_OWNER" \ + --repository "$CA_REPOSITORY" \ + --region "$CA_REGION" \ + --format maven \ + --query repositoryEndpoint --output text 2>/dev/null || true + )" + export CODEARTIFACT_REPO_URL + else + echo + fi +fi + +# Only generate wrapper if files are missing +if [ ! -f ".mvn/wrapper/maven-wrapper.properties" ]; then + echo "Maven wrapper files not found, generating with 'mvn wrapper:wrapper'..." + mvn wrapper:wrapper -q +fi + +echo "DEBUG: CODEARTIFACT_REPO_URL=$CODEARTIFACT_REPO_URL" + +exec mvn "$@" \ No newline at end of file From 076d884828046af26c1c7f075c69adead26270e8 Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Wed, 25 Feb 2026 14:41:07 +1100 Subject: [PATCH 05/12] add dependency stacmodel from codeartifact --- pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pom.xml b/pom.xml index 2eb0c234..e0d09992 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,10 @@ repo.osgeo.org https://repo.osgeo.org/repository/release/ + + codeartifact + ${env.CODEARTIFACT_REPO_URL} + common @@ -175,6 +179,11 @@ log4j-layout-template-json 2.24.3 + + au.org.aodn + stacmodel + 0.0.54 + From 155a7db7cfa13c6e5791b139e057fba05d724667 Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Wed, 25 Feb 2026 14:41:43 +1100 Subject: [PATCH 06/12] use codeartifact.env to manage envs easily --- .mvn/codeartifact.env | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .mvn/codeartifact.env diff --git a/.mvn/codeartifact.env b/.mvn/codeartifact.env new file mode 100644 index 00000000..a53b2773 --- /dev/null +++ b/.mvn/codeartifact.env @@ -0,0 +1,5 @@ +CA_DOMAIN=central-aodn-org-au +CA_DOMAIN_OWNER=851725428481 +CA_REGION=ap-southeast-2 +CA_DURATION_SECONDS=43200 +CA_REPOSITORY=maven-aodn-store From 808701e639d30304082b06b215388883b7c42fa1 Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Thu, 26 Feb 2026 15:37:21 +1100 Subject: [PATCH 07/12] add existing version --- pom.xml | 2 +- server/pom.xml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e0d09992..b4f27c51 100644 --- a/pom.xml +++ b/pom.xml @@ -182,7 +182,7 @@ au.org.aodn stacmodel - 0.0.54 + 0.0.52 diff --git a/server/pom.xml b/server/pom.xml index 2237b46b..10294ba7 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -187,6 +187,10 @@ org.apache.logging.log4j log4j-layout-template-json + + au.org.aodn + stacmodel + org.springframework.boot spring-boot-starter-test From 1ae1e732e986ffd1fa3164fae5191a52ccb0e1ef Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Thu, 26 Feb 2026 15:44:31 +1100 Subject: [PATCH 08/12] add a reference to make sure the stac model is working --- .../au/org/aodn/ogcapi/server/core/model/ThemeModel.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/ThemeModel.java b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/ThemeModel.java index 1a2adbcf..9b22ff1e 100644 --- a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/ThemeModel.java +++ b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/ThemeModel.java @@ -1,10 +1,10 @@ package au.org.aodn.ogcapi.server.core.model; +import au.org.aodn.stac.model.Citation; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; - import java.util.List; @Data @@ -15,4 +15,9 @@ public class ThemeModel { protected String scheme; protected List concepts; + // This is just a test to make sure the stac model can be used in this module, we can remove it when all the stac models are using the stacmodel from es-indexer + private void testStacmodelReference() { + Citation citation = Citation.builder().build(); + } + } From d4cdac3b516162f01ed9306ef4e7f4cd3b1bce12 Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Thu, 26 Feb 2026 15:49:57 +1100 Subject: [PATCH 09/12] cleanup --- README.md | 15 --------------- mvnw-ca | 12 +----------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/README.md b/README.md index e1bde3a9..b114c2e6 100644 --- a/README.md +++ b/README.md @@ -72,21 +72,6 @@ cat > settings.xml << 'EOF' ${env.CODEARTIFACT_AUTH_TOKEN} - - - - use-codeartifact - - - codeartifact - https://-.d.codeartifact..amazonaws.com/maven// - - - - - - use-codeartifact - EOF diff --git a/mvnw-ca b/mvnw-ca index ce874ab2..aa3be595 100755 --- a/mvnw-ca +++ b/mvnw-ca @@ -20,8 +20,6 @@ if command -v aws >/dev/null 2>&1 && export CODEARTIFACT_AUTH_TOKEN fi - echo "DEBUG: CODEARTIFACT_AUTH_TOKEN=${CODEARTIFACT_AUTH_TOKEN}" - echo "DEBUG: CA_REPOSITORY=${CA_REPOSITORY:-[NOT SET]}" # Get repository URL if not set if [ -z "${CODEARTIFACT_REPO_URL:-}" ] && [ -n "${CA_REPOSITORY:-}" ]; then CODEARTIFACT_REPO_URL="$( @@ -39,12 +37,4 @@ if command -v aws >/dev/null 2>&1 && fi fi -# Only generate wrapper if files are missing -if [ ! -f ".mvn/wrapper/maven-wrapper.properties" ]; then - echo "Maven wrapper files not found, generating with 'mvn wrapper:wrapper'..." - mvn wrapper:wrapper -q -fi - -echo "DEBUG: CODEARTIFACT_REPO_URL=$CODEARTIFACT_REPO_URL" - -exec mvn "$@" \ No newline at end of file +exec mvn "$@" From 7f3519bd69951e5ab607459238d75fea79f45aa1 Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Thu, 26 Feb 2026 16:10:43 +1100 Subject: [PATCH 10/12] update readme --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b114c2e6..a2e3d741 100644 --- a/README.md +++ b/README.md @@ -56,10 +56,13 @@ The server module contains the implementation of those interfaces, for details p # Use AWS CodeArtifact We are using AWS CodeArtifact to get stacmodel dependency deployed by es-indexer. + Since AWS CodeArtifact is private repository, and AWS CodeArtifact doesn't support direct mvn login, -you need to do some extra configuration to get the dependency. -1. Add settings.xml. Please run the following command (One-time configuration, you can skip this step if you already have settings.xml in your .m2 folder, but make sure the content is correct): +So, please use:`./mvnw-ca install` to instead`mvn install` for dependency installation at root of the project. + +Before running `./mvnw-ca install`, please make sure you have settings.xml in your ~/.m2 folder. +If not, run the following command: ```bash cd ~/.m2 cat > settings.xml << 'EOF' From 2230890cab05c562427203eeb6f18ecadf3f24da Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Thu, 26 Feb 2026 16:19:15 +1100 Subject: [PATCH 11/12] pre commit fixing --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a2e3d741..f4ffd3b1 100644 --- a/README.md +++ b/README.md @@ -55,13 +55,13 @@ The server module contains the implementation of those interfaces, for details p | score | The min score value of the return record, the higher the value, the more relevance it will be. By default the score isn't set, it is Elastic Search field not STAC field | # Use AWS CodeArtifact -We are using AWS CodeArtifact to get stacmodel dependency deployed by es-indexer. +We are using AWS CodeArtifact to get stacmodel dependency deployed by es-indexer. Since AWS CodeArtifact is private repository, and AWS CodeArtifact doesn't support direct mvn login, -So, please use:`./mvnw-ca install` to instead`mvn install` for dependency installation at root of the project. +So, please use:`./mvnw-ca install` to instead`mvn install` for dependency installation at root of the project. -Before running `./mvnw-ca install`, please make sure you have settings.xml in your ~/.m2 folder. +Before running `./mvnw-ca install`, please make sure you have settings.xml in your ~/.m2 folder. If not, run the following command: ```bash cd ~/.m2 From 57b8fe8e9e1e168c5db8d7357ad7e7cf0465293a Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Thu, 26 Feb 2026 16:26:38 +1100 Subject: [PATCH 12/12] config get codeartifact token in cicd --- .github/workflows/build_deploy_edge.yml | 20 +++++++++++++++++ .github/workflows/test.yml | 30 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/.github/workflows/build_deploy_edge.yml b/.github/workflows/build_deploy_edge.yml index 1681d91a..0d6a5d22 100644 --- a/.github/workflows/build_deploy_edge.yml +++ b/.github/workflows/build_deploy_edge.yml @@ -45,6 +45,26 @@ jobs: aws-region: ${{ vars.AWS_REGION }} role-to-assume: ${{ vars.AWS_ROLE_ARN }} + - name: Get CodeArtifact Repository Authentication Token + run: | + TOKEN=$(aws codeartifact get-authorization-token \ + --domain ${{ vars.CODEARTIFACT_DOMAIN }} \ + --domain-owner ${{ steps.aws_auth.outputs.aws-account-id }} \ + --region ${{ vars.AWS_REGION }} \ + --query authorizationToken \ + --output text) + echo "CODEARTIFACT_AUTH_TOKEN=$TOKEN" >> "$GITHUB_ENV" + + - name: Get CodeArtifact Repository URL + run: | + REPO_URL=$(aws codeartifact get-repository-endpoint \ + --domain ${{ vars.CODEARTIFACT_DOMAIN }} \ + --repository ${{ vars.CODEARTIFACT_REPO }} \ + --format maven \ + --region ${{ vars.AWS_REGION }} \ + --output text) + echo "CODEARTIFACT_REPO_URL=$REPO_URL" >> "$GITHUB_ENV" + - name: Build with Maven run: mvn -B verify --file pom.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 510aa52f..2c6f9c38 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,6 +40,36 @@ jobs: distribution: 'temurin' java-version: '17' cache: 'maven' + server-id: 'codeartifact' + server-password: 'CODEARTIFACT_AUTH_TOKEN' + + - name: Configure AWS Credentials + id: aws_auth + uses: aws-actions/configure-aws-credentials@v4 + with: + audience: sts.amazonaws.com + aws-region: ${{ vars.AWS_REGION }} + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + + - name: Get CodeArtifact Repository Authentication Token + run: | + TOKEN=$(aws codeartifact get-authorization-token \ + --domain ${{ vars.CODEARTIFACT_DOMAIN }} \ + --domain-owner ${{ steps.aws_auth.outputs.aws-account-id }} \ + --region ${{ vars.AWS_REGION }} \ + --query authorizationToken \ + --output text) + echo "CODEARTIFACT_AUTH_TOKEN=$TOKEN" >> "$GITHUB_ENV" + + - name: Get CodeArtifact Repository URL + run: | + REPO_URL=$(aws codeartifact get-repository-endpoint \ + --domain ${{ vars.CODEARTIFACT_DOMAIN }} \ + --repository ${{ vars.CODEARTIFACT_REPO }} \ + --format maven \ + --region ${{ vars.AWS_REGION }} \ + --output text) + echo "CODEARTIFACT_REPO_URL=$REPO_URL" >> "$GITHUB_ENV" - name: Build with Maven run: mvn clean -B verify --file pom.xml