-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
77 lines (74 loc) · 2.13 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Lambda that adds a weekly build schedule to bitbucket repositories associated with services that are not actively being developed.
Parameters:
AppName:
Type: String
Default: "weekly-build-scheduler"
AllowedPattern: ^[-a-z]+$
Description: "Note: Must be all lowercase"
EnvName:
Type: String
Default: "dev"
AllowedPattern: ^[-a-z]+$
Description: "Note: Must be all lowercase"
DryRun:
Type: String
AllowedValues:
- "true"
- "false"
Default: "false"
Description: "Note: Must be all lowercase"
Verbose:
Type: String
AllowedValues:
- "true"
- "false"
Default: "false"
Description: "Note: Must be all lowercase"
BBAPPPASS:
Type: String
Description: "Bitbucket app password"
BBUSERID:
Type: String
Description: "Bitbucket user Id"
DDAPIKEY:
Type: String
Description: "Datadog API key"
DDAPPKEY:
Type: String
Description: "Datadog app key"
Conditions:
EnableSchedule: !Equals
- !Ref EnvName
- prod
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Ref AppName
Handler: weekly_build_scheduler.lambda_handler
Runtime: python3.11
CodeUri: lambda/
Description: Lambda that adds a weekly build schedule to bitbucket repositories associated with services that are not actively being developed.
MemorySize: 128
Timeout: 900
Environment:
Variables:
BB_APP_PASS:
!Ref BBAPPPASS
BB_USER_ID:
!Ref BBUSERID
DD_API_KEY:
!Ref DDAPIKEY
DD_APP_KEY:
!Ref DDAPPKEY
Events:
ScheduledRule:
Type: Schedule
Properties:
Description: # A description for this event (e.g. "Run every Friday at 9am")
Schedule: # Schedule in cron format (e.g. "cron(0 13 ? * 6 *)")
State: !If [EnableSchedule, "ENABLED", "DISABLED"]
Input: !Sub "{\"dry_run\": ${DryRun},
\"verbose\": ${Verbose}}"