diff --git a/Makefile_windows b/Makefile_windows index bc75605e..6cae53b5 100644 --- a/Makefile_windows +++ b/Makefile_windows @@ -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 @@ -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" diff --git a/Pipfile b/Pipfile index 791267a6..f32fc6c9 100644 --- a/Pipfile +++ b/Pipfile @@ -22,6 +22,7 @@ isort = "*" boto3 = "*" mkdocs-material = "*" mkdocs-git-revision-date-plugin = "*" +setuptools = ">=65.5.1" [packages] aws-lambda-powertools= {extras = ["all"],version = "*"} diff --git a/Pipfile.lock b/Pipfile.lock index a73f6818..962c6a87 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "00979ab0f5b02268c679160f69508b36311c88f9a6cf944b16a7a6871d0c9dcd" + "sha256": "ce4b963f9bd50008302f0960bf4d1b9e6d62ff0da58e7b27927b914bab439660" }, "pipfile-spec": 6, "requires": { @@ -37,11 +37,11 @@ }, "botocore": { "hashes": [ - "sha256:26e86fce95049f6cc18b5611901549943c4c22522fa8a3b6b265404f673977b2", - "sha256:2aba44433b6eac6d3a12cf93f2985e2d7a843307c1a527042fc48dd09b273992" + "sha256:917807ee4ccca34a2f2848eb4fcf878d9e97a44a911a6965ff556d0830c471fd", + "sha256:a54561e591f5d8e653657ce04dcad09c10ebca9dbefba73471976e522abf038a" ], "markers": "python_version >= '3.7'", - "version": "==1.29.18" + "version": "==1.29.19" }, "fastjsonschema": { "hashes": [ @@ -221,11 +221,11 @@ }, "aws-cdk.asset-awscli-v1": { "hashes": [ - "sha256:c245323a23f81694ce9cadeef077e373a2ef451ee986a7f08921830be70a1cc3", - "sha256:e640a789ca459452f63ba5347e7009edf85b0fa051ffe23be683a19c6dc78675" + "sha256:ae036af391a6c417b6b451459afbfc564681c9d2e104b12f8746359636313234", + "sha256:f28e7e27aeb854229f0af3fe8121ca7619c35b5a4ec3827be3f2f2774b6aadec" ], "markers": "python_version ~= '3.7'", - "version": "==2.2.22" + "version": "==2.2.23" }, "aws-cdk.asset-kubectl-v20": { "hashes": [ @@ -237,11 +237,11 @@ }, "aws-cdk.asset-node-proxy-agent-v5": { "hashes": [ - "sha256:715beb3f91aae4b8a293eb28e02d364cf37d7ef3a88db1647a983bba328d144c", - "sha256:c57c3e44aa9d5440320a408c8f10858ebb896466ea442ac8024c7529d84fa3c1" + "sha256:69b788380db6f867993bf61ed037d069cbc57d32ad4ce01739aa00042836265b", + "sha256:7d0b096bea2ce173f440453369959f53e0a02e4ee14389d5badaeb966ec543c4" ], "markers": "python_version ~= '3.7'", - "version": "==2.0.28" + "version": "==2.0.29" }, "aws-cdk.aws-lambda-python-alpha": { "hashes": [ @@ -257,19 +257,19 @@ }, "boto3": { "hashes": [ - "sha256:3c7315da16eb0b41823965e5ce55f99cb07e94680e0ed7830c581f505fb5bd15", - "sha256:933c88b189112a5fdd82d49ef00f95b9dd649d195e557a81aecb773a3e01c517" + "sha256:4b4edf893b01c651007d61534c1d248cd2350d311a4e295039bd23fd60bf899a", + "sha256:59aa6c7810a815fb52671f834d10ac4cd80b9c7c01a3cbde670cb41330059464" ], "index": "pypi", - "version": "==1.26.18" + "version": "==1.26.19" }, "botocore": { "hashes": [ - "sha256:26e86fce95049f6cc18b5611901549943c4c22522fa8a3b6b265404f673977b2", - "sha256:2aba44433b6eac6d3a12cf93f2985e2d7a843307c1a527042fc48dd09b273992" + "sha256:917807ee4ccca34a2f2848eb4fcf878d9e97a44a911a6965ff556d0830c471fd", + "sha256:a54561e591f5d8e653657ce04dcad09c10ebca9dbefba73471976e522abf038a" ], "markers": "python_version >= '3.7'", - "version": "==1.29.18" + "version": "==1.29.19" }, "cattrs": { "hashes": [ @@ -281,11 +281,11 @@ }, "cdk-nag": { "hashes": [ - "sha256:58e4c790127b1f843b4ac2cc8d162d5e83f53ae069c3915c939cb200df5e0de5", - "sha256:b3078e38c241716b5bd68b4945f558fc251c722b0de3468e0e1f1aab306ac0ac" + "sha256:639abd75ffc09cef2027bc74393b0b91f386bc9a995fc08549e3f6bff4ec2582", + "sha256:d648b76732b29af0c5d2daae939d95b7a1b2557fd769b89817b8671464168a80" ], "markers": "python_version ~= '3.7'", - "version": "==2.21.16" + "version": "==2.21.17" }, "certifi": { "hashes": [ @@ -329,11 +329,11 @@ }, "constructs": { "hashes": [ - "sha256:6968efd5f837f3a43d5a93808424744cdcd03f53df764be78123f60e81b39b0a", - "sha256:af9bd1f0bd6882a6a608bc335a4f8a230f498072bff83d9126d43c486e30305b" + "sha256:2544b6b52e15d8024cbf021cd4bb302284138e04f27032420e96817a1187897e", + "sha256:b139d3b1859b501ba58e131cbdd14e8b2bb9f5921237ed3ef97e3cf132e2c1ef" ], "markers": "python_version ~= '3.7'", - "version": "==10.1.174" + "version": "==10.1.175" }, "coverage": { "extras": [ @@ -612,11 +612,11 @@ }, "mkdocs-material": { "hashes": [ - "sha256:51760fa4c9ee3ca0b3a661ec9f9817ec312961bb84ff19e5b523fdc5256e1d6c", - "sha256:7623608f746c6d9ff68a8ef01f13eddf32fa2cae5e15badb251f26d1196bc8f1" + "sha256:b0ea0513fd8cab323e8a825d6692ea07fa83e917bb5db042e523afecc7064ab7", + "sha256:c907b4b052240a5778074a30a78f31a1f8ff82d7012356dc26898b97559f082e" ], "index": "pypi", - "version": "==8.5.10" + "version": "==8.5.11" }, "mkdocs-material-extensions": { "hashes": [ @@ -860,7 +860,7 @@ "sha256:57f6f22bde4e042978bcd50176fdb381d7c21a9efa4041202288d3737a0c6a54", "sha256:a7620757bf984b58deaf32fc8a4577a9bbc0850cf92c20e1ce41c38c19e5fb75" ], - "markers": "python_version >= '3.7'", + "index": "pypi", "version": "==65.6.3" }, "six": { diff --git a/cdk/my_service/service_stack/configuration/configuration_construct.py b/cdk/my_service/service_stack/configuration/configuration_construct.py index 244f430e..3800e0d3 100644 --- a/cdk/my_service/service_stack/configuration/configuration_construct.py +++ b/cdk/my_service/service_stack/configuration/configuration_construct.py @@ -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, @@ -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, @@ -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, diff --git a/cdk/my_service/service_stack/service_stack.py b/cdk/my_service/service_stack/service_stack.py index f3a5441c..abd571d6 100644 --- a/cdk/my_service/service_stack/service_stack.py +++ b/cdk/my_service/service_stack/service_stack.py @@ -1,5 +1,4 @@ import os -import pwd from pathlib import Path from aws_cdk import Stack @@ -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}' diff --git a/dev_requirements.txt b/dev_requirements.txt index 91a09eb0..92d68489 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -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' @@ -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' @@ -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' diff --git a/lambda_requirements.txt b/lambda_requirements.txt index 26d8b294..f4d98f94 100644 --- a/lambda_requirements.txt +++ b/lambda_requirements.txt @@ -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