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

Commit 4d39b54

Browse files
committed
fix: edit command when entrypoint is tweaked
Signed-off-by: David Kwon <dakwon@redhat.com>
1 parent 39511b7 commit 4d39b54

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tools/devworkspace-handler/src/devfile/dev-container-component-updater.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ export class DevContainerComponentUpdater {
9292
});
9393

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

9798
// now, need to add the common stuff
9899
this.containerPluginRemoteUpdater.update(devContainerComponent.name, devContainer);

tools/devworkspace-handler/tests/devfile/dev-container-component-updater.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('Test DevContainerComponentUpdater', () => {
7878
path: '/existing',
7979
},
8080
],
81+
command: ['tail'],
8182
},
8283
};
8384
devContainerComponentFinderFindMethod.mockResolvedValue(devContainerComponent);
@@ -137,7 +138,8 @@ describe('Test DevContainerComponentUpdater', () => {
137138
},
138139
]);
139140
// args updated
140-
expect(devContainerComponent?.container?.args).toStrictEqual(['sh', '-c', '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);
141+
expect(devContainerComponent?.container?.command).toEqual(['sh', '-c']);
142+
expect(devContainerComponent?.container?.args).toStrictEqual(['${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);
141143

142144
// check we have a new volume added
143145
const components = devfileContext.devWorkspace.spec?.template?.components || [];
@@ -169,7 +171,8 @@ describe('Test DevContainerComponentUpdater', () => {
169171
expect(devContainerComponent?.container?.endpoints).toBeUndefined();
170172
expect(devContainerComponent?.container?.volumeMounts).toBeUndefined();
171173
// args updated
172-
expect(devContainerComponent?.container?.args).toStrictEqual(['sh', '-c', '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);
174+
expect(devContainerComponent?.container?.command).toEqual(['sh', '-c']);
175+
expect(devContainerComponent?.container?.args).toStrictEqual(['${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}']);
173176
});
174177

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

0 commit comments

Comments
 (0)