devcontainers / devcontainers/cli

`overrideFeatureInstallOrder` gets confused when higher-priority features have dependencies

Đang mở
#1,200 1 bình luận 1 reaction 1 người được giao Được @v-Kaniska244 nhận Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
3k
Fork
457
Merge trung bình
13 giờ 17 phút
Pull request đã merge (30 ngày)
6

Mô tả

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](https://github.com/dgholz/devcontainer-install-override/blob/main/.devcontainer/devcontainer.json), 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
https://github.com/devcontainers/cli/blob/997a2db1ec28eacfb718d07e7741dbd57af59564/src/spec-configuration/containerFeaturesOrder.ts#L625
`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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.