Skip to content

Commit b72b3c6

Browse files
committed
feat(regression/smoke-eu): added manually dispatched GHA for deployer-platform EU regression/smoke tests
1 parent 7cf994e commit b72b3c6

File tree

6 files changed

+160
-888
lines changed

6 files changed

+160
-888
lines changed

.github/workflows/nonregression-eu-apm.yml renamed to .github/workflows/nonregression-eu-dp.yml

Lines changed: 79 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,113 @@
1-
name: 'Non Regression Testing (EU) - APMs'
1+
name: Non Regression Testing (EU) (inactive)
22

33
on:
44
workflow_dispatch:
5-
6-
env:
7-
FOLDER: apm
5+
# schedule:
6+
# - cron: "0 9 * * 1-5"
7+
# push:
8+
# branches: [ main ]
89

910
jobs:
1011
log-context:
11-
name: Contexts
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: GitHub
14+
# Dump all contexts
15+
- name: Dump GitHub context
1516
env:
1617
GITHUB_CONTEXT: ${{ toJson(github) }}
1718
run: echo "$GITHUB_CONTEXT"
18-
- name: Runner
19+
- name: Dump job context
20+
env:
21+
JOB_CONTEXT: ${{ toJson(job) }}
22+
run: echo "$JOB_CONTEXT"
23+
- name: Dump steps context
24+
env:
25+
STEPS_CONTEXT: ${{ toJson(steps) }}
26+
run: echo "$STEPS_CONTEXT"
27+
- name: Dump runner context
1928
env:
2029
RUNNER_CONTEXT: ${{ toJson(runner) }}
2130
run: echo "$RUNNER_CONTEXT"
22-
23-
get-files:
24-
name: Test Definition Files
31+
- name: Dump strategy context
32+
env:
33+
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
34+
run: echo "$STRATEGY_CONTEXT"
35+
- name: Dump matrix context
36+
env:
37+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
38+
run: echo "$MATRIX_CONTEXT"
39+
get-test-definition-files:
40+
name: Get Test Definition Files
2541
runs-on: ubuntu-latest
2642
outputs:
27-
matrix: ${{ steps.get-files.outputs.result }}
43+
matrix: ${{ steps.get-test-definition-files.outputs.result }}
2844
steps:
2945
- name: Checkout Repo
30-
uses: actions/checkout@v3
46+
uses: actions/checkout@v2
3147
with:
3248
fetch-depth: 0
33-
- name: Get Files
34-
id: get-files
35-
uses: actions/github-script@v6
49+
- name: Get Test Definition Files
50+
id: get-test-definition-files
51+
uses: actions/github-script@v3
3652
with:
3753
script: |
38-
const fs = require('fs');
54+
const fs = require("fs");
3955
const fsp = fs.promises;
40-
const path = require('path');
56+
const path = require("path");
4157
42-
const { FOLDER } = process.env
58+
const { isOHIValidationTimeout } = require("${{ github.workspace }}/.github/workflows/scripts/ohiValidationTimeout");
4359
4460
// readdir recursive directory search
4561
const { readdir } = fsp;
4662
async function getFiles(dir) {
47-
const dirents = await readdir(dir, { withFileTypes: true });
48-
const files = await Promise.all(dirents.map((dirent) => {
49-
const res = path.join(dir, dirent.name);
50-
return dirent.isDirectory() ? getFiles(res) : res;
51-
}));
52-
return Array.prototype.concat(...files);
63+
const dirents = await readdir(dir, { withFileTypes: true });
64+
const files = await Promise.all(
65+
dirents.map((dirent) => {
66+
const res = path.join(dir, dirent.name);
67+
return dirent.isDirectory() ? getFiles(res) : res;
68+
})
69+
);
70+
return Array.prototype.concat(...files);
5371
}
54-
const definitionsDir = 'test/definitions-eu';
55-
const testDefinitions = await getFiles(definitionsDir + '/' + `${FOLDER}`);
5672
57-
const outputTestFilesMap = testDefinitions.map(testDefinitionFile => {
58-
return { testDefinitionFile, 'testDisplayName': testDefinitionFile.replace(`${definitionsDir}/`, '') }
59-
})
73+
const definitionsDir = "test/definitions-eu";
74+
const testDefinitions = await getFiles(definitionsDir);
75+
76+
const outputTestFilesMap = testDefinitions
77+
.filter((testDefinitionFile) => !isOHIValidationTimeout(testDefinitionFile))
78+
.map((testDefinitionFile) => {
79+
return {
80+
testDefinitionFile,
81+
testDisplayName: testDefinitionFile.replace(`${definitionsDir}/`, ""),
82+
};
83+
});
6084
const output = {
61-
"include": outputTestFilesMap
62-
}
85+
include: outputTestFilesMap,
86+
};
6387
console.log(output);
6488
return output;
6589
6690
test-deploy-recipe:
6791
name: ${{ matrix.testDisplayName }}
68-
needs: [get-files]
69-
if: ${{ fromJSON(needs.get-files.outputs.matrix).include[0] }} # Avoids empty matrix validation error
92+
needs: [get-test-definition-files]
93+
if: ${{ fromJSON(needs.get-test-definition-files.outputs.matrix).include[0] }} # Avoids empty matrix validation error
7094
runs-on: ubuntu-latest
7195
strategy:
72-
matrix: ${{ fromJSON(needs.get-files.outputs.matrix) }}
96+
matrix: ${{ fromJSON(needs.get-test-definition-files.outputs.matrix) }}
7397
fail-fast: false
7498
env:
7599
MATRIX: ${{ toJSON(matrix) }}
76100
steps:
77101
- name: Checkout Repo
78-
uses: actions/checkout@v3
102+
uses: actions/checkout@v2
79103
with:
80104
fetch-depth: 0
81105

82-
- name: Update Files URLs
83-
id: get-files
106+
- name: Update Test Definition Files URLs
107+
id: get-test-definition-files
84108
env:
85109
TEST_DEFINITION_FILE: ${{ matrix.testDefinitionFile }}
86-
uses: actions/github-script@v6
110+
uses: actions/github-script@v3
87111
with:
88112
script: |
89113
const fs = require('fs');
@@ -124,61 +148,33 @@ jobs:
124148
125149
return testDefinitionFile;
126150
127-
- name: Setup Certificate
128-
env:
129-
AWS_PEM: ${{ secrets.GIT_DEPLOYER_CANADA_AWS_PEM }}
130-
run: |
131-
mkdir -p configs
132-
rm -f configs/gitdeployerCanada.pem
133-
echo "$AWS_PEM" > configs/gitdeployerCanada.pem
134-
sudo chmod 400 configs/gitdeployerCanada.pem
135-
136-
- name: Write Tests Files
137-
env:
138-
USER_JSON: ${{ secrets.GIT_DEPLOYER_DOCKER_USER_CONFIG_EU }}
139-
run: |
140-
echo "$USER_JSON" > configs/gitusdkreu${{ github.run_id }}.json
141-
142-
- name: Pull Deployer Image
143-
run: |
144-
docker pull newrelic/deployer:latest
145-
docker images newrelic/deployer:latest
146-
147-
- name: Run Deployer
148-
id: deployerRun
149-
run: |
150-
set -e
151-
testDefinitionFile=$(echo $MATRIX | jq -c -r '.testDefinitionFile')
152-
echo $testDefinitionFile
153-
docker run -i\
154-
-v ${{ github.workspace }}/configs/:/mnt/deployer/configs/\
155-
-v ${{ github.workspace }}/test/:/mnt/deployer/test/\
156-
--entrypoint ruby newrelic/deployer:latest main.rb -c configs/gitusdkreu${{ github.run_id }}.json -d $testDefinitionFile -l debug
157-
echo ::set-output name=exit_status::$?
151+
- name: Install npm dependencies for deployer test runner
152+
working-directory: .github/workflows/scripts/deployer-platform
153+
run: npm install
158154

159-
- name: Teardown Deployment
160-
if: always()
161-
id: cleanupResources
162-
continue-on-error: true
155+
- name: Execute test
156+
id: runDeployerPlatformTest
157+
working-directory: .github/workflows/scripts/deployer-platform
163158
run: |
164-
testDefinitionFile=$(echo $MATRIX | jq -c -r '.testDefinitionFile')
165-
echo $testDefinitionFile
166-
docker run \
167-
-v ${{ github.workspace }}/configs/:/mnt/deployer/configs/\
168-
-v ${{ github.workspace }}/test/:/mnt/deployer/test/\
169-
--entrypoint ruby newrelic/deployer:latest main.rb -c configs/gitusdkreu${{ github.run_id }}.json -d $testDefinitionFile -t
159+
node main.js
160+
env:
161+
TEST_DEFINITION_FILE: ${{ matrix.testDefinitionFile }}
162+
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYER_PLATFORM_EU_AWS_ACCESS_KEY_ID }}
163+
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYER_PLATFORM_EU_AWS_SECRET_ACCESS_KEY }}
164+
AWS_REGION: ${{ secrets.DEPLOYER_PLATFORM_EU_AWS_REGION }}
165+
SQS_URL: ${{ secrets.DEPLOYER_PLATFORM_EU_SQS_URL }}
166+
DYNAMO_TABLE: ${{ secrets.DEPLOYER_PLATFORM_EU_DYNAMO_TABLE }}
170167

171-
- name: Error Reporting
172-
if: steps.deployerRun.outputs.exit_status != 0
168+
- name: Report any error
169+
if: steps.runDeployerPlatformTest.outputs.exit_status != 0
173170
run: exit 1
174171

175172
slack-notify:
176-
name: Slack
177173
runs-on: ubuntu-latest
178174
needs: [test-deploy-recipe]
179175
if: always()
180176
steps:
181-
- name: Build Result Notification
177+
- name: Build Result Slack Notification
182178
uses: 8398a7/action-slack@v3
183179
with:
184180
author_name: GitHub Actions

0 commit comments

Comments
 (0)