Fail fast on missing DISTRO and map focal/jammy to ubuntu20/ubuntu22#117
Merged
Conversation
nafraf
reviewed
Jun 4, 2026
| devcontainer_os = _read_key_value_file(DEVCONTAINER_PATH)["DISTRO"] | ||
| return (devcontainer_os | ||
| .replace("focal", "ubuntu20") | ||
| .replace("jammy", "ubuntu22")) |
There was a problem hiding this comment.
Do we need a similar hack for noble -> ubuntu24?
Contributor
Author
There was a problem hiding this comment.
there's still no noble distribution in RE. I'll add it now
|
eyalrund
approved these changes
Jun 4, 2026
eyalrund
left a comment
There was a problem hiding this comment.
- The "fail fast" is a bare KeyError with no friendly message — intentional per the title, but a wrapped error like raise ValueError("DISTRO missing from devcontainer at ") would be more debuggable for whoever hits it in CI.
- .replace() does substring replacement, so a hypothetical DISTRO=focal-test would become ubuntu20-test. Harmless given the controlled input set, but a dict lookup ({"focal":"ubuntu20","jammy":"ubuntu22"}.get(v, v)) would be more precise and easier to extend.
GuyAv46
reviewed
Jun 4, 2026
Comment on lines
+119
to
+121
| return (devcontainer_os | ||
| .replace("focal", "ubuntu20") | ||
| .replace("jammy", "ubuntu22")) |
Collaborator
There was a problem hiding this comment.
Don't we have a map for such translations, instead of these two specific switches? Shouldn't we have such a map?
Then we can have something like
return os_name_normalized.get(devcontainer_os, devcontainer_os)to fetch the expected name, and fall back to the current name if nothing special is set
Contributor
Author
There was a problem hiding this comment.
we can, I didn't bother since it didn't seem more readable. let me change to that.
GuyAv46
approved these changes
Jun 4, 2026
nafraf
approved these changes
Jun 4, 2026
alonre24
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fail fast when DISTRO is missing from the devcontainer file, and map focal/jammy to ubuntu20/ubuntu22.