Skip to content

Commit

Permalink
Release 0.10.0 (#31)
Browse files Browse the repository at this point in the history
* renames ops tfvars

* /version 0.7.5-alpha.3

* /version 0.8.0-alpha.1

* add release workflow (#10)

* add release workflow

* update version artifact

* /version 0.8.0-alpha.2

* test artifacts

* test

* testing deploy artifacts

* /version 0.8.0-alpha.3

* update artifact and docker latest

* update env for docker tags

* update latest artifact tags

* /version 0.8.0-alpha.4

* add lowercase

* /version 0.8.0-alpha.5

* update latest docker tag (#17)

* /version 0.8.0-alpha.6

* Feature/deploy image cumulus (#18)

* update latest docker tag

* /version 0.8.0-alpha.3

* /version 0.8.0-alpha.4

* /version 0.8.0-alpha.5

* /version 0.8.0-alpha.6

* update github actions metadata actions

---------

Co-authored-by: sliu008 <[email protected]>
Co-authored-by: jamesfwood <[email protected]>

* /version 0.8.0-alpha.7

* /version

* Feature/deploy image cumulus (#20)

* update latest docker tag

* /version 0.8.0-alpha.3

* /version 0.8.0-alpha.4

* /version 0.8.0-alpha.5

* /version 0.8.0-alpha.6

* update github actions metadata actions

* add prerelease tags

---------

Co-authored-by: sliu008 <[email protected]>
Co-authored-by: jamesfwood <[email protected]>

* /version -alpha.1

* fix version

* /version -0.8.0-alpha.8

* fix version

* /version 0.8.0-alpha.8

* /version 0.8.0-alpha.9

* updated version

* /version 0.9.0-alpha.1

* deploy

* /version 0.9.0-alpha.2

* /version 0.9.0-alpha.3

* Feature/java11 (#24)

* test java 11 build

* add deploy images to swot cumulus and update readme

* update checkout actions

* update docker login action version

* update changelog

---------

Co-authored-by: James Wood <[email protected]>

* /version 0.9.0-alpha.4

* /version 0.9.0-alpha.5

* /version

* /version 0.10.0-alpha.1

* Feature/module image upload (#30)

* write the footprint to a file in the footprint cli

* change footprint cli output file extention name

* add check for changelog.md

* cleanup

* try again

* try again

* again

* clean out old items in changelog

* update changelog

* update changelog github actions check

* update workflow

* update workflow

* update workflow

* update workflow

* update workflow

* last try

* remove changelog check

---------

Co-authored-by: James Wood <[email protected]>

* /version 0.10.0-alpha.2

* release 0.10.0

* /version 0.10.0-rc.1

* revert back

* /version 0.10.0-rc.2

---------

Co-authored-by: Simon Liu <[email protected]>
Co-authored-by: sliu008 <[email protected]>
Co-authored-by: jamesfwood <[email protected]>
Co-authored-by: sliu008 <[email protected]>
Co-authored-by: podaac-forge bot <[email protected]>
Co-authored-by: cqbanh <[email protected]>
Co-authored-by: James Wood <[email protected]>
  • Loading branch information
8 people authored Feb 22, 2024
1 parent 532f591 commit f4293eb
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 62 deletions.
58 changes: 1 addition & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,62 +374,6 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Upload Docker image to Service 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'
uses: vitr/actions-build-and-upload-to-ecs@master
with:
access_key_id: ${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
secret_access_key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
account_id: ${{ secrets[format('AWS_ACCOUNT_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
repo: podaac/forge
region: us-west-2
tags: ${{ env.the_version }}
create_repo: true
dockerfile: ./docker/Dockerfile

- name: Upload Docker image to 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_{0}', env.TARGET_ENV_UPPERCASE)] }}
secret_access_key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_CUMULUS_{0}', env.TARGET_ENV_UPPERCASE)] }}
account_id: ${{ secrets[format('AWS_ACCOUNT_ID_CUMULUS_{0}', env.TARGET_ENV_UPPERCASE)] }}
repo: podaac/forge
region: us-west-2
tags: ${{ env.the_version }}
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 @@ -460,7 +404,7 @@ jobs:
ls -al bin/
which python3
python3 --version
python3 override.py https://github.com/podaac/forge/releases/download/${{ env.the_version }}/forge-${{ env.the_version }}.zip ${{ secrets[format('AWS_ACCOUNT_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}.dkr.ecr.us-west-2.amazonaws.com/podaac/forge:${{ env.the_version }}
python3 override.py https://github.com/podaac/forge/releases/download/${{ env.the_version }}/forge-${{ env.the_version }}.zip "ghcr.io/podaac/forge:${{ env.DOCKER_METADATA_OUTPUT_VERSION }}"
ls -al
echo "Show override contents"
cat override.tf.json
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security


## [0.10.0]

### Added
- **Terraform Upload Image**
- Added terraform code to upload ecr docker images
- **Add Forge Cli output file**
- Forge cli now output a footprint file
### Changed
### Deprecated
### Removed
### Fixed
### Security


## [0.9.0]

### Added
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu Dec 14 22:11:47 UTC 2023
version=0.9.0
#Thu Feb 22 22:55:56 UTC 2024
version=0.10.0-rc.2
21 changes: 21 additions & 0 deletions src/main/java/gov/nasa/podaac/forge/FootprintCLI.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import gov.nasa.podaac.forge.Footprinter;
import java.util.Map;
import java.io.FileWriter;
import java.io.IOException;

/**
* A simple command-line interface for the Footprinter class.
Expand All @@ -18,17 +20,36 @@ public static void main(String[] args) {

String granuleFile = args[0];
String configFile = args[1];
String footprint = "";
String filePath = granuleFile + ".footprint.wkt";

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"));
footprint = fp.get("FOOTPRINT");
} catch (Exception e) {
System.err.println("Error processing: " + granuleFile);
// Log the exception or handle it appropriately
e.printStackTrace(System.err);
}

try {
// Create a FileWriter object with the specified file path
FileWriter fileWriter = new FileWriter(filePath);

// Use the write method to write the string to the file
fileWriter.write(footprint);

// Close the FileWriter to release resources
fileWriter.close();

System.out.println("String has been written to the file successfully.");
} catch (IOException e) {
e.printStackTrace();
}

}
}
44 changes: 44 additions & 0 deletions terraform/forge_ecr.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
data "aws_ecr_authorization_token" "token" {}

locals {
lambda_container_image_uri_split = split("/", var.lambda_container_image_uri)
ecr_image_name_and_tag = split(":", element(local.lambda_container_image_uri_split, length(local.lambda_container_image_uri_split) - 1))
ecr_image_name = "${local.environment}-${element(local.ecr_image_name_and_tag, 0)}"
ecr_image_tag = element(local.ecr_image_name_and_tag, 1)
}

resource aws_ecr_repository "lambda-image-repo" {
name = local.ecr_image_name
tags = var.default_tags
}


resource null_resource ecr_login {
triggers = {
image_uri = var.lambda_container_image_uri
}

provisioner "local-exec" {
interpreter = ["/bin/bash", "-e", "-c"]
command = <<EOF
docker login ${data.aws_ecr_authorization_token.token.proxy_endpoint} -u AWS -p ${data.aws_ecr_authorization_token.token.password}
EOF
}
}


resource null_resource upload_ecr_image {
depends_on = [null_resource.ecr_login]
triggers = {
image_uri = var.lambda_container_image_uri
}

provisioner "local-exec" {
interpreter = ["/bin/bash", "-e", "-c"]
command = <<EOF
docker pull ${var.lambda_container_image_uri}
docker tag ${var.lambda_container_image_uri} ${aws_ecr_repository.lambda-image-repo.repository_url}:${local.ecr_image_tag}
docker push ${aws_ecr_repository.lambda-image-repo.repository_url}:${local.ecr_image_tag}
EOF
}
}
2 changes: 1 addition & 1 deletion terraform/forge_fargate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module "forge_fargate" {
"FOOTPRINT_OUTPUT_DIR": var.footprint_output_dir
}

image = var.image
image = "${aws_ecr_repository.lambda-image-repo.repository_url}:${local.ecr_image_tag}"
ecs_cluster_arn = var.cluster_arn
subnet_ids = var.subnet_ids
scale_dimensions = var.scale_dimensions != null ? var.scale_dimensions : {"ServiceName" = "${var.prefix}-${var.app_name}-fargate-service","ClusterName" = var.ecs_cluster_name}
Expand Down
6 changes: 6 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ variable "profile" {

variable image{
description = "ECR image arn"
default = ""
type = string
}

variable lambda_container_image_uri{
description = "public image url"
type = string
}

Expand Down
2 changes: 1 addition & 1 deletion terraform_deploy/forge.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ module "forge_module" {
fargate_cpu = 256
fargate_iam_role = aws_iam_role.fargate_execution.arn
ecs_cluster_name = aws_ecs_cluster.main.name
image = "source will be override by override.py"
lambda_container_image_uri = "source will be override by override.py"
}
2 changes: 1 addition & 1 deletion terraform_deploy/override.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if __name__ == '__main__':

data = {'module': [{'forge_module': {'source': sys.argv[1], 'image': sys.argv[2]}}]}
data = {'module': [{'forge_module': {'source': sys.argv[1], 'lambda_container_image_uri': sys.argv[2]}}]}
with open('override.tf.json', 'w') as f:
json.dump(data, f)

Expand Down

0 comments on commit f4293eb

Please sign in to comment.