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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# Checks out this repository and sets up the build/test environment with
# gradle
- name: Checkout project sources
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

Expand Down Expand Up @@ -215,12 +215,17 @@ jobs:
# NOTE: This step is platform-specific
# These are gradle-specific steps for installing the application
- name: Build Software
env:
VERSION: ${{ env.the_version }}
run: |
rm -rf dist
./gradlew --scan buildArtifact
./gradlew shadowJar
mv build/libs/*.jar build/libs/footprint_${VERSION}.jar
ls -al
ls -al dist/
ls -al docker/
ls -al build/libs
ls -al terraform/
ls -al terraform_deploy/

Expand Down Expand Up @@ -298,7 +303,7 @@ jobs:
uses: ncipollo/release-action@v1.12.0
with:
tag: ${{ env.the_version }}
artifacts: "dist/*.zip"
artifacts: "dist/*.zip, build/libs/*.jar"
token: ${{ secrets.GITHUB_TOKEN }}
body: "Version ${{ env.the_version }}"
makeLatest: "${{ github.ref == 'refs/heads/main' }}"
Expand All @@ -309,7 +314,7 @@ jobs:
#########################################################################
# Setup docker to build and push images
- name: Log in to the Container registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -328,7 +333,6 @@ jobs:
echo "THE_ENV=${override_env}" >> $GITHUB_ENV
echo "TARGET_ENV_UPPERCASE=${override_env_upper}" >> $GITHUB_ENV


- name: Lower Case Target Env
run: |
original_env_value="${TARGET_ENV_UPPERCASE}"
Expand Down Expand Up @@ -407,6 +411,24 @@ jobs:
create_repo: true
dockerfile: ./docker/Dockerfile

- name: Upload Docker image to SWOT Cumulus ECR
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release') ||
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
uses: vitr/actions-build-and-upload-to-ecs@master
with:
access_key_id: ${{ secrets[format('AWS_ACCESS_KEY_ID_CUMULUS_SWOT_{0}', env.TARGET_ENV_UPPERCASE)] }}
secret_access_key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_CUMULUS_SWOT_{0}', env.TARGET_ENV_UPPERCASE)] }}
account_id: ${{ secrets[format('AWS_ACCOUNT_ID_CUMULUS_SWOT_{0}', env.TARGET_ENV_UPPERCASE)] }}
repo: podaac/forge
region: us-west-2
tags: ${{ env.the_version }}
create_repo: true
dockerfile: ./docker/Dockerfile

#########################################################################
# Deploy to AWS via Terraform
Expand Down Expand Up @@ -444,6 +466,6 @@ jobs:
cat override.tf.json
echo "End show override contents"
terraform --version
source bin/config.sh ${{ env.venue }}
terraform plan -var-file=tfvars/"${{ env.venue }}".tfvars -var="app_version=${{ env.the_version }}" -out="tfplan"
source bin/config.sh ${{ env.TARGET_ENV_LOWERCASE }}
terraform plan -var-file=tfvars/"${{ env.TARGET_ENV_LOWERCASE }}".tfvars -var="app_version=${{ env.the_version }}" -out="tfplan"
terraform apply -auto-approve tfplan
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- **JAVA 11**
- Update forge to java 11
- **Forge CLI**
- Added a cli command to run forge with jar file
- **Github actions update**
- Update various github actions commands
- **Forge Update**
- Updated java libraries with security holes, and update libraries for cumulus 16
### Changed
### Deprecated
### Removed
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ Then, to build the project simply run:
./gradlew buildZip
```

Build local jar to run footprint
```shell script
./gradlew shadowJar
```

You need java 11 to run the jar locally
```
java -cp build/libs/footprint.jar FootprintCLI <granule> <collection config>
```

example:
```
java -cp build/libs/footprint.jar FootprintCLI test.nc test.cfg
```


```shell script
Expand Down
52 changes: 14 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
buildscript {
repositories {
//ivy {
// url 'https://cae-artifactory.jpl.nasa.gov/artifactory/plugins-release'
//}
maven {
url "https://plugins.gradle.org/m2/"
}
Expand All @@ -17,7 +14,7 @@ buildscript {
plugins {
id 'java'
id 'jacoco'
id "com.github.johnrengelman.shadow" version "6.1.0"
id "com.github.johnrengelman.shadow" version "7.0.0"
}

allprojects {
Expand All @@ -28,17 +25,14 @@ allprojects {

repositories {
maven { url 'https://repo.osgeo.org/repository/release/' }
//maven { url 'https://cae-artifactory.jpl.nasa.gov/artifactory/maven-libs-release-local' }
//maven { url 'https://cae-artifactory.jpl.nasa.gov/artifactory/apache-maven-remote' }
//maven { url 'https://cae-artifactory.jpl.nasa.gov/artifactory/clojars-remote' }
maven { url 'https://clojars.org/repo/'}
maven { url "https://jitpack.io" }
mavenCentral()
}

group = 'gov.nasa.podaac'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 1.11
targetCompatibility = 1.11

configurations {
developmentOnly
Expand All @@ -48,44 +42,26 @@ configurations {
}
}

/*
artifactory {
contextUrl = "https://cae-artifactory.jpl.nasa.gov/artifactory"
//The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local'
maven = false
ivy {
ivyLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).pom'
artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]'
mavenCompatible = true
}
}
}
}*/

dependencies {
compile group: 'com.vividsolutions', name: 'jts', version: '1.13'
compile group: 'gov.nasa.earthdata', name: 'cumulus-message-adapter', version: '1.3.9'
compile group: 'gov.nasa.earthdata', name: 'cumulus-message-adapter', version: '2.0.0'
//implementation group: 'gov.nasa.earthdata', name: 'cumulus-message-adapter', version: '1.3.9'


compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.12.393'
compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.12.574'
compile group: 'com.amazonaws', name: 'aws-lambda-java-core', version: '1.2.1'
compile group: 'com.amazonaws', name: 'aws-java-sdk-stepfunctions', version: '1.12.363'

compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
compile group: 'com.google.code.gson', name: 'gson', version: '2.9.0'

compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
compile group: 'org.json', name: 'json', version: '20220924'
compile group: 'org.json', name: 'json', version: '20231013'

compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
compile group: 'commons-io', name: 'commons-io', version: '2.8.0'
compile group: 'edu.ucar', name: 'cdm', version: '4.6.20'

compile group: 'org.geotools', name: 'gt-shapefile', version: '28.0'
compile group: 'org.geotools', name: 'gt-shapefile', version: '29.2'
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'

compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.17.2'
Expand All @@ -100,7 +76,7 @@ dependencies {
testImplementation 'org.openjdk.jmh:jmh-core:1.26'
testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.26'

antJUnit 'org.apache.ant:ant-junit:1.10.10'
antJUnit 'org.apache.ant:ant-junit:1.10.11'
compile group: "com.github.everit-org.json-schema", name: "org.everit.json.schema", version: "1.14.1"
compile group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'

Expand Down Expand Up @@ -327,14 +303,14 @@ task setCurrentVersion(){

// Output to build/libs/shadow.jar
shadowJar {
archiveBaseName.set('shadow')
archiveClassifier.set('')
archiveVersion.set('')
}
archiveBaseName.set('footprint')
archiveClassifier.set('')
archiveVersion.set('')
mergeServiceFiles()

jar {
manifest {
attributes 'Main-Class': 'ActivityHandler'
attributes 'Multi-Release': 'true',
'Main-Class': 'ActivityHandler'
}
}

Expand Down
26 changes: 19 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
FROM openjdk:8-jdk-alpine
FROM amazoncorretto:11

RUN apk add gradle
RUN apk add python3==3.6.9-r3
RUN yum -y update
RUN yum install -y wget
RUN yum install -y unzip
RUN yum install -y /usr/sbin/adduser

#RUN adduser dockeruser --disabled-password

RUN addgroup -S dockergroup && adduser -S dockeruser -G dockergroup
RUN groupadd dockergroup
RUN useradd -m -g dockergroup dockeruser

WORKDIR /home/dockeruser
COPY . /home/dockeruser

# Download and install Gradle
RUN wget https://services.gradle.org/distributions/gradle-6.3-bin.zip && \
unzip gradle-6.3-bin.zip && \
rm gradle-6.3-bin.zip

# Add Gradle binaries to the PATH
ENV PATH="/home/dockeruser/gradle-6.3/bin:${PATH}"

# Display Gradle version to verify the installation
RUN gradle --version

RUN chown dockeruser:dockergroup -R /home/dockeruser

USER dockeruser

RUN ./gradlew shadowJar

RUN wget https://github.com/nasa/cumulus-message-adapter/releases/download/v2.0.2/cumulus-message-adapter.zip
RUN wget https://github.com/nasa/cumulus-message-adapter/releases/download/v2.0.3/cumulus-message-adapter.zip
RUN mkdir cumulus-message-adapter
RUN unzip -d cumulus-message-adapter cumulus-message-adapter.zip

Expand Down
34 changes: 34 additions & 0 deletions src/main/java/gov/nasa/podaac/forge/FootprintCLI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import gov.nasa.podaac.forge.Footprinter;
import java.util.Map;

/**
* A simple command-line interface for the Footprinter class.
*/
class FootprintCLI {

public FootprintCLI() {
// Constructor, if needed
}

public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Usage: java FootprintCLI <granuleFile> <configFile>");
System.exit(1);
}

String granuleFile = args[0];
String configFile = args[1];

try {
System.out.println("Processing File");
Footprinter footprinter = new Footprinter(granuleFile, configFile);
Map<String, String> fp = footprinter.footprint();
System.out.println("Process retrieved footprint");
System.out.println(fp.get("FOOTPRINT"));
} catch (Exception e) {
System.err.println("Error processing: " + granuleFile);
// Log the exception or handle it appropriately
e.printStackTrace(System.err);
}
}
}
2 changes: 1 addition & 1 deletion terraform/forge.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "forge_task" {
source_code_hash = filebase64sha256("${path.module}/forge-lambda.zip")
handler = "gov.nasa.podaac.forge.FootprintHandler::handleRequestStreams"
role = var.lambda_role
runtime = "java8"
runtime = "java11"
timeout = var.timeout
memory_size = var.memory_size

Expand Down
2 changes: 1 addition & 1 deletion terraform/forge_fargate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module "forge_fargate" {
command = [
"java",
"-jar",
"/home/dockeruser/build/libs/shadow.jar",
"/home/dockeruser/build/libs/footprint.jar",
aws_sfn_activity.forge_ecs_task.id
]

Expand Down
2 changes: 1 addition & 1 deletion terraform_deploy/variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "profile" {

variable "cma_version" {
type = string
default = "v1.3.0"
default = "v2.0.3"
}

variable "app_name" {
Expand Down
Loading