From 3b6ed5d8fefd76161666bd43edb534fbe9bcec98 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Tue, 31 Oct 2023 15:08:22 +0100 Subject: [PATCH] Revert temporary changes --- build/config.json | 1 - build/src/utils/config.js | 64 +++++++++++++++------------------------ 2 files changed, 25 insertions(+), 40 deletions(-) diff --git a/build/config.json b/build/config.json index bbc10114ab..65d5463477 100644 --- a/build/config.json +++ b/build/config.json @@ -7,7 +7,6 @@ "githubRepoName": "microsoft/vscode-dev-containers", "containersPathInRepo": "containers", "historyFolderName": "history", - "repoContainersToBuildPath": "repository-containers/images", "scriptLibraryPathInRepo": "script-library", "scriptLibraryFolderNameInDefinition": "library-scripts", "historyUrlPrefix": "https://github.com/microsoft/vscode-dev-containers/tree/main/containers/", diff --git a/build/src/utils/config.js b/build/src/utils/config.js index aa7f4a0548..32c3721b01 100644 --- a/build/src/utils/config.js +++ b/build/src/utils/config.js @@ -24,48 +24,34 @@ async function loadConfig(repoPath) { repoPath = repoPath || path.join(__dirname, '..', '..', '..'); const definitionBuildConfigFile = getConfig('definitionBuildConfigFile', 'definition-manifest.json'); - // // Get list of definition folders - // const containersPath = path.join(repoPath, getConfig('containersPathInRepo', 'containers')); - // const definitions = await asyncUtils.readdir(containersPath, { withFileTypes: true }); - // await asyncUtils.forEach(definitions, async (definitionFolder) => { - // // If directory entry is a file (like README.md, skip - // if (!definitionFolder.isDirectory()) { - // return; - // } - - // const definitionId = definitionFolder.name; - // const definitionPath = path.resolve(path.join(containersPath, definitionId)); - - // // If a .deprecated file is found, remove the directory from staging and return - // if(await asyncUtils.exists(path.join(definitionPath, '.deprecated'))) { - // await asyncUtils.rimraf(definitionPath); - // return; - // } - - // // Add to complete list of definitions - // allDefinitionPaths[definitionId] = { - // path: definitionPath, - // relativeToRootPath: path.relative(repoPath, definitionPath) - // } - // // If definition-manifest.json exists, load it - // const manifestPath = path.join(definitionPath, definitionBuildConfigFile); - // if (await asyncUtils.exists(manifestPath)) { - // await loadDefinitionManifest(manifestPath, definitionId); - // } - // }); - - // Load repo containers to build - const repoContainersToBuildPath = path.join(repoPath, getConfig('repoContainersToBuildPath', 'repository-containers/build')); - const repoContainerManifestFiles = glob.sync(`${repoContainersToBuildPath}/**/${definitionBuildConfigFile}`); - await asyncUtils.forEach(repoContainerManifestFiles, async (manifestFilePath) => { - const definitionPath = path.resolve(path.dirname(manifestFilePath)); - const definitionId = path.relative(repoContainersToBuildPath, definitionPath); - console.log(`Loading definition ID: ${definitionId}`); + // Get list of definition folders + const containersPath = path.join(repoPath, getConfig('containersPathInRepo', 'containers')); + const definitions = await asyncUtils.readdir(containersPath, { withFileTypes: true }); + await asyncUtils.forEach(definitions, async (definitionFolder) => { + // If directory entry is a file (like README.md, skip + if (!definitionFolder.isDirectory()) { + return; + } + + const definitionId = definitionFolder.name; + const definitionPath = path.resolve(path.join(containersPath, definitionId)); + + // If a .deprecated file is found, remove the directory from staging and return + if(await asyncUtils.exists(path.join(definitionPath, '.deprecated'))) { + await asyncUtils.rimraf(definitionPath); + return; + } + + // Add to complete list of definitions allDefinitionPaths[definitionId] = { path: definitionPath, relativeToRootPath: path.relative(repoPath, definitionPath) } - await loadDefinitionManifest(manifestFilePath, definitionId); + // If definition-manifest.json exists, load it + const manifestPath = path.join(definitionPath, definitionBuildConfigFile); + if (await asyncUtils.exists(manifestPath)) { + await loadDefinitionManifest(manifestPath, definitionId); + } }); // Populate image variants and tag lookup @@ -202,7 +188,7 @@ function getTagsForVersion(definitionId, version, registry, registryPath, varian // If the definition states that only versioned tags are returned and the version is 'dev', // add the definition Id to ensure that we do not incorrectly hijack a tag from another definition. if (version === 'dev') { - version = config.definitionBuildSettings[definitionId].versionedTagsOnly ? `dev-${definitionId.replace(/-/mg,'')}` : 'branch-main'; + version = config.definitionBuildSettings[definitionId].versionedTagsOnly ? `dev-${definitionId.replace(/-/mg,'')}` : 'dev'; }