diff --git a/.gitlab/merge_request_templates/Default.md b/.github/pull_request_template.md similarity index 51% rename from .gitlab/merge_request_templates/Default.md rename to .github/pull_request_template.md index c3cf39a0..bc40c698 100644 --- a/.gitlab/merge_request_templates/Default.md +++ b/.github/pull_request_template.md @@ -1,4 +1,4 @@ -## Related Issue(s) +## Related issue(s) - @@ -12,20 +12,12 @@ This change was validated by the following observations: 1. -## Merge Request Checklist +## Checklist - [ ] I have deployed and validated this change - [ ] Changelog - [ ] I have added my changes to the changelog - [ ] No changelog entry is necessary -- [ ] Readme Migration +- [ ] README migration - [ ] I have added any migration steps to the Readme - [ ] No migration is necessary -- [ ] Deploy Template - - [ ] updated with this change - - [ ] filed an issue to update - - [ ] no change is necessary -- [ ] FilmDrop Demo dev deployment - - [ ] updated with this change - - [ ] filed an issue to update - - [ ] no change is necessary diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..86a940be --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: Continuous integration + +on: + pull_request: + push: + branches: + main + +jobs: + update-lambdas: + runs-on: ubuntu-latest + env: + CI: true + STAC_SERVER_TAG: v2.2.3 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '16' + - name: Update stac-server lambdas + run: ./scripts/update-lambdas.sh \ No newline at end of file diff --git a/.gitignore b/.gitignore index 85f69052..8a35ff9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,33 @@ -modules/jupyterhub-dask-eks/cluster.yaml -modules/jupyterhub-dask-eks/daskhub.yaml -modules/jupyterhub-dask-eks/spec.yaml -modules/jupyterhub-dask-eks/storageclass.yaml -.terraform/ -terraform-visual-report -plan.json -saved.plan -*.tfstate -*.tfstate.* -.terraform.lock.hcl -terraform.tgz -bin/terraform *.auto.tfvars -*.swp -*.swo *.env* -*.tmp *.orig *.out +*.swo +*.swp +*.tfstate +*.tfstate.* +*.tmp *.zip *output -node_modules -package-lock.json -plan.out -.pytest* -__pycache__ .DS_Store +.opensearch.info +.pytest* .terraform.lock* +.terraform.lock.hcl .terraform.tfstate* +.terraform/ +__pycache__ +bin/terraform +modules/jupyterhub-dask-eks/cluster.yaml +modules/jupyterhub-dask-eks/daskhub.yaml +modules/jupyterhub-dask-eks/spec.yaml +modules/jupyterhub-dask-eks/storageclass.yaml +node_modules +package-lock.json +plan.json +plan.out +saved.plan stac-server-* -.opensearch.info +stac-server.tgz +terraform-visual-report +terraform.tgz diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index fc0ce1f4..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,51 +0,0 @@ -default: - image: quay.io/element84/e84-build-filmdrop:1.5.7-main - -.common_variables: - variables: - STAC_SERVER_TAG_DEV: v2.2.3 - STAC_SERVER_TAG_RELEASE: v2.2.3 - -.setup_and_validate: - script: - - export CI=true - - export FILMDROP_BUILD_DIR=`pwd` - - export STAC_SERVER_DIR="stac-server-${STAC_SERVER_TAG:1}" - - . $HOME/.nvm/nvm.sh - - nvm use v16 - - echo "Building stac-server..." - - curl -L -f --no-progress-meter -o stac-server.tgz "https://github.com/stac-utils/stac-server/archive/refs/tags/${STAC_SERVER_TAG}.tar.gz" - - tar -xzf stac-server.tgz - - cd "$STAC_SERVER_DIR" - - npm install - - BUILD_PRE_HOOK=true npm run build - - mkdir -p $FILMDROP_BUILD_DIR/modules/stac-server/lambda/api - - cp dist/api/api.zip $FILMDROP_BUILD_DIR/modules/stac-server/lambda/api/ - - mkdir -p $FILMDROP_BUILD_DIR/modules/stac-server/lambda/ingest - - cp dist/ingest/ingest.zip $FILMDROP_BUILD_DIR/modules/stac-server/lambda/ingest/ - - mkdir -p $FILMDROP_BUILD_DIR/modules/stac-server/lambda/pre-hook - - cp dist/pre-hook/pre-hook.zip $FILMDROP_BUILD_DIR/modules/stac-server/lambda/pre-hook/ - - cd $FILMDROP_BUILD_DIR/modules - # - pre-commit run --all-files - -dev_validate: - extends: [.common_variables] - rules: - - if: $CI_COMMIT_REF_NAME == "main" - when: on_success - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: on_success - variables: - STAC_SERVER_TAG: ${STAC_SERVER_TAG_DEV} - script: - - !reference [.setup_and_validate, script] - -version_validate: - extends: [.common_variables] - rules: - - if: $CI_COMMIT_TAG =~ /^v(\d+.)(\d+.)(\d+)(-[.\d\w]+)?$/ - when: on_success - variables: - STAC_SERVER_TAG: ${STAC_SERVER_TAG_RELEASE} - script: - - !reference [.setup_and_validate, script] diff --git a/scripts/update-lambdas.sh b/scripts/update-lambdas.sh new file mode 100755 index 00000000..dd5d53c7 --- /dev/null +++ b/scripts/update-lambdas.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Update the stac-server lambdas. +# +# Usage: +# +# ./scripts/update-lambdas.sh v2.2.3 +# +# or +# +# export STAC_SERVER_TAG=v2.2.3 +# ./scripts/update-lambdas.sh + +set -e + +if [ -z "$1" ]; then + if [ -z "${STAC_SERVER_TAG}" ]; then + echo "ERROR: STAC_SERVER_TAG is not set in the environment and is not provided on the command line." + echo "Usage: $0 [STAC_SERVER_TAG]" + exit 1 + fi +else + STAC_SERVER_TAG="$1" +fi +STAC_SERVER_DIR="stac-server-${STAC_SERVER_TAG:1}" + +echo "Downloading stac-server $STAC_SERVER_TAG to $STAC_SERVER_DIR..." +curl -L -f --no-progress-meter -o stac-server.tgz "https://github.com/stac-utils/stac-server/archive/refs/tags/${STAC_SERVER_TAG}.tar.gz" +tar -xzf stac-server.tgz + +echo "Building stac-server in $STAC_SERVER_DIR..." +(cd "$STAC_SERVER_DIR"; npm install; BUILD_PRE_HOOK=true npm run build) + +echo "Copying stac-server lambdas..." +mkdir -p modules/stac-server/lambda/api +cp "$STAC_SERVER_DIR/dist/api/api.zip" modules/stac-server/lambda/api/ +mkdir -p modules/stac-server/lambda/ingest +cp "$STAC_SERVER_DIR/dist/ingest/ingest.zip" modules/stac-server/lambda/ingest/ +mkdir -p modules/stac-server/lambda/pre-hook +cp "$STAC_SERVER_DIR/dist/pre-hook/pre-hook.zip" modules/stac-server/lambda/pre-hook/ + +echo "Done!"