Repository navigation
Simplify Jinja2 templates by removing duplication - #952
Merged
Merged
Conversation
- Remove arch-variable.j2 partial and pass arch_cmd directly from each OS template into multi-arch-install.j2 - Replace repeated version flag conditionals with a single vflag variable in version-check.j2, version-check-windows.j2, and nanoserver.Dockerfile.j2 No change to generated Dockerfiles or entrypoint scripts.
- Remove version-check-windows.j2 partial (only used in servercore) - Inline the version check logic directly into servercore.Dockerfile.j2 - Unify nanoserver vflag to include 'version' in the value - Remove corresponding test for deleted partial
karianna
approved these changes
May 18, 2026
gdams
enabled auto-merge (squash)
May 29, 2026 13:38
smlambert
approved these changes
May 29, 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.
Summary
arch-variable.j2partial and passarch_cmddirectly from each OS template intomulti-arch-install.j2{% if version|int >= 11 %}--{% else %}-{% endif %}) with a singlevflagvariable inversion-check.j2,version-check-windows.j2, andnanoserver.Dockerfile.j2Details
The
arch-variable.j2partial was only used in one place (multi-arch-install.j2) and just mapped theosvariable to an architecture detection command. Each OS template now setsarch_cmddirectly before includingmulti-arch-install.j2, making the data flow clearer.The version flag pattern
{% if version|int >= 11 %}--{% else %}-{% endif %}was repeated 6 times across 3 files. A single{% set vflag = "--" if version|int >= 11 else "-" %}at the top of each file eliminates the duplication.No change to generated Dockerfiles or entrypoint scripts.