Skip to content

Commit df2e596

Browse files
authored
Upgrade dependencies (CDK, Pylint, and others) (#364)
* Fix duplicate notification endpoint setup in pipeline generation **Why?** When generating a pipeline, the code optimization introduced by PR #285 broke the notification_endpoint configuration. When set, it would try to configure the notification in the main generator as well as in the default ADF pipeline generator. **What?** Removing the notification endpoint configuration from the main template, as that is replaced by the default ADF pipeline generator implementation. * Upgrade to latest CDK, pylint, and others Upgrade to CDK v1.105 and latest version of pylint and other libraries. Upgrade of pylint resulted in new errors as listed below. These errors have been fixed as part of this commit too.
1 parent da7ac5f commit df2e596

14 files changed

Lines changed: 106 additions & 105 deletions

File tree

requirements.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
astroid~=2.4.2
2-
botocore==1.17.63
3-
boto3==1.14.63
4-
isort==5.6.4
1+
astroid~=2.5.6
2+
botocore==1.20.74
3+
boto3==1.17.74
4+
isort==5.8.0
55
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
6+
pylint~=2.8.2
7+
pytest~=6.2.4
8+
pyyaml>=5.4.1
9+
schema~=0.7.4
10+
tox==3.23.1

src/lambda_codebase/initial_commit/bootstrap_repository/adf-bootstrap/deployment/global.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ Resources:
672672
nodejs: 12
673673
pre_build:
674674
commands:
675-
- npm install cdk@1.88 -g -y --quiet --no-progress
675+
- npm install cdk@1.105 -g -y --quiet --no-progress
676676
- aws s3 cp s3://$SHARED_MODULES_BUCKET/adf-build/ ./adf-build/ --recursive --quiet
677677
- pip install -r adf-build/requirements.txt -q -t ./adf-build
678678
build:
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Jinja2~=2.11.3
2-
boto3==1.14.63
2+
boto3==1.17.74
33
cfn-custom-resource~=1.0.1

src/lambda_codebase/initial_commit/bootstrap_repository/adf-bootstrap/deployment/lambda_codebase/slack.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ def send_message(url, payload):
133133
data=params,
134134
headers={'content-type': 'application/json'}
135135
)
136-
return urllib.request.urlopen(req)
136+
with urllib.request.urlopen(req) as response:
137+
return response.read()
137138

138139
def lambda_handler(event, _):
139140
message = extract_message(event)

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/organization_policy.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ def apply(self, organizations, parameter_store, config): # pylint: disable=R091
161161
path)
162162
organizations.attach_policy(
163163
policy_id, organization_mapping[path])
164+
except organizations.client.exceptions.DuplicatePolicyAttachmentException:
165+
LOGGER.info(
166+
'Policy (%s) for %s exists and is attached already.',
167+
policy,
168+
organization_mapping[path])
164169
except organizations.client.exceptions.DuplicatePolicyException:
165170
LOGGER.info(
166171
'Policy (%s) for %s exists ensuring attached.',
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Install libs here that you might want in AWS CodeBuild (On Master Account)
2-
astroid~=2.4.2
3-
aws-sam-cli==1.15.0
4-
awscli==1.18.140
5-
boto3==1.14.63
6-
botocore==1.17.63
7-
jsii<1.20.0,>=1.16.0
2+
astroid~=2.5.6
3+
aws-sam-cli==1.23.0
4+
awscli==1.19.74
5+
boto3==1.17.74
6+
botocore==1.20.74
87
mock~=4.0.3
9-
pip~=20.2.3
10-
pylint~=2.6.0
11-
pytest~=6.2.1
12-
pyyaml>=5.3
13-
six~=1.15.0
8+
pip~=21.1.1
9+
pylint~=2.8.2
10+
pytest~=6.2.4
11+
pyyaml>=5.4.1
12+
six~=1.16.0
1413
tenacity==6.3.0
1514
urllib3~=1.25.11

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_stacks/main.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from aws_cdk import (
88
core
99
)
10-
from cdk_constructs import adf_notifications
1110
from logger import configure_logger
1211

1312
from cdk_stacks.adf_default_pipeline import generate_adf_default_pipeline as generate_default_pipeline, PIPELINE_TYPE as DEFAULT_PIPELINE
@@ -21,9 +20,6 @@ def __init__(self, scope: core.Construct, stack_input: dict, **kwargs) -> None:
2120
LOGGER.info('Pipeline creation/update of %s commenced', stack_input['input']['name'])
2221
_pipeline_type = stack_input['input'].get('params', {}).get('type', DEFAULT_PIPELINE).lower()
2322

24-
if stack_input['input'].get('params', {}).get('notification_endpoint'):
25-
stack_input['input']["topic_arn"] = adf_notifications.Notifications(self, 'adf_notifications', stack_input['input']).topic_arn
26-
2723
self.generate_pipeline(_pipeline_type, stack_input)
2824

2925
def generate_pipeline(self, _pipeline_type, stack_input):

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/generate_params.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def _parse(filename):
113113
return yaml.load(file, Loader=yaml.FullLoader)
114114
except yaml.scanner.ScannerError:
115115
LOGGER.exception('Invalid Yaml for %s.yml', filename)
116+
raise
116117
except FileNotFoundError:
117118
return {'Parameters': {}, 'Tags': {}}
118119

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
boto3==1.14.63
2-
botocore==1.17.63
1+
botocore==1.20.74
2+
boto3==1.17.74
33
docopt~=0.6.2

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/cloudformation.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,27 +224,25 @@ def _change_set_failed_due_to_empty(status, reason):
224224

225225
def _update_stack_termination_protection(self):
226226
try:
227-
return self.client.update_termination_protection(
227+
self.client.update_termination_protection(
228228
EnableTerminationProtection=STACK_TERMINATION_PROTECTION == "True",
229229
StackName=self.stack_name
230230
)
231231
except ClientError as e:
232232
LOGGER.error(
233233
'%s | %s, Error: %s',
234234
self.account_id, self.stack_name, e)
235-
pass
236235

237236
def _delete_change_set(self):
238237
try:
239-
return self.client.delete_change_set(
238+
self.client.delete_change_set(
240239
ChangeSetName=self.stack_name,
241240
StackName=self.stack_name
242241
)
243-
except ClientError as e:
242+
except ClientError as client_error:
244243
LOGGER.info(
245244
'%s | %s, Error: %s',
246-
self.account_id, self.stack_name, e)
247-
pass
245+
self.account_id, self.stack_name, client_error)
248246

249247
def _execute_change_set(self, waiter):
250248
LOGGER.info(

0 commit comments

Comments
 (0)