Skip to content

Commit 9033d94

Browse files
committed
ci: force dev server host to IPv4 to resolve RBE resolution issues
This is needed to get around an RBE issue
1 parent 668c04c commit 9033d94

File tree

6 files changed

+22
-3
lines changed

6 files changed

+22
-3
lines changed

modules/testing/builder/projects/hello-world-app/angular.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"builder": "@angular-devkit/build-angular:dev-server",
104104
"options": {
105105
"buildTarget": "app:build",
106-
"watch": false
106+
"watch": false,
107+
"host": "127.0.0.1"
107108
},
108109
"configurations": {
109110
"production": {

packages/angular/build/src/builders/dev-server/tests/setup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export const BASE_OPTIONS = Object.freeze<Schema>({
6262
buildTarget: 'test:build',
6363
port: 0,
6464

65+
// Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses.
66+
// http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch.
67+
host: '127.0.0.1',
68+
6569
// Watch is not supported for testing in vite as currently there is no teardown logic to stop the watchers.
6670
watch: false,
6771
});

packages/angular_devkit/build_angular/src/builders/dev-server/specs/ssl_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Dev Server Builder ssl', () => {
3333
runs.push(run);
3434
const output = (await run.result) as DevServerBuilderOutput;
3535
expect(output.success).toBe(true);
36-
expect(output.baseUrl).toMatch(/^https:\/\/localhost:\d+\//);
36+
expect(output.baseUrl).toMatch(/^https:\/\/127\.0\.0\.1:\d+\//);
3737

3838
const response = await fetch(output.baseUrl, {
3939
dispatcher: new Agent({
@@ -112,7 +112,7 @@ describe('Dev Server Builder ssl', () => {
112112
runs.push(run);
113113
const output = (await run.result) as DevServerBuilderOutput;
114114
expect(output.success).toBe(true);
115-
expect(output.baseUrl).toMatch(/^https:\/\/localhost:\d+\//);
115+
expect(output.baseUrl).toMatch(/^https:\/\/127\.0\.0\.1:\d+\//);
116116

117117
const response = await fetch(output.baseUrl, {
118118
dispatcher: new Agent({

packages/angular_devkit/build_angular/src/builders/dev-server/tests/setup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export const BASE_OPTIONS = Object.freeze<Schema>({
6363
buildTarget: 'test:build',
6464
port: 0,
6565

66+
// Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses.
67+
// http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch.
68+
host: '127.0.0.1',
69+
6670
// Watch is not supported for testing in vite as currently there is no teardown logic to stop the watchers.
6771
watch: false,
6872
});

packages/angular_devkit/build_webpack/test/basic-app/webpack.config.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ const path = require('path');
33
module.exports = {
44
mode: 'development',
55
entry: path.resolve(__dirname, './src/main.js'),
6+
devServer: {
7+
// Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses.
8+
// http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch.
9+
host: '127.0.0.1',
10+
},
611
module: {
712
rules: [
813
// rxjs 6 requires directory imports which are not support in ES modules.

packages/angular_devkit/build_webpack/test/basic-app/webpack.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { fileURLToPath } from 'url';
44
export default {
55
mode: 'development',
66
entry: resolve(fileURLToPath(import.meta.url), '../src/main.js'),
7+
devServer: {
8+
// Force an IPv4 address as with RBE there are currently resolution issues with IPv6 addresses.
9+
// http://localhost is resolved to IPv6 address with vite and webpack but to IPv4 with node fetch.
10+
host: '127.0.0.1',
11+
},
712
module: {
813
rules: [
914
// rxjs 6 requires directory imports which are not support in ES modules.

0 commit comments

Comments
 (0)