|
9 | 9 | from projen.awscdk import AwsCdkPythonApp |
10 | 10 |
|
11 | 11 | from src.bin.cicd_helper import github_cicd |
12 | | -from src.bin.env_helper import cdk_action_task |
| 12 | +from src.bin.env_helper import CDK_VALIDATE_COMMAND, cdk_action_task |
13 | 13 |
|
14 | 14 | # Define the python module name and set the python version |
15 | 15 | project_name = "aws-cdk-python-starter-kit" |
16 | 16 | python_module_name = "src" |
17 | 17 | python_version = "3.13" |
18 | 18 | python_major, python_minor = map(int, python_version.split(".")) |
19 | 19 | python_requires = f">={python_version},<{python_major}.{python_minor + 1}" |
| 20 | +cdk_version = "2.263.0" |
| 21 | +cdk_cli_version = "2.1130.0" |
20 | 22 |
|
21 | 23 | # Define the AWS region for the CDK app and github workflows |
22 | 24 | # Default to us-east-1 if AWS_REGION is not set in your environment variables |
|
26 | 28 | author_email="danny@towardsthecloud.com", |
27 | 29 | author_name="Danny Steenman", |
28 | 30 | cdk_version_pinning=True, |
29 | | - cdk_version="2.254.0", # Find the latest CDK version here: https://pypi.org/project/aws-cdk-lib |
30 | | - cdk_cli_version="2.1117.0", # Find the latest CDK CLI version https://pypi.org/project/aws-cdk-cli/ |
| 31 | + cdk_version=cdk_version, # Find the latest CDK version here: https://pypi.org/project/aws-cdk-lib |
| 32 | + cdk_cli_version=cdk_cli_version, # Find the latest CDK CLI version https://pypi.org/project/aws-cdk-cli/ |
| 33 | + context={ |
| 34 | + "@aws-cdk/core:annotationsInValidationReport": True, |
| 35 | + "@aws-cdk/core:validateAgainstDefaultRules": True, |
| 36 | + "cli-telemetry": False, |
| 37 | + }, |
31 | 38 | module_name=python_module_name, |
32 | 39 | name=project_name, |
33 | 40 | projen_command="uv run projen", |
34 | 41 | description="Create and deploy an AWS CDK app on your AWS account in less than 5 minutes using GitHub actions!", |
35 | 42 | version="2.101.0", |
36 | 43 | app_entrypoint=f"{python_module_name}/app.py", |
37 | 44 | deps=["aws-cdk-github-oidc"], |
38 | | - dev_deps=["projen@0.99.62", "ruff", "ty"], # Find the latest projen version here: https://pypi.org/project/projen/ |
| 45 | + dev_deps=[ |
| 46 | + "projen@0.101.11", |
| 47 | + "ruff", |
| 48 | + "ty", |
| 49 | + ], # Find the latest projen version here: https://pypi.org/project/projen/ |
| 50 | + pytest_options={"version": "9.0.3"}, |
39 | 51 | uv=True, |
40 | 52 | uv_options={ |
41 | 53 | "python_exec": f"python{python_version}", |
|
47 | 59 | github_options={ |
48 | 60 | "pull_request_lint_options": { |
49 | 61 | "semantic_title_options": { |
50 | | - "types": ["feat", "fix", "chore", "refactor", "perf", "docs", "style", "test", "build", "ci"], |
| 62 | + "types": [ |
| 63 | + "feat", |
| 64 | + "fix", |
| 65 | + "chore", |
| 66 | + "refactor", |
| 67 | + "perf", |
| 68 | + "docs", |
| 69 | + "style", |
| 70 | + "test", |
| 71 | + "build", |
| 72 | + "ci", |
| 73 | + ], |
51 | 74 | }, |
52 | 75 | }, |
53 | 76 | }, |
|
74 | 97 | # so the CDK CLI knows which region to use |
75 | 98 | project.tasks.add_environment("CDK_DEFAULT_REGION", aws_region) |
76 | 99 |
|
| 100 | +project.add_task( |
| 101 | + "validate", |
| 102 | + description="Validate the CDK app offline against the default CloudFormation rules", |
| 103 | + exec=f"{CDK_VALIDATE_COMMAND} --no-online", |
| 104 | + receive_args=True, |
| 105 | +) |
| 106 | + |
77 | 107 | # Define the target AWS accounts for the different environments |
78 | 108 | target_accounts = { |
79 | 109 | "dev": "987654321012", |
|
113 | 143 | ) |
114 | 144 |
|
115 | 145 | # Add auto-merge step to the auto-approve workflow |
116 | | -auto_approve_workflow = project.try_find_object_file(".github/workflows/auto-approve.yml") |
| 146 | +auto_approve_workflow = project.try_find_object_file( |
| 147 | + ".github/workflows/auto-approve.yml" |
| 148 | +) |
117 | 149 | if auto_approve_workflow: |
118 | 150 | auto_approve_workflow.add_override("jobs.approve.permissions.contents", "write") |
119 | 151 | # Add checkout step before the merge step |
|
143 | 175 | ) |
144 | 176 |
|
145 | 177 | # Adds GitHub action workflows for deploying the CDK stacks to the target AWS account |
146 | | - github_cicd(gh, account, env, python_version, aws_region) |
| 178 | + github_cicd(gh, account, env, python_version, aws_region, cdk_cli_version) |
147 | 179 |
|
148 | 180 | project.synth() |
0 commit comments