Skip to content

Commit

Permalink
fix: don't rewrite 127 to 0.0.0.0 (#1051)
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Vala <mvala@redhat.com>
  • Loading branch information
sparkoo authored Sep 20, 2021
1 parent 4d138d5 commit c7c6702
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions tools/build/src/devfile/meta-yaml-to-devfile-yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ export class MetaYamlToDevfileYaml {

components.unshift(component);

// replace 127.0.0.1 by 0.0.0.0
return components.map(iteratingComponent =>
JSON.parse(JSON.stringify(iteratingComponent).replace(/127\.0\.0\.1/g, '0.0.0.0'))
);
return components;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types
Expand Down
5 changes: 2 additions & 3 deletions tools/build/tests/devfile/meta-yaml-to-devfile-yaml.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Test MetaYamlToDevfileYaml', () => {
expect(component.name).toBe('che-machine-exec');
const componentContainer = component.container;
expect(componentContainer.image).toBe('quay.io/eclipse/che-machine-exec:next');
expect(componentContainer.command).toStrictEqual(['/go/bin/che-machine-exec', '--url', '0.0.0.0:4444']);
expect(componentContainer.command).toStrictEqual(['/go/bin/che-machine-exec', '--url', '127.0.0.1:4444']);

expect(componentContainer.endpoints).toBeDefined();
expect(componentContainer.endpoints?.length).toBe(2);
Expand Down Expand Up @@ -87,8 +87,7 @@ describe('Test MetaYamlToDevfileYaml', () => {

const theiaHostEnv = theiaIdeComponentContainer.env.find((env: any) => env.name === 'THEIA_HOST');
expect(theiaHostEnv.name).toBe('THEIA_HOST');
// 127.0.0.1 should have been replaced by 0.0.0.0
expect(theiaHostEnv.value).toBe('0.0.0.0');
expect(theiaHostEnv.value).toBe('127.0.0.1');

expect(theiaIdeComponentContainer.volumeMounts).toBeDefined();
expect(theiaIdeComponentContainer.volumeMounts?.length).toBe(2);
Expand Down

0 comments on commit c7c6702

Please sign in to comment.