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

Commit

Permalink
Revert temporary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Oct 31, 2023
1 parent 20c3a54 commit 3b6ed5d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 40 deletions.
1 change: 0 additions & 1 deletion build/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
64 changes: 25 additions & 39 deletions build/src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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';
}


Expand Down

0 comments on commit 3b6ed5d

Please sign in to comment.