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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/build_deploy_edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .mvn/codeartifact.env
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ 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,

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'
<!-- ~/.m2/settings.xml -->
<settings>
<servers>
<server>
<id>codeartifact</id>
<username>aws</username>
<password>${env.CODEARTIFACT_AUTH_TOKEN}</password>
</server>
</servers>
</settings>

EOF
```


# Sort
Expand Down
40 changes: 40 additions & 0 deletions mvnw-ca
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/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

# 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

exec mvn "$@"
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<id>repo.osgeo.org</id>
<url>https://repo.osgeo.org/repository/release/</url>
</repository>
<repository>
<id>codeartifact</id>
<url>${env.CODEARTIFACT_REPO_URL}</url>
</repository>
</repositories>
<modules>
<module>common</module>
Expand Down Expand Up @@ -175,6 +179,11 @@
<artifactId>log4j-layout-template-json</artifactId>
<version>2.24.3</version> <!-- Check for the latest version -->
</dependency>
<dependency>
<groupId>au.org.aodn</groupId>
<artifactId>stacmodel</artifactId>
<version>0.0.52</version>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
Expand Down
4 changes: 4 additions & 0 deletions server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
</dependency>
<dependency>
<groupId>au.org.aodn</groupId>
<artifactId>stacmodel</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,4 +15,9 @@ public class ThemeModel {
protected String scheme;
protected List<ConceptModel> 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();
}

}
Loading