Skip to content

Commit a872849

Browse files
vscdc tooling - Fix bug: Add new parent-child relation (#299)
1 parent 5e7ab8c commit a872849

File tree

6 files changed

+73
-25
lines changed

6 files changed

+73
-25
lines changed

.github/workflows/push-dev.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
if: "github.ref == 'refs/heads/main'"
1212
strategy:
1313
matrix:
14-
page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
15-
page-total: [60]
14+
page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]
15+
page-total: [53]
1616
fail-fast: false
1717
runs-on: devcontainer-image-builder-ubuntu
1818
steps:

.github/workflows/push.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
if: ${{ github.event.base_ref == 'refs/heads/main' }}
1212
strategy:
1313
matrix:
14-
page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]
15-
page-total: [60]
14+
page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]
15+
page-total: [53]
1616
fail-fast: false
1717
runs-on: devcontainer-image-builder-ubuntu
1818
steps:

.vscode/launch.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "vscdc/build push",
8+
"program": "${workspaceFolder}/build/vscdc",
9+
"cwd": "${workspaceFolder}",
10+
"args": [
11+
"push",
12+
"--no-push",
13+
"--registry",
14+
"mcr.microsoft.com",
15+
"--registry-path",
16+
"devcontainers",
17+
"--release",
18+
"v1.1.0",
19+
"--page",
20+
"1",
21+
"--pageTotal",
22+
"53"
23+
],
24+
"console": "integratedTerminal",
25+
}
26+
]
27+
}

build/src/utils/config.js

+38-21
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ config.definitionVariants = config.definitionVariants || {};
1717
const stagingFolders = {};
1818
const definitionTagLookup = {};
1919
const allDefinitionPaths = {};
20+
let variantsList = [];
21+
let skipParentVariants = [];
2022

2123
// Must be called first
2224
async function loadConfig(repoPath) {
@@ -355,8 +357,6 @@ function getSortedDefinitionBuildList(page, pageTotal, definitionsToSkip) {
355357
}
356358
}
357359

358-
let variantsList = [];
359-
let skipParentVariants = [];
360360

361361
// Configure and club dependent variants together.
362362
for (let id in parentBuckets) {
@@ -380,16 +380,11 @@ function getSortedDefinitionBuildList(page, pageTotal, definitionsToSkip) {
380380
let parentVariants = config.definitionVariants[parentId];
381381
if (variants) {
382382
variants.forEach(variant => {
383-
if (parentVariants.includes(variant)) {
384-
const parentItem = getDefinitionObject(parentId, variant);
385-
const item = [
386-
parentItem,
387-
getDefinitionObject(definitionId, variant)
388-
]
389-
390-
variantsList.push(item);
391-
skipParentVariants.push(parentItem);
392-
383+
const variantId = config.definitionBuildSettings[definitionId].idMismatch === "true" && variant.includes('-') ? variant.split('-')[1] : variant;
384+
if (parentVariants.includes(variantId)) {
385+
const parentItem = getDefinitionObject(parentId, variantId);
386+
const childItem = getDefinitionObject(definitionId, variant);
387+
addToVariantsList(parentItem, childItem);
393388
} else {
394389
variantsList.push([getDefinitionObject(definitionId, variant)]);
395390
}
@@ -415,15 +410,8 @@ function getSortedDefinitionBuildList(page, pageTotal, definitionsToSkip) {
415410
const shouldAddSingleVariant = parentId[commonVariant];
416411
if (parentVariants.includes(commonVariant)) {
417412
const parentItem = getDefinitionObject(parentObjId, commonVariant);
418-
419-
const item = [
420-
parentItem,
421-
getDefinitionObject(definitionId, commonVariant)
422-
]
423-
424-
variantsList.push(item);
425-
skipParentVariants.push(parentItem);
426-
413+
const childItem = getDefinitionObject(definitionId, commonVariant);
414+
addToVariantsList(parentItem, childItem);
427415
} else if (shouldAddSingleVariant) {
428416
variantsList.push([getDefinitionObject(definitionId, commonVariant)]);
429417
}
@@ -483,6 +471,35 @@ function getSortedDefinitionBuildList(page, pageTotal, definitionsToSkip) {
483471
return allPages[page - 1];
484472
}
485473

474+
function addToVariantsList(parentItem, childItem) {
475+
let isAdded = false;
476+
for (let x = 0; x < variantsList.length; x++) {
477+
for (let y = 0; y < variantsList[x].length; y++) {
478+
const variantItem = variantsList[x][y];
479+
if (variantItem.id === parentItem.id && variantItem.variant === parentItem.variant) {
480+
variantsList[x].push(childItem);
481+
isAdded = true;
482+
break;
483+
}
484+
}
485+
486+
if (isAdded) {
487+
break;
488+
}
489+
}
490+
491+
if (!isAdded) {
492+
const item = [
493+
parentItem,
494+
childItem
495+
]
496+
497+
variantsList.push(item);
498+
}
499+
500+
skipParentVariants.push(parentItem);
501+
}
502+
486503
function getDefinitionList() {
487504
let definitionList = [];
488505
for (let definitionId in config.definitionBuildSettings) {

src/java-8/manifest.json

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"build": {
88
"latest": false,
99
"rootDistro": "debian",
10+
"parent": "base-debian",
11+
"idMismatch": "true",
1012
"architectures": {
1113
"bullseye": [
1214
"linux/amd64",

src/java/manifest.json

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"build": {
1010
"latest": "17-bullseye",
1111
"rootDistro": "debian",
12+
"parent": "base-debian",
13+
"idMismatch": "true",
1214
"variantBuildArgs": {
1315
"17-bullseye": {
1416
"TARGET_JAVA_VERSION": "17",

0 commit comments

Comments
 (0)