build: remove dependency on pyenv-virtualenv (#7)

build: boto3 update, ensure terraform init
This commit is contained in:
Marc 2022-09-03 17:52:22 -04:00 committed by GitHub
parent 9a81426840
commit 08da99b99c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 30 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.venv
*.sw* *.sw*
*.pyc *.pyc
*.zip *.zip
@ -5,4 +6,4 @@
*.terraform* *.terraform*
*tfstate* *tfstate*
*tfvars *tfvars
.coverage

View file

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.8
# To update, run: # To update, run:
# #
# pip-compile requirements.in # pip-compile requirements.in

View file

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.8
# To update, run: # To update, run:
# #
# pip-compile --output-file=requirements_dev.txt requirements_dev.in # pip-compile --output-file=requirements_dev.txt requirements_dev.in
@ -16,14 +16,14 @@ aws-xray-sdk==2.6.0
# via moto # via moto
black==20.8b1 black==20.8b1
# via -r requirements_dev.in # via -r requirements_dev.in
boto3==1.16.59 boto==2.49.0
# via moto
boto3==1.24.66
# via # via
# -r requirements_dev.in # -r requirements_dev.in
# aws-sam-translator # aws-sam-translator
# moto # moto
boto==2.49.0 botocore==1.27.66
# via moto
botocore==1.19.59
# via # via
# aws-xray-sdk # aws-xray-sdk
# boto3 # boto3
@ -117,12 +117,12 @@ pyparsing==2.4.7
# via packaging # via packaging
pyrsistent==0.17.3 pyrsistent==0.17.3
# via jsonschema # via jsonschema
pytest-cov==2.11.1
# via -r requirements_dev.in
pytest==6.2.1 pytest==6.2.1
# via # via
# -r requirements_dev.in # -r requirements_dev.in
# pytest-cov # pytest-cov
pytest-cov==2.11.1
# via -r requirements_dev.in
python-dateutil==2.8.1 python-dateutil==2.8.1
# via # via
# botocore # botocore
@ -146,7 +146,7 @@ responses==0.12.1
# via moto # via moto
rsa==4.7 rsa==4.7
# via python-jose # via python-jose
s3transfer==0.3.4 s3transfer==0.6.0
# via boto3 # via boto3
six==1.15.0 six==1.15.0
# via # via

View file

@ -11,13 +11,12 @@ else
# of the invoke commands. # # of the invoke commands. #
################################################################# #################################################################
{ test -d $VENV || python3 -m venv $VENV || return
pyenv virtualenv-delete -f $VENV . $VENV/bin/activate
pyenv virtualenv $VENV &&
pyenv activate $VENV && python -m pip install -U pip pip-tools --no-cache-dir
python -m pip install -U pip pip-tools && python -m pip install -r requirements.txt
pip install -r requirements_dev.txt && python -m pip install -r requirements_dev.txt
echo "✨ Good to go! ✨" echo "✨ Good to go! ✨"
}
fi fi

View file

@ -44,6 +44,7 @@ def cloud_plan(ctx, project):
Builds the Terraform plan for the given project. Builds the Terraform plan for the given project.
""" """
with ctx.cd(PROJECT_PATHS[project]): with ctx.cd(PROJECT_PATHS[project]):
ctx.run("terraform init")
ctx.run(f"terraform plan --var-file {VARIABLES_PATH}") ctx.run(f"terraform plan --var-file {VARIABLES_PATH}")
@ -53,6 +54,7 @@ def cloud_apply(ctx, project):
Applies infrastructure changes to the given project. Applies infrastructure changes to the given project.
""" """
with ctx.cd(PROJECT_PATHS[project]): with ctx.cd(PROJECT_PATHS[project]):
ctx.run("terraform init")
ctx.run("terraform taint --allow-missing aws_lambda_function.apgnd_lambda_func") ctx.run("terraform taint --allow-missing aws_lambda_function.apgnd_lambda_func")
ctx.run("terraform taint --allow-missing aws_lambda_permission.apigw") ctx.run("terraform taint --allow-missing aws_lambda_permission.apigw")
ctx.run(f"terraform apply --var-file {VARIABLES_PATH}") ctx.run(f"terraform apply --var-file {VARIABLES_PATH}")
@ -64,6 +66,7 @@ def cloud_destroy(ctx, project):
Destroys resources associated with the given project. Destroys resources associated with the given project.
""" """
with ctx.cd(PROJECT_PATHS[project]): with ctx.cd(PROJECT_PATHS[project]):
ctx.run("terraform init")
ctx.run(f"terraform destroy --var-file {VARIABLES_PATH}") ctx.run(f"terraform destroy --var-file {VARIABLES_PATH}")
@ -90,8 +93,9 @@ def cloud_push(ctx, archive):
with ctx.cd(_compose_path(PROJECT_PATHS["bootstrap"])): with ctx.cd(_compose_path(PROJECT_PATHS["bootstrap"])):
out = ctx.run("terraform output", hide="out").stdout out = ctx.run("terraform output", hide="out").stdout
artifacts_bucket_match = re.match( artifacts_bucket_match = re.match(
"artifacts_bucket_name = (?P<bucket_name>[0-9a-zA-Z\-]+)\n", out 'artifacts_bucket_name = "(?P<bucket_name>[0-9a-zA-Z-_]+)"\n?', out
) )
artifacts_bucket = artifacts_bucket_match.group("bucket_name") artifacts_bucket = artifacts_bucket_match.group("bucket_name")
with ctx.cd(BASE_PATH): with ctx.cd(BASE_PATH):