This repository has been archived by the owner on Oct 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vggonzal
authored and
vggonzal
committed
Sep 27, 2023
1 parent
87f5eba
commit fc11950
Showing
1 changed file
with
0 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,71 +155,3 @@ jobs: | |
- name: Build Python Artifact | ||
run: | | ||
poetry build | ||
# Setup Terraform to Deploy | ||
|
||
- name: Configure AWS Credentials as Environment Variables | ||
run: echo "AWS_ACCESS_KEY_ID=${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}" >> $GITHUB_ENV | | ||
echo "AWS_SECRET_ACCESS_KEY=${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}" >> $GITHUB_ENV | ||
|
||
- name: Validate AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-region: us-west-2 | ||
role-session-name: GitHubActions | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }} | ||
- run: aws sts get-caller-identity | ||
|
||
|
||
- name: Test with pytest | ||
if: | | ||
github.ref == 'test' | ||
run: | | ||
pip install pytest | ||
pip install pytest-dynamodb | ||
pip install connexion | ||
pip install flask_testing | ||
pip install moto | ||
pip install geopandas | ||
pip install git+https://github.com/podaac/hydrocron-db.git | ||
pytest tests/test_api.py -k 'test_gettimeseries_get' | ||
pytest tests/test_api.py -k 'test_getsubset_get' | ||
- uses: hashicorp/[email protected] | ||
with: | ||
terraform_version: 1.0.3 | ||
|
||
|
||
# -- Build -- | ||
- name: Build lambda package | ||
run: ./build.sh | ||
- name: Upload packaged zip | ||
uses: actions/[email protected] | ||
with: | ||
name: dist | ||
path: dist/*.zip | ||
|
||
- name: Deploy Terraform | ||
#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' | ||
working-directory: terraform/ | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }} | ||
AWS_DEFAULT_REGION: us-west-2 | ||
|
||
run: | | ||
source bin/config.sh ${{ env.THE_ENV }} | ||
terraform init -reconfigure -backend-config="bucket=podaac-services-${{ env.THE_ENV }}-terraform" -backend-config="region=us-west-2" | ||
terraform plan -var-file=tfvars/"${{ env.THE_ENV }}".tfvars -var="app_version=${{ env.THE_VERSION }}" -out="tfplan" | ||
terraform apply -auto-approve tfplan |