Skip to content
Merged

Fixes #421

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Makefile_windows
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ dev:

lint:
@echo "Running flake8"
flake8 service/* cdk/* tests/* docs/examples/* --exclude patterns='build,cdk.json,cdk.context.json,.yaml'
flake8 service\* cdk\* tests\* docs\examples\* --exclude patterns='build,cdk.json,cdk.context.json,.yaml'

complex:
@echo "Running Radon"
radon cc -e 'tests/*,cdk.out/*' .
radon cc -e 'tests\*,cdk.out\*' .
@echo "Running xenon"
xenon --max-absolute B --max-modules A --max-average A -e 'tests/*,.venv/*,cdk.out/*' .
xenon --max-absolute B --max-modules A --max-average A -e 'tests\*,.venv\*,cdk.out\*' .

sort:
isort ${PWD}
isort

pre-commit:
pre-commit run -a --show-diff-on-failure
Expand All @@ -30,32 +30,33 @@ unit:
pytest tests\unit --cov-config=.coveragerc --cov=service --cov-report xml

integration:
pytest tests/integration --cov-config=.coveragerc --cov=service --cov-report xml
pytest tests\integration --cov-config=.coveragerc --cov=service --cov-report xml

e2e:
pytest tests/e2e --cov-config=.coveragerc --cov=service --cov-report xml
pytest tests\e2e --cov-config=.coveragerc --cov=service --cov-report xml

pr: deps yapf sort pre-commit complex lint lint-docs unit integration e2e

yapf:
yapf -i -vv --style=./.style --exclude=.venv --exclude=.build --exclude=cdk.out --exclude=.git -r .
yapf -i -vv --style=.\.style --exclude=.venv --exclude=.build --exclude=cdk.out --exclude=.git -r .

pipeline-tests:
pytest tests/unit tests/integration --cov-config=.coveragerc --cov=service --cov-report xml
pytest tests\unit tests\integration --cov-config=.coveragerc --cov=service --cov-report xml

deploy:
make deps
if not exist ".build\lambdas" mkdir ".build\lambdas"
xcopy /s /e /y service .build\lambdas
if not exist ".build\lambdas\service" mkdir ".build\lambdas\service"
rmdir /S /Q .build\lambdas\service
echo D | xcopy /f /y service .build\lambdas\service /s
if not exist ".build\common_layer" mkdir ".build\common_layer"
pipenv requirements > .build\common_layer\requirements.txt
cdk deploy --app="python cdk\my_service\app.py" --require-approval=never

destroy:
cdk destroy --app="python ${PWD}\cdk\my_service\app.py" --force
cdk destroy --app="python cdk\my_service\app.py" --force

docs:
mkdocs serve

lint-docs:
docker run -v ${PWD}:/markdown 06kellyjac/markdownlint-cli --fix "docs"
docker run -v \markdown 06kellyjac\markdownlint-cli --fix "docs"
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ isort = "*"
boto3 = "*"
mkdocs-material = "*"
mkdocs-git-revision-date-plugin = "*"
setuptools = ">=65.5.1"

[packages]
aws-lambda-powertools= {extras = ["all"],version = "*"}
Expand Down
52 changes: 26 additions & 26 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ def __init__(self, scope: Construct, id_: str, environment: str, service_name: s
)
self.config_env = appconfig.CfnEnvironment(
self,
id='env',
id=f'{id_}env',
application_id=self.config_app.ref,
name=environment,
)
self.config_profile = appconfig.CfnConfigurationProfile(
self,
id='profile',
id=f'{id_}profile',
application_id=self.config_app.ref,
location_uri='hosted',
name=configuration_name,
)
self.hosted_cfg_version = appconfig.CfnHostedConfigurationVersion(
self,
'version',
f'{id_}version',
application_id=self.config_app.ref,
configuration_profile_id=self.config_profile.ref,
content=configuration_str,
Expand All @@ -63,7 +63,7 @@ def __init__(self, scope: Construct, id_: str, environment: str, service_name: s

self.cfn_deployment_strategy = appconfig.CfnDeploymentStrategy(
self,
CUSTOM_ZERO_TIME_STRATEGY,
f'{id_}{CUSTOM_ZERO_TIME_STRATEGY}',
deployment_duration_in_minutes=0,
growth_factor=100,
name=CUSTOM_ZERO_TIME_STRATEGY,
Expand All @@ -74,7 +74,7 @@ def __init__(self, scope: Construct, id_: str, environment: str, service_name: s

self.app_config_deployment = appconfig.CfnDeployment(
self,
id='deploy',
id=f'{id_}deploy',
application_id=self.config_app.ref,
configuration_profile_id=self.config_profile.ref,
configuration_version=self.hosted_cfg_version.ref,
Expand Down
6 changes: 4 additions & 2 deletions cdk/my_service/service_stack/service_stack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import pwd
from pathlib import Path

from aws_cdk import Stack
Expand All @@ -12,7 +11,10 @@

def get_stack_name() -> str:
repo = Repo(Path.cwd())
username = pwd.getpwuid(os.getuid()).pw_name.replace('.', '-')
try:
username = os.getlogin().replace('.', '-')
except Exception:
username = 'main'
print(f'username={username}')
try:
return f'{username}-{repo.active_branch}-{SERVICE_NAME}'
Expand Down
16 changes: 8 additions & 8 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
-i https://pypi.org/simple
attrs==22.1.0 ; python_version >= '3.5'
aws-cdk-lib==2.53.0 ; python_version ~= '3.7'
aws-cdk.asset-awscli-v1==2.2.22 ; python_version ~= '3.7'
aws-cdk.asset-awscli-v1==2.2.23 ; python_version ~= '3.7'
aws-cdk.asset-kubectl-v20==2.1.1 ; python_version ~= '3.7'
aws-cdk.asset-node-proxy-agent-v5==2.0.28 ; python_version ~= '3.7'
aws-cdk.asset-node-proxy-agent-v5==2.0.29 ; python_version ~= '3.7'
aws-cdk.aws-lambda-python-alpha==2.50.0a0 ; python_version ~= '3.7'
-e ./cdk
boto3==1.26.18
botocore==1.29.18 ; python_version >= '3.7'
boto3==1.26.19
botocore==1.29.19 ; python_version >= '3.7'
cattrs==22.2.0 ; python_version >= '3.7'
cdk-nag==2.21.16 ; python_version ~= '3.7'
cdk-nag==2.21.17 ; python_version ~= '3.7'
certifi==2022.9.24 ; python_version >= '3.6'
cfgv==3.3.1 ; python_full_version >= '3.6.1'
charset-normalizer==2.1.1 ; python_full_version >= '3.6.0'
click==8.1.3 ; python_version >= '3.7'
colorama==0.4.6 ; python_version >= '3.5'
constructs==10.1.174 ; python_version ~= '3.7'
constructs==10.1.175 ; python_version ~= '3.7'
coverage[toml]==6.5.0 ; python_version >= '3.7'
distlib==0.3.6
exceptiongroup==1.0.4 ; python_version < '3.11'
Expand All @@ -40,7 +40,7 @@ mccabe==0.7.0 ; python_version >= '3.6'
mergedeep==1.3.4 ; python_version >= '3.6'
mkdocs==1.4.2 ; python_version >= '3.7'
mkdocs-git-revision-date-plugin==0.3.2
mkdocs-material==8.5.10
mkdocs-material==8.5.11
mkdocs-material-extensions==1.1.1 ; python_version >= '3.7'
nodeenv==1.7.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
packaging==21.3 ; python_version >= '3.6'
Expand All @@ -66,7 +66,7 @@ pyyaml-env-tag==0.1 ; python_version >= '3.6'
radon==5.1.0
requests==2.28.1 ; python_version >= '3.7' and python_version < '4'
s3transfer==0.6.0 ; python_version >= '3.7'
setuptools==65.6.3 ; python_version >= '3.7'
setuptools==65.6.3
six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
smmap==5.0.0 ; python_version >= '3.6'
toml==0.10.2 ; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
Expand Down
2 changes: 1 addition & 1 deletion lambda_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-i https://pypi.org/simple
aws-lambda-powertools[all]==2.4.0
aws-xray-sdk==2.11.0
botocore==1.29.18 ; python_version >= '3.7'
botocore==1.29.19 ; python_version >= '3.7'
fastjsonschema==2.16.2
jmespath==1.0.1 ; python_version >= '3.7'
pydantic==1.10.2
Expand Down