Skip to content

Commit c1b5759

Browse files
authored
fix(api7): let e2e keep use bitnamilegacy image (#357)
1 parent f9eac70 commit c1b5759

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

.github/workflows/e2e.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- main
1111
types: [opened, synchronize, reopened, labeled]
1212
env:
13-
E2E: '1'
13+
E2E: "1"
1414
jobs:
1515
cli:
1616
runs-on: ubuntu-latest
@@ -20,7 +20,7 @@ jobs:
2020
# Build and test ADC CLI
2121
- uses: actions/setup-node@v4
2222
with:
23-
node-version: 'lts/*'
23+
node-version: "lts/*"
2424
- uses: pnpm/action-setup@v2
2525
with:
2626
version: latest
@@ -61,7 +61,7 @@ jobs:
6161
# Build and test ADC CLI
6262
- uses: actions/setup-node@v4
6363
with:
64-
node-version: 'lts/*'
64+
node-version: "lts/*"
6565
- uses: pnpm/action-setup@v2
6666
with:
6767
version: latest
@@ -100,7 +100,7 @@ jobs:
100100
# Build and test ADC CLI
101101
- uses: actions/setup-node@v4
102102
with:
103-
node-version: 'lts/*'
103+
node-version: "lts/*"
104104
- uses: pnpm/action-setup@v2
105105
with:
106106
version: latest
@@ -126,7 +126,7 @@ jobs:
126126
# Build and test ADC CLI
127127
- uses: actions/setup-node@v4
128128
with:
129-
node-version: 'lts/*'
129+
node-version: "lts/*"
130130
- uses: pnpm/action-setup@v4
131131
- name: Install dependencies
132132
run: pnpm install

libs/backend-api7/e2e/support/global-setup.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import axios from 'axios';
2-
import { spawn } from 'node:child_process';
2+
import { spawn, spawnSync } from 'node:child_process';
33
import { randomUUID } from 'node:crypto';
4+
import { readFileSync, writeFileSync } from 'node:fs';
45
import { Agent } from 'node:https';
56
import * as semver from 'semver';
67

@@ -31,26 +32,40 @@ httpClient.interceptors.request.use(
3132

3233
const setupAPI7 = async () => {
3334
return new Promise<void>((resolve, reject) => {
34-
const ls = spawn(
35+
const download = spawnSync(
3536
'sh',
3637
[
3738
'-c',
38-
`curl -O ${process.env.BACKEND_API7_DOWNLOAD_URL} && tar xf api7-ee-*.tar.gz && cd api7-ee && bash run.sh start`,
39+
`curl -O ${process.env.BACKEND_API7_DOWNLOAD_URL} && tar xf api7-ee-*.tar.gz`,
3940
],
4041
{ cwd: `/tmp` },
4142
);
4243

44+
console.log('stdout: ' + download.stdout.toString('utf-8'));
45+
console.log('stderr: ' + download.stderr.toString('utf-8'));
46+
47+
const dockerComposePath = `/tmp/api7-ee/docker-compose.yaml`;
48+
const dockerCompose = readFileSync(dockerComposePath, 'utf-8').replaceAll(
49+
': bitnami/',
50+
': bitnamilegacy/',
51+
);
52+
writeFileSync(dockerComposePath, dockerCompose, 'utf-8');
53+
54+
const setup = spawn('sh', ['-c', `cd api7-ee && bash run.sh start`], {
55+
cwd: `/tmp`,
56+
});
57+
4358
console.log('\nSetup API7 Instance\n');
4459

45-
ls.stdout.on('data', function (data) {
60+
setup.stdout.on('data', function (data) {
4661
console.log('stdout: ' + data.toString());
4762
});
4863

49-
ls.stderr.on('data', function (data) {
64+
setup.stderr.on('data', function (data) {
5065
console.log('stderr: ' + data.toString());
5166
});
5267

53-
ls.on('exit', function (code) {
68+
setup.on('exit', function (code) {
5469
if (code)
5570
reject(`child process exited with non-zero code: ${code?.toString()}`);
5671

0 commit comments

Comments
 (0)