Skip to content

Commit 1d9923d

Browse files
feat(ci): JP region test infrastructure + region-aware validation.yml
## What this PR does - **JP region test infrastructure** — clones `test/definitions-eu/` → `test/definitions-jp/` and adds matching workflows (`smoke-jp.yml`, `nonregression-jp.yml`, `cleanup-jp.yml`, `*-dp` variants) with the region rewrites (URLs, `*_JP` secret refs, `open-install-library-e2e-jp` identity name, `ap-northeast-1`). - **Region-aware `validation.yml`** — splits the per-PR test-deploy matrix by path: `definitions/*` → US, `definitions-eu/*` → EU NerdGraph + EU secret, `definitions-jp/*` → JP NerdGraph + JP secret. Adds `create-system-identity-{eu,jp}` and `cleanup-system-identity-{eu,jp}` jobs; matrix builder now uses `--diff-filter=AMR` so deleted files don't enter the matrix. - **Cross-region coverage parity** — added modern infra-agent OSes (Debian 11–13, Ubuntu 20/22/24, RHEL 9/10, Amazon Linux 2023, SUSE 15.4/5/7), OHI (Redis, RabbitMQ, Elasticsearch), and modern PHP (Ubuntu 22 fpm-wordpress) to both EU and JP. Bumped Debian 10→12 where deprecated, replaced Oracle 8 with RHEL 9, bumped redhat9-infra to `t3.small` for boot reliability, bumped dotnet ASP.NET runtime 5.0→8.0. - **CrowdStrike removal** — deletes the no-op install stub + its only test consumer + the env-block references in `nonregression*.yml` (companion to deployer #33; [NR-520645](https://new-relic.atlassian.net/browse/NR-520645)). Backing deployer bundle is being removed separately; repo `CROWDSTRIKE_*` secrets can be deleted afterwards. - **Flake/transient resilience** — retry-wrappers around `docker pull newrelic/deployer:latest`, the Apache `a2enmod` step in the dotnet deploy (start.yml), and `apt install` on Ubuntu 18 EOL mirrors in PHP-WordPress (configure.yml). Same `register`/`until`/`retries`/`delay` pattern used for the mvn retry in github.com/newrelic/demo-javatron/issues/48. - **End-to-end NRQL verification** — run [`27671298270`](https://github.com/newrelic/open-install-library/actions/runs/27671298270) is fully green (94/96, 0 failures). AGENT entities + `FLEET → AGENT (CONTAINS)` relationships were observed via `NrAuditEvent` in EU NR (account 6729572) and JP NR (account 8163026), each inside the matching test window. Evidence in the [PR comment](#1377 (comment)). - **Synced with `main`** — pulled agent-control 1.16.1 → 1.17.0 from #1381 (clean auto-merge). ## Prerequisites 1. newrelic-experimental/deployer#32 (merged) + image republish so `newrelic/deployer:latest` includes the `jp:` block under `newRelicUrls`. 2. GitHub repo secrets: `GIT_DEPLOYER_DOCKER_USER_CONFIG_JP` (with `credentials.secrets.{nrHostFleetId, nrWindowsHostFleetId}` populated for the JP fleets) — verified live in run 27671298270. 3. `gitdeployerCanada` keypair imported into AWS region `ap-northeast-1`. ## Companion PRs - Deployer JP region: newrelic-experimental/deployer#32 (merged) - Deployer CrowdStrike removal: newrelic-experimental/deployer#33 - newrelic-cli JP workflows: newrelic/newrelic-cli#1851 [NR-520645]: https://new-relic.atlassian.net/browse/NR-520645?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 98b91c6 commit 1d9923d

103 files changed

Lines changed: 5021 additions & 85 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/deprecated-tests.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
{
22
"exclude": [
3-
"test/definitions-eu/apm/dotNet/linux/debian10-nginx-aspnetcore.json",
43
"test/definitions-eu/apm/dotNet/linux/ubuntu20-apache-aspnetcore.json",
54
"test/definitions-eu/apm/dotNet/windows/iis-blank.json",
65
"test/definitions-eu/apm/dotNet/windows/windows2016-iis.json",
76
"test/definitions-eu/apm/dotNet/windows/windows2019-core-only-iis.json",
87
"test/definitions-eu/apm/dotNet/windows/windows2019-iis.json",
9-
"test/definitions-eu/apm/java/deb10-supd-javatron.json",
10-
"test/definitions-eu/apm/java/deb10-sysd-custom-sh.json",
11-
"test/definitions-eu/apm/java/deb10-sysd-tomcat-cmd.json",
12-
"test/definitions-eu/apm/java/deb10-sysd-tomcat-sh.json",
138
"test/definitions-eu/apm/java/deb11-apt-sysd-tomcat.json",
149
"test/definitions-eu/apm/java/deb11-jetty.json",
1510
"test/definitions-eu/apm/java/deb11-sysd-jboss.json",

.github/workflows/cleanup-jp.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Cleanup (JP)
2+
3+
on:
4+
workflow_run:
5+
workflows: [Non Regression Testing (JP)]
6+
types: [completed]
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
workflow_run_id: ${{ github.event.workflow_run.id }}
13+
config_name: gitusdkrjp${{ github.event.workflow_run.id }}.json
14+
path: test/definitions-jp/
15+
16+
jobs:
17+
clean-all:
18+
name: Cleaner
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Debug run_id
22+
run: |
23+
echo "Debugging env vars here"
24+
echo "workflow_run_id:"$workflow_run_id
25+
echo "config_name:"$config_name
26+
echo "path":$path
27+
28+
- name: Checkout Repo
29+
uses: actions/checkout@v2
30+
31+
- name: Write AWS Certificate to File
32+
env:
33+
AWS_PEM: ${{ secrets.GIT_DEPLOYER_CANADA_AWS_PEM }}
34+
run: |
35+
mkdir -p configs
36+
rm -f configs/gitdeployerCanada.pem
37+
echo "$AWS_PEM" > configs/gitdeployerCanada.pem
38+
sudo chmod 400 configs/gitdeployerCanada.pem
39+
40+
- name: Write Test Definition File JSON to file
41+
env:
42+
USER_JSON: ${{ secrets.GIT_DEPLOYER_DOCKER_USER_CONFIG_JP }}
43+
run: |
44+
echo "$USER_JSON" > configs/$config_name
45+
46+
- name: Pull Deployer image
47+
run: |
48+
docker pull newrelic/deployer:latest
49+
docker images newrelic/deployer:latest
50+
51+
- name: Teardown all resources
52+
run: |
53+
docker run -i\
54+
-v ${{ github.workspace }}/configs/:/mnt/deployer/configs/\
55+
-v ${{ github.workspace }}/test/:/mnt/deployer/test/\
56+
--entrypoint ruby newrelic/deployer:latest batch.rb -c configs/$config_name -d $path -s 20 -m teardown

.github/workflows/nonregression-eu.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,29 +258,19 @@ jobs:
258258
259259
- name: Run deployer
260260
id: deployerRun
261-
env:
262-
CROWDSTRIKE_CLIENT_ID: ${{ secrets.CROWDSTRIKE_CLIENT_ID }}
263-
CROWDSTRIKE_CLIENT_SECRET: ${{ secrets.CROWDSTRIKE_CLIENT_SECRET }}
264-
CROWDSTRIKE_CUSTOMER_ID: ${{ secrets.CROWDSTRIKE_CUSTOMER_ID }}
265261
run: |
266262
set -e
267263
testDefinitionFile=$(echo $MATRIX | jq -c -r '.testDefinitionFile')
268264
echo $testDefinitionFile
269265
if [[ "$testDefinitionFile" == test/definitions/agent-control/* || "$testDefinitionFile" == test/definitions-eu/agent-control/* ]]; then
270266
docker run -i\
271-
-e CROWDSTRIKE_CUSTOMER_ID=$CROWDSTRIKE_CUSTOMER_ID\
272-
-e CROWDSTRIKE_CLIENT_ID=$CROWDSTRIKE_CLIENT_ID\
273-
-e CROWDSTRIKE_CLIENT_SECRET=$CROWDSTRIKE_CLIENT_SECRET\
274267
-e SYSTEM_IDENTITY_CLIENT_ID=$SYSTEM_IDENTITY_CLIENT_ID\
275268
-e SYSTEM_IDENTITY_CLIENT_SECRET=$SYSTEM_IDENTITY_CLIENT_SECRET\
276269
-v ${{ github.workspace }}/configs/:/mnt/deployer/configs/\
277270
-v ${{ github.workspace }}/test/:/mnt/deployer/test/\
278271
--entrypoint ruby newrelic/deployer:latest main.rb -c configs/gitusdkreu${{ github.run_id }}.json -d $testDefinitionFile -l debug
279272
else
280273
docker run -i\
281-
-e CROWDSTRIKE_CUSTOMER_ID=$CROWDSTRIKE_CUSTOMER_ID\
282-
-e CROWDSTRIKE_CLIENT_ID=$CROWDSTRIKE_CLIENT_ID\
283-
-e CROWDSTRIKE_CLIENT_SECRET=$CROWDSTRIKE_CLIENT_SECRET\
284274
-v ${{ github.workspace }}/configs/:/mnt/deployer/configs/\
285275
-v ${{ github.workspace }}/test/:/mnt/deployer/test/\
286276
--entrypoint ruby newrelic/deployer:latest main.rb -c configs/gitusdkreu${{ github.run_id }}.json -d $testDefinitionFile -l debug
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
name: Non Regression Testing (JP) (inactive)
2+
3+
on:
4+
workflow_dispatch:
5+
# schedule:
6+
# - cron: "0 9 * * 1-5"
7+
# push:
8+
# branches: [ main ]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
log-context:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Dump all contexts
18+
- name: Dump GitHub context
19+
env:
20+
GITHUB_CONTEXT: ${{ toJson(github) }}
21+
run: echo "$GITHUB_CONTEXT"
22+
- name: Dump job context
23+
env:
24+
JOB_CONTEXT: ${{ toJson(job) }}
25+
run: echo "$JOB_CONTEXT"
26+
- name: Dump steps context
27+
env:
28+
STEPS_CONTEXT: ${{ toJson(steps) }}
29+
run: echo "$STEPS_CONTEXT"
30+
- name: Dump runner context
31+
env:
32+
RUNNER_CONTEXT: ${{ toJson(runner) }}
33+
run: echo "$RUNNER_CONTEXT"
34+
- name: Dump strategy context
35+
env:
36+
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
37+
run: echo "$STRATEGY_CONTEXT"
38+
- name: Dump matrix context
39+
env:
40+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
41+
run: echo "$MATRIX_CONTEXT"
42+
get-test-definition-files:
43+
name: Get Test Definition Files
44+
runs-on: ubuntu-latest
45+
outputs:
46+
matrix: ${{ steps.get-test-definition-files.outputs.result }}
47+
steps:
48+
- name: Checkout Repo
49+
uses: actions/checkout@v2
50+
with:
51+
fetch-depth: 0
52+
- name: Get Test Definition Files
53+
id: get-test-definition-files
54+
uses: actions/github-script@v3
55+
with:
56+
script: |
57+
const fs = require("fs");
58+
const fsp = fs.promises;
59+
const path = require("path");
60+
61+
const { isOHIValidationTimeout } = require("${{ github.workspace }}/.github/workflows/scripts/ohiValidationTimeout");
62+
63+
// readdir recursive directory search
64+
const { readdir } = fsp;
65+
async function getFiles(dir) {
66+
const dirents = await readdir(dir, { withFileTypes: true });
67+
const files = await Promise.all(
68+
dirents.map((dirent) => {
69+
const res = path.join(dir, dirent.name);
70+
return dirent.isDirectory() ? getFiles(res) : res;
71+
})
72+
);
73+
return Array.prototype.concat(...files);
74+
}
75+
76+
const definitionsDir = "test/definitions-jp";
77+
const testDefinitions = await getFiles(definitionsDir);
78+
79+
const outputTestFilesMap = testDefinitions
80+
.filter((testDefinitionFile) => !isOHIValidationTimeout(testDefinitionFile))
81+
.map((testDefinitionFile) => {
82+
return {
83+
testDefinitionFile,
84+
testDisplayName: testDefinitionFile.replace(`${definitionsDir}/`, ""),
85+
};
86+
});
87+
const output = {
88+
include: outputTestFilesMap,
89+
};
90+
console.log(output);
91+
return output;
92+
93+
test-deploy-recipe:
94+
name: ${{ matrix.testDisplayName }}
95+
needs: [get-test-definition-files]
96+
if: ${{ fromJSON(needs.get-test-definition-files.outputs.matrix).include[0] }} # Avoids empty matrix validation error
97+
runs-on: ubuntu-latest
98+
strategy:
99+
matrix: ${{ fromJSON(needs.get-test-definition-files.outputs.matrix) }}
100+
fail-fast: false
101+
env:
102+
MATRIX: ${{ toJSON(matrix) }}
103+
steps:
104+
- name: Checkout Repo
105+
uses: actions/checkout@v2
106+
with:
107+
fetch-depth: 0
108+
109+
- name: Update Test Definition Files URLs
110+
id: get-test-definition-files
111+
env:
112+
TEST_DEFINITION_FILE: ${{ matrix.testDefinitionFile }}
113+
uses: actions/github-script@v3
114+
with:
115+
script: |
116+
const fs = require('fs');
117+
const fsp = fs.promises;
118+
const path = require('path');
119+
120+
// before returning, we need to edit the deploy config files in-place so they
121+
// use the right URLs from the branch
122+
async function getDeployConfigFile(file, outputDir) {
123+
const data = await fsp.readFile(path.join(outputDir, file));
124+
return JSON.parse(data);
125+
}
126+
127+
// Get testDefinitonFile from MATRIX env var
128+
const testDefinitionFile = process.env.TEST_DEFINITION_FILE;
129+
console.log(`Detected Deploy Config: ${JSON.stringify(testDefinitionFile, null, 2)}`)
130+
131+
// Update URLs to use branch this PR is opened with
132+
const data = await getDeployConfigFile(testDefinitionFile, process.env.GITHUB_WORKSPACE);
133+
134+
// Update github source URLs with branch name
135+
let jsonContent = JSON.stringify(data, null, 2);
136+
const branchName = process.env.GITHUB_HEAD_REF ? process.env.GITHUB_HEAD_REF : process.env.GITHUB_REF_NAME;
137+
const replacementString = `$1$2-b ${branchName} $3$4`;
138+
const sourceRepositoryRegex = /(.*)(\")(https:\/\/github.com\/newrelic\/open-install-library)(.*)/gi;
139+
jsonContent = jsonContent.replace(sourceRepositoryRegex, replacementString);
140+
console.log(`Detected Deploy Config: ${JSON.stringify(jsonContent, null, 2)}`)
141+
142+
// Update raw URLs with branch name
143+
const replacementString2 = `$1${branchName}$3`;
144+
const sourceRepositoryRegex2 = /(raw.githubusercontent.com\/newrelic\/open-install-library\/)(main)(\/newrelic\/recipes\/)*/gi;
145+
jsonContent = jsonContent.replace(sourceRepositoryRegex2, replacementString2);
146+
console.log(`Detected Deploy Config: ${JSON.stringify(jsonContent, null, 2)}`)
147+
148+
// Write file back to workspace
149+
const outputPath = `${process.env.GITHUB_WORKSPACE}/${testDefinitionFile}`;
150+
fs.writeFileSync(outputPath, jsonContent);
151+
152+
return testDefinitionFile;
153+
154+
- name: Install npm dependencies for deployer test runner
155+
working-directory: .github/workflows/scripts/deployer-platform
156+
run: npm install
157+
158+
- name: Execute test
159+
id: runDeployerPlatformTest
160+
working-directory: .github/workflows/scripts/deployer-platform
161+
run: |
162+
node main.js
163+
env:
164+
TEST_DEFINITION_FILE: ${{ matrix.testDefinitionFile }}
165+
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYER_PLATFORM_JP_AWS_ACCESS_KEY_ID }}
166+
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYER_PLATFORM_JP_AWS_SECRET_ACCESS_KEY }}
167+
AWS_REGION: ${{ secrets.DEPLOYER_PLATFORM_JP_AWS_REGION }}
168+
SQS_URL: ${{ secrets.DEPLOYER_PLATFORM_JP_SQS_URL }}
169+
DYNAMO_TABLE: ${{ secrets.DEPLOYER_PLATFORM_JP_DYNAMO_TABLE }}
170+
171+
- name: Report any error
172+
if: steps.runDeployerPlatformTest.outputs.exit_status != 0
173+
run: exit 1
174+
175+
slack-notify:
176+
runs-on: ubuntu-latest
177+
needs: [test-deploy-recipe]
178+
if: always()
179+
steps:
180+
- name: Build Result Slack Notification
181+
uses: 8398a7/action-slack@v3
182+
with:
183+
author_name: GitHub Actions
184+
status: custom
185+
fields: commit,repo,ref,author,eventName,message,workflow
186+
custom_payload: |
187+
{
188+
username: "GitHub Actions",
189+
icon_emoji: ":octocat:",
190+
attachments: [{
191+
color: ${{
192+
needs.test-deploy-recipe.result == 'success'
193+
}} === true ? '#43cc11' : '#e05d44',
194+
blocks: [
195+
{
196+
type: "section",
197+
text: {
198+
type: "mrkdwn",
199+
text: `Build for ${process.env.AS_REPO}`
200+
}
201+
},
202+
{
203+
type: "section",
204+
fields: [
205+
{
206+
type: "mrkdwn",
207+
text: `*Commit:*\n${process.env.AS_COMMIT}`
208+
},
209+
{
210+
type: "mrkdwn",
211+
text: `*Author:*\n${process.env.AS_AUTHOR}`
212+
},
213+
{
214+
type: "mrkdwn",
215+
text: `*Branch:*\n${process.env.AS_REF}`
216+
},
217+
{
218+
type: "mrkdwn",
219+
text: `*Message:*\n${process.env.AS_MESSAGE}`
220+
},
221+
{
222+
type: "mrkdwn",
223+
text: `*Type:*\n${process.env.AS_EVENT_NAME}`
224+
},
225+
{
226+
type: "mrkdwn",
227+
text: "*PR:*\n${{ github.event.pull_request.html_url }}"
228+
},
229+
{
230+
type: "mrkdwn",
231+
text: `*Workflow:*\n${ process.env.AS_WORKFLOW }`
232+
}
233+
]
234+
},
235+
{
236+
type: "section",
237+
text: {
238+
type: "mrkdwn",
239+
text: [
240+
"*Result:*",
241+
`• ${ ${{ needs.test-deploy-recipe.result == 'success' }} === true ? '✅' : '❌' } Non-regression testing of all recipes (JP): ${{ needs.test-deploy-recipe.result }}`
242+
].join('\n')
243+
}
244+
},
245+
{
246+
type: "context",
247+
elements: [
248+
{
249+
type: "image",
250+
image_url: "https://avatars2.githubusercontent.com/in/15368",
251+
alt_text: "Github Actions"
252+
},
253+
{
254+
type: "mrkdwn",
255+
text: "This message was created automatically by GitHub Actions."
256+
}
257+
]
258+
}
259+
]
260+
}]
261+
}
262+
env:
263+
GITHUB_TOKEN: ${{ github.token }}
264+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)