forked from cds-snc/notification-api
-
Notifications
You must be signed in to change notification settings - Fork 9
115 lines (99 loc) · 6.32 KB
/
lambda-functions.yml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# How to package Python dependencies:
# https://docs.aws.amazon.com/lambda/latest/dg/python-package.html
name: Build and Deploy Lambda Functions
on:
workflow_call:
inputs:
environment:
description: "Environment to provision (dev|staging|perf|prod}"
required: false
default: dev
type: string
ref:
description: "Branch to deploy from"
required: true
default: main
type: string
lambdaName:
description: "Lambda to deploy"
required: false
default: "All"
type: string
env:
AWS_ACCESS_KEY_ID: ${{ secrets.VAEC_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.VAEC_AWS_SECRET_ACCESS_KEY }}
jobs:
# All of the lambda functions use layers for dependencies, if any. Bundling dependencies should not be necessary.
build-and-deploy-lambda-functions:
runs-on: ${{ vars.RUNS_ON }}
defaults:
run:
working-directory: "./lambda_functions"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.VAEC_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.VAEC_AWS_SECRET_ACCESS_KEY }}
aws-region: us-gov-west-1
role-to-assume: ${{ secrets.VAEC_DEPLOY_ROLE }}
role-skip-session-tagging: true
role-duration-seconds: 1800
- name: Package and deploy SES Callback lambda function
if: ${{ (inputs.lambdaName == 'SESCallback') || (inputs.lambdaName == 'All') }}
run: |
zip -j ses_callback_lambda ses_callback/ses_callback_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-ses-callback-lambda --zip-file fileb://ses_callback_lambda.zip
- name: Package and deploy Two Way SMS lambda function v1
if: ${{ (inputs.lambdaName == 'TwoWaySMS') || (inputs.lambdaName == 'All') }}
run: |
zip -j two_way_sms_lambda two_way_sms/two_way_sms_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-two-way-sms-lambda --zip-file fileb://two_way_sms_lambda.zip
- name: Package and deploy Two Way SMS lambda function v2
if: ${{ (inputs.lambdaName == 'TwoWaySMS') || (inputs.lambdaName == 'All') }}
run: |
zip -j two_way_sms two_way_sms/two_way_sms_v2.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-notify-incoming-sms-lambda --zip-file fileb://two_way_sms.zip
- name: Package and deploy pinpoint callback lambda function
if: ${{ (inputs.lambdaName == 'PinPointCallback') || (inputs.lambdaName == 'All') }}
run: |
zip -j pinpoint_callback_lambda pinpoint_callback/pinpoint_callback_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-pinpoint-callback-lambda --zip-file fileb://pinpoint_callback_lambda.zip
- name: Package and deploy pinpoint inbound sms lambda function
if: ${{ (inputs.lambdaName == 'PinPointInboundSMS') || (inputs.lambdaName == 'All') }}
run: |
zip -j pinpoint_inbound_sms_lambda pinpoint_inbound_sms/pinpoint_inbound_sms_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-pinpoint-inbound-sms-lambda --zip-file fileb://pinpoint_inbound_sms_lambda.zip
- name: Package and deploy VA Profile opt-in/out lambda function
if: ${{ (inputs.lambdaName == 'ProfileOptInOut') || (inputs.lambdaName == 'All') }}
run: |
zip -j va_profile_opt_in_out_lambda va_profile/va_profile_opt_in_out_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-va-profile-opt-in-out-lambda --zip-file fileb://va_profile_opt_in_out_lambda.zip
- name: Package and deploy VA Profile remove old opt-outs lambda function
if: ${{ (inputs.lambdaName == 'ProfileRemoveOldOptOuts') || (inputs.lambdaName == 'All') }}
run: |
zip -j va_profile_remove_old_opt_outs_lambda va_profile_remove_old_opt_outs/va_profile_remove_old_opt_outs_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-va-profile-remove-old-opt-outs-lambda --zip-file fileb://va_profile_remove_old_opt_outs_lambda.zip
- name: Package and deploy nightly stats bigquery upload lambda function
if: ${{ (inputs.lambdaName == 'NightBigQueryUpload') || (inputs.lambdaName == 'All') }}
run: |
zip -j nightly_stats_bigquery_upload_lambda nightly_stats_bigquery_upload/nightly_stats_bigquery_upload_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-nightly-stats-bigquery-upload-lambda --zip-file fileb://nightly_stats_bigquery_upload_lambda.zip
- name: Package and deploy nightly billing stats upload lambda function
if: ${{ (inputs.lambdaName == 'NightBillingBQUpload') || (inputs.lambdaName == 'All') }}
run: |
zip -j nightly_billing_stats_upload_lambda nightly_billing_bigquery_upload/nightly_billing_stats_upload_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-nightly-billing-stats-upload-lambda --zip-file fileb://nightly_billing_stats_upload_lambda.zip
- name: Package and deploy vetext incoming forwarder lambda
if: ${{ (inputs.lambdaName == 'VetTextIncomingForwarder') || (inputs.lambdaName == 'All') }}
run: |
zip -j vetext_incoming_forwarder_lambda vetext_incoming_forwarder_lambda/vetext_incoming_forwarder_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-vetext-incoming-forwarder-lambda --zip-file fileb://vetext_incoming_forwarder_lambda.zip
- name: Package and deploy delivery status processing lambda
if: ${{ (inputs.lambdaName == 'DeliveryStatusProcessor') || (inputs.lambdaName == 'All') }}
run: |
zip -j delivery_status_processor_lambda delivery_status_processor_lambda/delivery_status_processor_lambda.py
aws lambda update-function-code --function-name project-${{ inputs.environment }}-delivery-status-processor-lambda --zip-file fileb://delivery_status_processor_lambda.zip