Skip to content

Commit

Permalink
Support S2C (#49)
Browse files Browse the repository at this point in the history
* Use PLATFORMS env var rather than hard-coded platforms

- Rather than hard-code "S2A" and "S2B" as the platforms to generate
  search query parameters, expect the PLATFORMS env var to be set as a
  comma-separated list of platforms, so we can set it to "S2B,S2C" when
  we're ready to cutover to S2C support.
- Update pytest* dependencies to their latest versions
- Move unit tests to doctest docstrings for simplicity/clarity

* Use Node.js LTS and latest version of AWS CDK

* Speed up Python Lambda image builds

During CDK's builds of Python Lambda Docker images, there were
10s of megabytes of files needlessly being put into the Docker context,
primarily from places like the python, mypy, and ruff caches. We can
tell the CDK to ignore these assets and greatly speed up build times.

* Remove hard-coded platforms

- Eliminate the Platform type alias and simply use `str` as the type
- Use latest versions of pytest* deps
- Fix code coverage CLI option to pytest to reflect previous code
  restructuring so coverage report is properly generated

* Update all Pipfile.lock files
  • Loading branch information
chuckwondo authored Jan 21, 2025
1 parent ddcdf3a commit f02c52e
Show file tree
Hide file tree
Showing 29 changed files with 1,833 additions and 1,795 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ jobs:
- name: Create .env file
run: |
touch .env
echo OWNER="ci-developmentseed" >> .env
echo IDENTIFIER=${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.commit }} >> .env
echo PERMISSIONS_BOUNDARY_ARN=${{ vars.PERMISSIONS_BOUNDARY_ARN }} >> .env
echo PLATFORMS=${{ vars.PLATFORMS }} >> .env
- name: Set up Python 3.11
uses: actions/setup-python@v4
Expand All @@ -357,7 +357,7 @@ jobs:
- name: Setup up Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
node-version: "lts/*"

- name: Install AWS CDK
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ jobs:
REMOVAL_POLICY_DESTROY="FALSE"
UPLOAD_BUCKET="${{ secrets.UPLOAD_BUCKET }}"
PERMISSIONS_BOUNDARY_ARN="${{ vars.PERMISSIONS_BOUNDARY_ARN }}"
PLATFORMS="${{ vars.PLATFORMS }}"
EOF
- name: Set up Python 3.11
Expand All @@ -210,7 +211,7 @@ jobs:
- name: Setup up Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
node-version: "lts/*"

- name: Install AWS CDK
run: |
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,14 @@ integration-tests:
tox:
@if [[ -z $${TOX_ENV_DIR+x} ]]; then echo "ERROR: For tox.ini use only" >&2; exit 1; fi

# Install node in the virtualenv, if it's not installed or it's the wrong version.
# Pull node version from .nvmrc file.
# Install node in the virtualenv, if it's not installed.
install-node: tox
@NODE_VERSION=$$(<.nvmrc); \
if [[ ! $$(type node 2>/dev/null) =~ $${VIRTUAL_ENV} || ! $$(node -v) =~ $${NODE_VERSION} ]]; then \
nodeenv --node $${NODE_VERSION} --python-virtualenv; \
if [[ ! $$(type node 2>/dev/null) =~ $${VIRTUAL_ENV} ]]; then \
nodeenv --node lts --python-virtualenv; \
fi

# Install cdk in the virtualenv, if it's not installed or it's the wrong version.
# Pull CDK version from value of aws_cdk_version variable in setup.py.
# Install cdk in the virtualenv, if it's not installed.
install-cdk: install-node
@CDK_VERSION=$$(grep "aws_cdk_version = " setup.py | sed -Ee 's/aws_cdk_version = "(.+)"/\1/'); \
if [[ ! $$(type cdk 2>/dev/null) =~ $${VIRTUAL_ENV} || ! $$(cdk --version) =~ $${CDK_VERSION} ]]; then \
npm install --location global "aws-cdk@$${CDK_VERSION}"; \
if [[ ! $$(type cdk 2>/dev/null) =~ $${VIRTUAL_ENV} ]]; then \
npm install --location global "aws-cdk@latest"; \
fi
@# Acknowledge CDK notice regarding CDK v1 being in maintenance mode.
@grep -q 19836 cdk.context.json 2>/dev/null || cdk acknowledge 19836
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@ This project aims to provide a serverless implementation of the current [HLS S2

# Contents

* [🧑‍💻 Development - Requirements](#requirements)
* [🧑‍💻 Development - Getting started 🏃‍♀️](#getting-started-🏃‍♀️)
* [🧑‍💻 Development - Repository TL;DR:](#repository-tldr)
* [🧑‍💻 Development - Lambda and Layer development TL;DR:](#lambda-and-layer-development-tldr)
* [🧑‍💻 Development - Makefile goodness](#makefile-goodness)
* [🚀 Deployment - Prerequisites](#prerequisites)
* [🚀 Deployment - Standard Deployments](#standard-deployments)
* [🚀 Deployment - Testing Deployments](#testing-deployments)
- [Requirements](#requirements)
- [Getting started 🏃‍♀️](#getting-started-️)
- [Using `REMOVAL_POLICY_DESTROY`](#using-removal_policy_destroy)
- [Repository TL;DR:](#repository-tldr)
- [Lambda and Layer development TL;DR](#lambda-and-layer-development-tldr)
- [Makefile goodness](#makefile-goodness)
- [Prerequisites](#prerequisites)
- [SciHub Credentials](#scihub-credentials)
- [Copernicus Credentials](#copernicus-credentials)
- [Upload Bucket](#upload-bucket)
- [Standard Deployments](#standard-deployments)
- [Testing Deployments](#testing-deployments)

# Development

## Requirements

To develop on this project, you should install:

* NVM [Node Version Manager](https://github.com/nvm-sh/nvm) / Node 18
- NVM [Node Version Manager](https://github.com/nvm-sh/nvm) / Node LTS
* [AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html) - There is a `package.json` in the repository, it's recommended to run `npm install` in the repository root and make use of `npx <command>` rather than globally installing AWS CDK
* [pyenv](https://github.com/pyenv/pyenv) / Python 3.11
* [pipenv](https://github.com/pypa/pipenv)
Expand Down Expand Up @@ -52,6 +56,7 @@ ENABLE_DOWNLOADING="TRUE" # Or "FALSE" - If TRUE then the TO_UPLOAD queue is set
SCHEDULE_LINK_FETCHING="TRUE" # Or "FALSE" - If TRUE then link fetching will happen every day at midday.
REMOVAL_POLICY_DESTROY="TRUE" # Or "FALSE" - See below for what is deleted if TRUE
UPLOAD_BUCKET="<name-of-aws-s3-bucket-to-upload-images-to>"
PLATFORMS="S2B,S2C" # Comma-separated list of platforms to query for
```

An example that you can modify and rename to `.env` is provided: `example.env`
Expand All @@ -76,7 +81,7 @@ The pattern for this monorepo approach was devised amongst a few folks at Develo

Most directories will contain a README to explain what the purpose is of the component and how to develop it.

## Lambda and Layer development TL;DR:
## Lambda and Layer development TL;DR

Every Lambda and Layer directory has a `Makefile` inside, this contains a subset of the commands found in the [root repository Makefile](#makefile-goodness). Each `Makefile` should come with `install`, `lint`, `format`, and `test` as standard, these are then added as calls in the root Makefile so that we can install/lint/format/unit test all our code at a project level.

Expand Down
Loading

0 comments on commit f02c52e

Please sign in to comment.