Skip to content

Commit 0a94366

Browse files
committed
Upgrade to py3.8 + latest CDK, pylint, and others
Upgrade to Python 3.8, CDK v1.83 and latest version of pylint and other libraries. Due to requirements defined in aws-sam-cli, boto3 and botocore had to be set to 1.14.63 and 1.17.63 respectively. Upgrade of pylint resulted in new errors as listed below. These errors have been fixed as part of this commit too. ```bash find src/ -iname "*.py" | xargs pylint --rcfile .pylintrc ************* Module adf-build.organization_policy src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/organization_policy.py:23:0: R1721: Unnecessary use of a comprehension (unnecessary-comprehension) ************* Module adf-build.shared.cdk.cdk_stacks.main src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_stacks/main.py:86:16: R1724: Unnecessary "elif" after "continue" (no-else-continue) ************* Module adf-build.shared.cdk.clean_pipelines src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/clean_pipelines.py:77:16: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation) ************* Module adf-build.shared.python.parameter_store src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/parameter_store.py:66:12: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/parameter_store.py:82:12: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) ************* Module adf-build.shared.python.cloudformation src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/cloudformation.py:206:12: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) ************* Module adf-build.shared.python.organizations src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/organizations.py:160:12: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) ************* Module adf-build.shared.python.codepipeline src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/codepipeline.py:28:0: R1721: Unnecessary use of a comprehension (unnecessary-comprehension) ************* Module adf-build.shared.resolver src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/resolver.py:39:12: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/resolver.py:92:16: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) ************* Module main src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/provisioner/main.py:13:0: C0411: third party import "from organizations import Organizations" should be placed before "from src import read_config_files, delete_default_vpc, Support" (wrong-import-order) src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/provisioner/main.py:14:0: C0411: third party import "from logger import configure_logger" should be placed before "from src import read_config_files, delete_default_vpc, Support" (wrong-import-order) src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/provisioner/main.py:15:0: C0411: third party import "from parameter_store import ParameterStore" should be placed before "from src import read_config_files, delete_default_vpc, Support" (wrong-import-order) src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/provisioner/main.py:16:0: C0411: third party import "from sts import STS" should be placed before "from src import read_config_files, delete_default_vpc, Support" (wrong-import-order) ************* Module src.vpc src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/provisioner/src/vpc.py:60:16: W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) src/lambda_codebase/account/main.py:113:0: E0012: Bad option value 'bad-continuation' (bad-option-value) ```
1 parent 31f4719 commit 0a94366

53 files changed

Lines changed: 246 additions & 180 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Enable container based builds
2-
sudo: false
2+
dist: focal
33
language: python
44

55
python:
6-
- "3.7"
6+
- "3.8"
77

88
install:
9+
- nvm install
910
# Install the code requirements
1011
- make init
1112

docs/user-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pipelines:
125125
account_id: 111112233332
126126
build:
127127
provider: codebuild
128-
image: "STANDARD_2_0" # Use a specific docker image (defaults to Python 3.7) for the build stage in this pipeline -> https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-codebuild.LinuxBuildImage.html
128+
image: "STANDARD_4_0" # Use a specific docker image (supports Python 3.7 and Python 3.8) for the build stage in this pipeline -> https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-codebuild.LinuxBuildImage.html
129129
deploy:
130130
provider: codedeploy
131131
targets:
@@ -556,8 +556,8 @@ version: 0.2
556556
phases:
557557
install:
558558
runtime-versions:
559-
python: 3.7
560-
nodejs: 10
559+
python: 3.8
560+
nodejs: 12
561561
pre_build:
562562
commands:
563563
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet

requirements.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
tox==2.2.1
2-
pylint==2.2.2
3-
pytest==3.0.7
4-
isort==4.3.21
5-
mock==2.0.0
6-
boto3~=1.10, >=1.10.47
7-
pyyaml>=5.1
8-
astroid==2.1.0
9-
schema==0.7.1
1+
astroid~=2.4.2
2+
botocore==1.17.63
3+
boto3==1.14.63
4+
isort==5.6.4
5+
mock~=4.0.3
6+
pylint~=2.6.0
7+
pytest~=6.2.1
8+
pyyaml>=5.3
9+
schema~=0.7.2
10+
tox==3.20.1

samples/sample-cdk-app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This pipeline is expecting *(in the example case)* a AWS CodeCommit repository o
1414
build:
1515
provider: codebuild
1616
properties:
17-
image: "STANDARD_2_0"
17+
image: "STANDARD_4_0"
1818
targets:
1919
- /banking/testing
2020
- /banking/production

samples/sample-cdk-app/buildspec.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ version: 0.2
33
phases:
44
install:
55
runtime-versions:
6-
python: 3.7
7-
nodejs: 10
6+
python: 3.8
7+
nodejs: 12
88
commands:
99
- aws s3 cp s3://$S3_BUCKET_NAME/adf-build/ adf-build/ --recursive --quiet
1010
- pip install -r adf-build/requirements.txt -q

samples/sample-cdk-app/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class LambdaCronStack extends cdk.Stack {
1313
code: new lambda.InlineCode(fs.readFileSync('handler.py', { encoding: 'utf-8' })),
1414
handler: 'index.main',
1515
timeout: cdk.Duration.seconds(300),
16-
runtime: lambda.Runtime.PYTHON_3_7
16+
runtime: lambda.Runtime.PYTHON_3_8
1717
});
1818
// Run every day at 6PM UTC
1919
// See https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html

samples/sample-ec2-java-app-codedeploy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This example is coupled with the `sample-ec2-with-codedeploy` repository and is
1414
build:
1515
provider: codebuild
1616
properties:
17-
image: "STANDARD_2_0" # Since we're building a Java application here we want to use STANDARD_2_0 (Ubuntu) as our base CodeBuild Image, that way we can tell it to have Java ready for us so we can build, compile and test our application.
17+
image: "STANDARD_4_0" # Since we're building a Java application here we want to use STANDARD_4_0 (Ubuntu) as our base CodeBuild Image, that way we can tell it to have Java ready for us so we can build, compile and test our application.
1818
deploy:
1919
provider: codedeploy # We will deploy out application with AWS CodeDeploy.
2020
targets:

samples/sample-ec2-java-app-codedeploy/buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 0.2
33
phases:
44
install:
55
runtime-versions:
6-
java: openjdk8
6+
java: corretto8
77
build:
88
commands:
99
- mvn clean package --quiet

samples/sample-ec2-with-codedeploy/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ This stack also requires `sample-vpc` and `sample-iam` to be in deployed as it i
1919
provider: codecommit
2020
properties:
2121
account_id: 111111111111
22+
build:
23+
provider: codebuild
24+
properties:
25+
image: "STANDARD_4_0" # So we can specify which Python version we need
2226
targets:
2327
- /banking/testing
2428
- /banking/production

0 commit comments

Comments
 (0)