MCPcopy Index your code
hub / github.com/devcontainers/cli / getImageMetadataFromContainer

Function getImageMetadataFromContainer

src/spec-node/imageMetadata.ts:440–461  ·  view source on GitHub ↗
(containerDetails: ContainerDetails, devContainerConfig: SubstitutedConfig<DevContainerConfig>, featuresConfig: FeaturesConfig | undefined, idLabels: string[] | undefined, output: Log)

Source from the content-addressed store, hash-verified

438export const imageMetadataLabel = 'devcontainer.metadata';
439
440export function getImageMetadataFromContainer(containerDetails: ContainerDetails, devContainerConfig: SubstitutedConfig<DevContainerConfig>, featuresConfig: FeaturesConfig | undefined, idLabels: string[] | undefined, output: Log): SubstitutedConfig<ImageMetadataEntry[]> {
441 if (!(containerDetails.Config.Labels || {})[imageMetadataLabel]) {
442 return getDevcontainerMetadata({ config: [], raw: [], substitute: devContainerConfig.substitute }, devContainerConfig, featuresConfig);
443 }
444 const metadata = internalGetImageMetadata(containerDetails, devContainerConfig.substitute, output);
445 const hasIdLabels = !!idLabels && Object.keys(envListToObj(idLabels))
446 .every(label => (containerDetails.Config.Labels || {})[label]);
447 if (hasIdLabels) {
448 return {
449 config: [
450 ...metadata.config,
451 pick(devContainerConfig.config, pickUpdateableConfigProperties),
452 ].filter(config => Object.keys(config).length),
453 raw: [
454 ...metadata.raw,
455 pick(devContainerConfig.raw, pickUpdateableConfigProperties),
456 ].filter(config => Object.keys(config).length),
457 substitute: metadata.substitute,
458 };
459 }
460 return getDevcontainerMetadata(metadata, devContainerConfig, featuresConfig);
461}
462
463export function getImageMetadata(imageDetails: ImageDetails, substitute: SubstituteConfig, output: Log) {
464 return internalGetImageMetadata(imageDetails, substitute, output);

Callers 7

doSetUpFunction · 0.90
doRunUserCommandsFunction · 0.90
readConfigurationFunction · 0.90
doExecFunction · 0.90

Calls 4

envListToObjFunction · 0.90
getDevcontainerMetadataFunction · 0.85
internalGetImageMetadataFunction · 0.85
pickFunction · 0.85

Tested by

no test coverage detected