I wanted to install features in a specific order, and used overrideFeatureInstallOrder to do that. I was surprised when the feature I wanted to install last installed first!
I have a minimal reproduction at https://github.com/dgholz/devcontainer-install-override
In the devcontainer.json file, I have:
{
"image": "mcr.microsoft.com/devcontainers/base:trixie",
"features": {
"./features/use-tr": {},
"./features/remove-tr": {}
},
"overrideFeatureInstallOrder": [
"./features/use-tr",
"./features/remove-tr"
]
}
But use-tr has a dependency on the common feature, and remove-tr does not. So when computeDependsOnInstallationOrder runs, it gets tripped up by
|
// If the node has no hard/soft dependencies, the node can always be installed. |
use-tr gets excluded, and
remove-tr has round priority
1 so gets installed before
common (which has round priority
0)
The fix is to either set the round priority transitively (so common would get round priority 2 from use-tr); or to reverse the calculated priority ordering, so features with no dependencies would be installed first.
I wanted to install features in a specific order, and used
overrideFeatureInstallOrderto do that. I was surprised when the feature I wanted to install last installed first!I have a minimal reproduction at https://github.com/dgholz/devcontainer-install-override
In the
devcontainer.jsonfile, I have:But
use-trhas a dependency on thecommonfeature, andremove-trdoes not. So whencomputeDependsOnInstallationOrderruns, it gets tripped up bycli/src/spec-configuration/containerFeaturesOrder.ts
Line 625 in 997a2db
use-trgets excluded, andremove-trhas round priority1so gets installed beforecommon(which has round priority0)The fix is to either set the round priority transitively (so
commonwould get round priority2fromuse-tr); or to reverse the calculated priority ordering, so features with no dependencies would be installed first.