Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

fix: edit command when entrypoint is tweaked #1343

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export class DevContainerComponentUpdater {
});

// need to tweak the entrypoint to call the ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
devContainer.args = ['sh', '-c', '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}'];
devContainer.command = ['sh', '-c'];
devContainer.args = ['${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}'];

// now, need to add the common stuff
this.containerPluginRemoteUpdater.update(devContainerComponent.name, devContainer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe('Test DevContainerComponentUpdater', () => {
path: '/existing',
},
],
command: ['tail'],
},
};
devContainerComponentFinderFindMethod.mockResolvedValue(devContainerComponent);
Expand Down Expand Up @@ -137,7 +138,8 @@ describe('Test DevContainerComponentUpdater', () => {
},
]);
// args updated
expect(devContainerComponent?.container?.args).toStrictEqual(['sh', '-c', '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);
expect(devContainerComponent?.container?.command).toStrictEqual(['sh', '-c']);
expect(devContainerComponent?.container?.args).toStrictEqual(['${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);

// check we have a new volume added
const components = devfileContext.devWorkspace.spec?.template?.components || [];
Expand Down Expand Up @@ -169,7 +171,8 @@ describe('Test DevContainerComponentUpdater', () => {
expect(devContainerComponent?.container?.endpoints).toBeUndefined();
expect(devContainerComponent?.container?.volumeMounts).toBeUndefined();
// args updated
expect(devContainerComponent?.container?.args).toStrictEqual(['sh', '-c', '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);
expect(devContainerComponent?.container?.command).toStrictEqual(['sh', '-c']);
expect(devContainerComponent?.container?.args).toStrictEqual(['${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);
});

test('not a dev container', async () => {
Expand Down