Skip to content

Commit a71a0e5

Browse files
author
Alexander Melnyk
committed
chore(ci): reduce payload and only send prod notification
1 parent 8abf6ec commit a71a0e5

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

layer/app.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,22 @@
1212

1313
if not POWERTOOLS_VERSION:
1414
raise ValueError(
15-
"Please set the version for Powertools by passing the '--context=version:<version>' parameter to the CDK "
15+
"Please set the version for Powertools by passing the '--context version=<version>' parameter to the CDK "
1616
"synth step."
1717
)
1818

19-
LayerStack(app, "LayerStack", powertools_version=POWERTOOLS_VERSION, ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN)
20-
21-
CanaryStack(app, "CanaryStack", powertools_version=POWERTOOLS_VERSION, ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN)
19+
LayerStack(
20+
app,
21+
"LayerStack",
22+
powertools_version=POWERTOOLS_VERSION,
23+
ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN,
24+
)
25+
26+
CanaryStack(
27+
app,
28+
"CanaryStack",
29+
powertools_version=POWERTOOLS_VERSION,
30+
ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN,
31+
)
2232

2333
app.synth()

layer/layer/canary/app.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def on_create(event):
4242

4343

4444
def check_envs():
45-
logger.info('Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]')
45+
logger.info(
46+
'Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]'
47+
)
4648
if not layer_arn:
4749
raise ValueError("POWERTOOLS_LAYER_ARN is not set. Aborting...")
4850
if not powertools_version:
@@ -73,17 +75,20 @@ def send_notification():
7375
"""
7476
sends an event to version tracking event bridge
7577
"""
78+
if stage != "PROD":
79+
logger.info(
80+
"Not sending notification to event bus, because this is not the PROD stage"
81+
)
82+
return
7683
event = {
7784
"Time": datetime.datetime.now(),
7885
"Source": "powertools.layer.canary",
7986
"EventBusName": event_bus_arn,
8087
"DetailType": "deployment",
8188
"Detail": json.dumps(
8289
{
83-
"id": "powertools-python",
84-
"stage": stage,
85-
"region": os.environ["AWS_REGION"],
8690
"version": powertools_version,
91+
"region": os.environ["AWS_REGION"],
8792
"layerArn": layer_arn,
8893
}
8994
),

0 commit comments

Comments
 (0)