Skip to content

Commit 19e2eb2

Browse files
authored
[NR-383508] Fix validate template code in CI/CD (#29)
* fixed validate template step and lambda-template.yaml validate errors * removed slack notification and made e2e tests run on pull request * added develop branch to test e2e tests * removing changes made for testing
1 parent e10d43b commit 19e2eb2

File tree

3 files changed

+39
-65
lines changed

3 files changed

+39
-65
lines changed

.github/workflows/pull_request.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
- name: Install AWS SAM CLI
1717
run: |
18-
pip install aws-sam-cli
18+
pip install aws-sam-cli==1.134.0
1919
2020
- name: Install golint
2121
run: |
@@ -57,7 +57,7 @@ jobs:
5757
5858
- name: Validate SAM Templates
5959
run: |
60-
for template in $(find . -name ".yaml" -o -name ".yml"); do
60+
for template in $(find . -maxdepth 1 \( -name "*.yaml" -o -name "*.yml" \)); do
6161
echo "Validating template: $template"
6262
sam validate --template-file "$template" --region us-east-2 --lint
6363
done

lambda-template.yaml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -76,69 +76,6 @@ Conditions:
7676
AddCloudwatchTrigger: !Not [ !Equals [!Ref LogGroupConfig , ""]]
7777
IsCommonAttributesNotBlank: !Not [!Equals [!Ref CommonAttributes, ""]]
7878

79-
Mappings:
80-
RegionToS3Bucket:
81-
us-east-1:
82-
BucketArn: 'unified-logging-lambda-code-us-east-1'
83-
us-east-2:
84-
BucketArn: 'unified-logging-lambda-code-us-east-2'
85-
eu-west-1:
86-
BucketArn: 'unified-logging-lambda-code-eu-west-1'
87-
eu-west-2:
88-
BucketArn: 'unified-logging-lambda-code-eu-west-2'
89-
us-west-1:
90-
BucketArn: 'unified-logging-lambda-code-us-west-1'
91-
us-west-2:
92-
BucketArn: 'unified-logging-lambda-code-us-west-2'
93-
af-south-1:
94-
BucketArn: 'unified-logging-lambda-code-af-south-1'
95-
ap-south-1:
96-
BucketArn: 'unified-logging-lambda-code-ap-south-1'
97-
ap-northeast-3:
98-
BucketArn: 'unified-logging-lambda-code-ap-northeast-3'
99-
ap-northeast-2:
100-
BucketArn: 'unified-logging-lambda-code-ap-northeast-2'
101-
ap-southeast-1:
102-
BucketArn: 'unified-logging-lambda-code-ap-southeast-1'
103-
ap-southeast-2:
104-
BucketArn: 'unified-logging-lambda-code-ap-southeast-2'
105-
ap-northeast-1:
106-
BucketArn: 'unified-logging-lambda-code-ap-northeast-1'
107-
ca-central-1:
108-
BucketArn: 'unified-logging-lambda-code-ca-central-1'
109-
ca-west-1:
110-
BucketArn: 'unified-logging-lambda-code-ca-west-1'
111-
eu-central-1:
112-
BucketArn: 'unified-logging-lambda-code-eu-central-1'
113-
eu-south-1:
114-
BucketArn: 'unified-logging-lambda-code-eu-south-1'
115-
eu-west-3:
116-
BucketArn: 'unified-logging-lambda-code-eu-west-3'
117-
eu-south-2:
118-
BucketArn: 'unified-logging-lambda-code-eu-south-2'
119-
eu-north-1:
120-
BucketArn: 'unified-logging-lambda-code-eu-north-1'
121-
eu-central-2:
122-
BucketArn: 'unified-logging-lambda-code-eu-central-2'
123-
me-south-1:
124-
BucketArn: 'unified-logging-lambda-code-me-south-1'
125-
me-central-1:
126-
BucketArn: 'unified-logging-lambda-code-me-central-1'
127-
ap-east-1:
128-
BucketArn: 'unified-logging-lambda-code-ap-east-1'
129-
ap-south-2:
130-
BucketArn: 'unified-logging-lambda-code-ap-south-2'
131-
ap-southeast-3:
132-
BucketArn: 'unified-logging-lambda-code-ap-southeast-3'
133-
ap-southeast-5:
134-
BucketArn: 'unified-logging-lambda-code-ap-southeast-5'
135-
ap-southeast-4:
136-
BucketArn: 'unified-logging-lambda-code-ap-southeast-4'
137-
il-central-1:
138-
BucketArn: 'unified-logging-lambda-code-il-central-1'
139-
sa-east-1:
140-
BucketArn: 'unified-logging-lambda-code-sa-east-1'
141-
14279
Resources:
14380
NewRelicLogsLicenseKeySecret:
14481
Type: 'AWS::SecretsManager::Secret'

workflow-scripts/update_lambda_template.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,43 @@
1616
'Key': "new-relic-log-forwarder-folder/new-relic-log-forwarder.zip"
1717
}
1818

19+
mappings = {
20+
'RegionToS3Bucket': {
21+
'us-east-1': {'BucketArn': 'unified-logging-lambda-code-us-east-1'},
22+
'us-east-2': {'BucketArn': 'unified-logging-lambda-code-us-east-2'},
23+
'eu-west-1': {'BucketArn': 'unified-logging-lambda-code-eu-west-1'},
24+
'eu-west-2': {'BucketArn': 'unified-logging-lambda-code-eu-west-2'},
25+
'us-west-1': {'BucketArn': 'unified-logging-lambda-code-us-west-1'},
26+
'us-west-2': {'BucketArn': 'unified-logging-lambda-code-us-west-2'},
27+
'af-south-1': {'BucketArn': 'unified-logging-lambda-code-af-south-1'},
28+
'ap-south-1': {'BucketArn': 'unified-logging-lambda-code-ap-south-1'},
29+
'ap-northeast-3': {'BucketArn': 'unified-logging-lambda-code-ap-northeast-3'},
30+
'ap-northeast-2': {'BucketArn': 'unified-logging-lambda-code-ap-northeast-2'},
31+
'ap-southeast-1': {'BucketArn': 'unified-logging-lambda-code-ap-southeast-1'},
32+
'ap-southeast-2': {'BucketArn': 'unified-logging-lambda-code-ap-southeast-2'},
33+
'ap-northeast-1': {'BucketArn': 'unified-logging-lambda-code-ap-northeast-1'},
34+
'ca-central-1': {'BucketArn': 'unified-logging-lambda-code-ca-central-1'},
35+
'ca-west-1': {'BucketArn': 'unified-logging-lambda-code-ca-west-1'},
36+
'eu-central-1': {'BucketArn': 'unified-logging-lambda-code-eu-central-1'},
37+
'eu-south-1': {'BucketArn': 'unified-logging-lambda-code-eu-south-1'},
38+
'eu-west-3': {'BucketArn': 'unified-logging-lambda-code-eu-west-3'},
39+
'eu-south-2': {'BucketArn': 'unified-logging-lambda-code-eu-south-2'},
40+
'eu-north-1': {'BucketArn': 'unified-logging-lambda-code-eu-north-1'},
41+
'eu-central-2': {'BucketArn': 'unified-logging-lambda-code-eu-central-2'},
42+
'me-south-1': {'BucketArn': 'unified-logging-lambda-code-me-south-1'},
43+
'me-central-1': {'BucketArn': 'unified-logging-lambda-code-me-central-1'},
44+
'ap-east-1': {'BucketArn': 'unified-logging-lambda-code-ap-east-1'},
45+
'ap-south-2': {'BucketArn': 'unified-logging-lambda-code-ap-south-2'},
46+
'ap-southeast-3': {'BucketArn': 'unified-logging-lambda-code-ap-southeast-3'},
47+
'ap-southeast-5': {'BucketArn': 'unified-logging-lambda-code-ap-southeast-5'},
48+
'ap-southeast-4': {'BucketArn': 'unified-logging-lambda-code-ap-southeast-4'},
49+
'il-central-1': {'BucketArn': 'unified-logging-lambda-code-il-central-1'},
50+
'sa-east-1': {'BucketArn': 'unified-logging-lambda-code-sa-east-1'},
51+
}
52+
}
53+
54+
data['Mappings'] = mappings
55+
1956
with open(file_path, 'w') as file:
2057
yaml.dump(data, file)
2158

0 commit comments

Comments
 (0)