Skip to content

Commit 7eedfad

Browse files
committed
fix: fix feature install order
1 parent c3f49b7 commit 7eedfad

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"image": "ubuntu",
3+
"features": {
4+
"./afeature1": {},
5+
"./afeature2": {}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "A feature 1",
3+
"id": "afeature1",
4+
"version": "1.0.0",
5+
"description": "A feature 1.",
6+
"options": {}
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
echo "hello world from feature 1 !"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "A feature 2",
3+
"id": "afeature2",
4+
"version": "1.0.0",
5+
"description": "A feature 2.",
6+
"options": {},
7+
"installsAfter": [
8+
"./afeature1"
9+
]
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
echo "hello world from feature 2 !"

pkg/devcontainer/feature/extend.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ func computeAutomaticFeatureOrder(features []*config.FeatureSet) ([]*config.Feat
307307
// build lookup map
308308
lookup := map[string]*config.FeatureSet{}
309309
for _, feature := range features {
310-
lookup[feature.ConfigID] = feature
310+
lookup[feature.Config.ID] = feature
311311
}
312312

313313
// build graph
314314
for _, feature := range features {
315-
_, err := g.InsertNodeAt("root", feature.ConfigID, feature)
315+
_, err := g.InsertNodeAt("root", feature.Config.ID, feature)
316316
if err != nil {
317317
return nil, err
318318
}
@@ -325,7 +325,7 @@ func computeAutomaticFeatureOrder(features []*config.FeatureSet) ([]*config.Feat
325325
}
326326

327327
// add an edge from feature to installAfterFeature
328-
_, err = g.InsertNodeAt(feature.ConfigID, installAfter, installAfterFeature)
328+
_, err = g.InsertNodeAt(feature.Config.ID, installAfter, installAfterFeature)
329329
if err != nil {
330330
return nil, err
331331
}

0 commit comments

Comments
 (0)