Skip to content

Commit

Permalink
Update CDK from v1 to v2 (#619)
Browse files Browse the repository at this point in the history
* Update ADF pipeline generation to CDKv2

* Add trailing commas to imports

Co-authored-by: Simon Kok <sbkok@users.noreply.github.com>

* Apply suggestions from code review

* Fix merge

* Upgrade to latest CDK + SAM CLI, Python 3.10 (Py3.11 in CodeBuild)

**Why?**

As this commit will update the new default CodeBuild container image to use,
we will pick the most recent Standard CodeBuild image that is available at the
time of this commit. Which is STANDARD_7_0.

This allows us to continue to support the version for the foreseeable future.
As we rather not need to change this frequently, as that would introduce a
breaking change.

* Remove cdk package as it's no longer used

According to @javydekoning, it's probably left over from #424

* Use aws-cdk package instead of cdk

---------

Co-authored-by: Simon Kok <sbkok@users.noreply.github.com>
Co-authored-by: Javy de Koning <javydekoning+github@gmail.com>
Co-authored-by: Simon Kok <mail@simonkok.com>
  • Loading branch information
4 people committed Jun 1, 2023
1 parent ea45e08 commit b32326c
Show file tree
Hide file tree
Showing 68 changed files with 184 additions and 222 deletions.
2 changes: 1 addition & 1 deletion docs/providers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Provider type: `codebuild`.

#### Properties

- *image* *(String)* - default: `UBUNTU_14_04_PYTHON_3_7_1`.
- *image* *(String)* - default: `STANDARD_7_0`.
- The Image that the AWS CodeBuild will use. Images can be found
[here](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-codebuild.LinuxBuildImage.html).
- Image can also take an object that contains a property key of
Expand Down
2 changes: 1 addition & 1 deletion docs/samples-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Let's add the pipeline we need into the map once more.
build:
provider: codebuild
properties:
image: STANDARD_5_0
image: STANDARD_7_0
deploy:
provider: cloudformation
properties:
Expand Down
8 changes: 4 additions & 4 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ extra step required to deploy a SAM template is that you execute
so:

For example, deploying a NodeJS Serverless Application from AWS CodeBuild with
the `aws/codebuild/standard:5.0` image can be done with a `buildspec.yml` that
the `aws/codebuild/standard:7.0` image can be done with a `buildspec.yml` that
looks like the following
[read more](https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#runtime-versions-buildspec-file):

Expand All @@ -939,8 +939,8 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
nodejs: 14
python: 3.11
nodejs: 18
pre_build:
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
Expand Down Expand Up @@ -1113,7 +1113,7 @@ pipelines:
deploy:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
environment_variables:
TARGET_ACCOUNTS: 111111111111,222222222222 # Target accounts
TARGET_OUS: /core/infrastructure,/sandbox # Target OUs
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
astroid==2.11.7
boto3==1.26.48
botocore==1.29.48
cfn-lint==0.72.2
boto3==1.26.133
botocore==1.29.133
cfn-lint==0.77.2
docutils==0.16
isort==5.11.4
mock==5.0.1
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-cdk-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on the account `111111111111` in your main deployment region named
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
targets:
- /banking/testing
- /banking/production
Expand Down
4 changes: 2 additions & 2 deletions samples/sample-cdk-app/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
nodejs: 14
python: 3.11
nodejs: 18
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
4 changes: 2 additions & 2 deletions samples/sample-codebuild-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ your own VPC and subnets that are operational in the deployment account.
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
vpc_id: vpc-01234567890abcdef
subnet_ids:
- subnet-1234567890abcdef1
Expand All @@ -44,7 +44,7 @@ your own VPC and subnets that are operational in the deployment account.
- name: integration-tests
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
spec_filename: testspec.yml
vpc_id: vpc-01234567890abcdef
subnet_ids:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-codebuild-vpc/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
# It will connect through the VPC to fetch all the resources.
# Make sure the subnets and security groups are configured such that
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-codebuild-vpc/testspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11

build:
commands:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-ec2-with-codedeploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ imports resources directly from both of them.
build:
provider: codebuild
properties:
image: "STANDARD_5_0" # So we can specify which Python version we need
image: "STANDARD_7_0" # So we can specify which Python version we need
targets:
- /banking/testing
- /banking/production
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-ec2-with-codedeploy/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-ecr-repository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build:
provider: codebuild
properties:
image: "STANDARD_5_0" # So we can specify which Python version we need
image: "STANDARD_7_0"
targets:
- /deployment
```
2 changes: 1 addition & 1 deletion samples/sample-ecr-repository/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-ecs-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build:
provider: codebuild
properties:
image: "STANDARD_5_0" # So we can specify which Python version we need
image: "STANDARD_7_0" # So we can specify which Python version we need
targets:
- 222222222222
- path: 333333333333
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-ecs-cluster/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-expunge-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Upon stack deletion the default VPCs will be recreated.
build:
provider: codebuild
properties:
image: "STANDARD_5_0" # So we can specify which Python version we need
image: "STANDARD_7_0" # So we can specify which Python version we need
environment_variables:
CONTAINS_TRANSFORM: true
# ^ Required for templates that contain transforms (eg SAM Templates)
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-expunge-vpc/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-expunge-vpc/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Resources:
Handler: lambda_function.lambda_handler
MemorySize: 128
Role: !GetAtt LambdaVPCPolicyRole.Arn
Runtime: python3.9
Runtime: python3.10
Timeout: 600
Environment:
Variables:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-fargate-node-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
privileged: true
# ^ Required for Docker in Docker to work as expected (since
# CodeBuild will run our docker commands to create and push our
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-fargate-node-app/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ phases:
install:
runtime-versions:
docker: 20
python: 3.9
python: 3.11

build:
commands:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-iam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on the account `111111111111` in your main deployment region named *sample-iam*.
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
params:
restart_execution_on_update: True
targets:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-iam/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
4 changes: 2 additions & 2 deletions samples/sample-mono-repo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repository.
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
spec_filename: apps/alpha/buildspec.yml
deploy:
provider: cloudformation
Expand All @@ -53,7 +53,7 @@ repository.
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
spec_filename: apps/beta/buildspec.yml
deploy:
provider: cloudformation
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-mono-repo/apps/alpha/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- cd $INFRASTRUCTURE_ROOT_DIR
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-mono-repo/apps/beta/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- cd $INFRASTRUCTURE_ROOT_DIR
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-rdk-rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Sample pipeline definition looks like below:
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
deploy:
provider: cloudformation
targets:
Expand Down
4 changes: 2 additions & 2 deletions samples/sample-rdk-rules/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
nodejs: 14
python: 3.11
nodejs: 18
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Parameters": {
"RuleName": "EC2_CHECKS_TERMINATION_PROTECTION_ADF",
"Description": "EC2_CHECKS_TERMINATION_PROTECTION_ADF",
"SourceRuntime": "python3.9",
"SourceRuntime": "python3.10",
"CodeKey": "EC2_CHECKS_TERMINATION_PROTECTION_ADFeu-central-1.zip",
"InputParameters": "{}",
"OptionalParameters": "{}",
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-serverless-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
environment_variables:
CONTAINS_TRANSFORM: True
targets:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-serverless-app/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11

build:
commands:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-serverless-app/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Resources:
Type: 'AWS::Serverless::Function'
Properties:
Handler: lambda_function.handler
Runtime: python3.9
Runtime: python3.10
CodeUri: .
Description: Sample Lambda Function
MemorySize: 128
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-service-catalog-product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This stack imports values from `sample-vpc` and `sample-iam`.
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
targets:
- /banking/testing
- path: /banking/production
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-service-catalog-product/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ example:
deploy:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
environment_variables:
TARGET_ACCOUNTS: 111111111111,222222222222 # Target accounts
TARGET_OUS: /core/infrastructure,/sandbox # Target OUs
Expand Down
3 changes: 2 additions & 1 deletion samples/sample-terraform/tf_apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ env:
phases:
install:
runtime-versions:
python: 3.9
python: 3.11

build:
commands:
- python adf-build/helpers/terraform/get_accounts.py
Expand Down
3 changes: 2 additions & 1 deletion samples/sample-terraform/tf_plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ env:
phases:
install:
runtime-versions:
python: 3.9
python: 3.11

build:
commands:
- python adf-build/helpers/terraform/get_accounts.py
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build:
provider: codebuild
properties:
image: "STANDARD_5_0"
image: "STANDARD_7_0"
params:
restart_execution_on_update: True
targets:
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-vpc/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.2
phases:
install:
runtime-versions:
python: 3.9
python: 3.11
commands:
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
- pip install -r adf-build/requirements.txt -q
Expand Down
Loading

0 comments on commit b32326c

Please sign in to comment.