Skip to content

Commit

Permalink
Revert "Address review comment"
Browse files Browse the repository at this point in the history
This reverts commit 5a202a1.
  • Loading branch information
alexander-smolyakov committed May 25, 2023
1 parent e38e873 commit 09102bd
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions src/spec-node/dockerCompose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ async function generateFeaturesComposeOverrideContent(
...mergedConfig.mounts || [],
...additionalMounts,
].map(m => typeof m === 'string' ? parseMount(m) : m);
const namedVolumeMounts = mounts.filter(m => m.type === 'volume' && m.source);
const volumeMounts = mounts.filter(m => m.type === 'volume');
const customEntrypoints = mergedConfig.entrypoints || [];
const composeEntrypoint: string[] | undefined = typeof service.entrypoint === 'string' ? shellQuote.parse(service.entrypoint) : service.entrypoint;
const composeCommand: string[] | undefined = typeof service.command === 'string' ? shellQuote.parse(service.command) : service.command;
Expand Down Expand Up @@ -543,9 +543,9 @@ while sleep 1 & wait $$!; do :; done", "-"${userEntrypoint.map(a => `, ${JSON.st
labels:${additionalLabels.map(label => `
- '${label.replace(/\$/g, '$$$$').replace(/'/g, '\'\'')}'`).join('')}` : ''}${mounts.length ? `
volumes:${mounts.map(m => `
- ${convertMountToVolume(m)}`).join('')}` : ''}${gpuResources}${namedVolumeMounts.length ? `
volumes:${namedVolumeMounts.map(m => `
${convertMountToVolumeTopLevelElement(m)}`).join('')}` : ''}
- ${convertMountToVolume(m)}`).join('')}` : ''}${gpuResources}${volumeMounts.length ? `
volumes:${volumeMounts.map(m => `
${m.source}:${m.external ? '\n external: true' : ''}`).join('')}` : ''}
`;
}

Expand Down Expand Up @@ -704,22 +704,4 @@ function convertMountToVolume(mount: Mount): string {
volume += mount.target;

return volume;
}

/**
* Convert mount command' arguments to volume top-level element
* @param mount
* @returns mount object representation as volumes top-level element
* @throws if `source` property is undefined
*/
function convertMountToVolumeTopLevelElement(mount: Mount): string {
let volume: string = `
${mount.source}
`;

if (mount.external) {
volume += '\n external: true';
}

return volume;
}
}

0 comments on commit 09102bd

Please sign in to comment.