Skip to content

feat: dynamically solve all requirements.mod files#148

Merged
yeoldegrove merged 2 commits into
mainfrom
feat/dynamic_requirements
Jun 8, 2026
Merged

feat: dynamically solve all requirements.mod files#148
yeoldegrove merged 2 commits into
mainfrom
feat/dynamic_requirements

Conversation

@yeoldegrove

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

feat: dynamically solve all requirements.mod files

This enables adding new variables to requirements.mod files in any feature without updating the builder.

@yeoldegrove yeoldegrove added this to the 2026-05 milestone May 21, 2026
@yeoldegrove yeoldegrove requested a review from nkraetzschmar May 21, 2026 12:57
@yeoldegrove yeoldegrove self-assigned this May 21, 2026
Comment thread builder/image.requirements Fixed
Signed-off-by: Eike Waldt <waldt@b1-systems.de>
On-behalf-of: SAP <eike.waldt@sap.com>
@yeoldegrove yeoldegrove force-pushed the feat/dynamic_requirements branch from b4a01c0 to eb2637d Compare May 21, 2026 12:59

@nkraetzschmar nkraetzschmar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either we need to adjust the way the requirements.mod files are evaluated to ensure that they are just key=value pairs, or we need a better way to dynamically determine the set of keys.

One idea I'd have: introduce a requirements_keys array and let the mod scripts dynamically add/remove keys there and then use that for the final output. So have something like

requirements_keys=(arch uefi secureboot tpm2)

# source the requirements.mod files here which may add keys

for key in "${requirements_keys[@]}"; do
    echo "$key=${!key}"
done

Comment thread builder/image.requirements Outdated
# Scan all requirements.mod files to find all possible modifiers and set defaults
for req_mod in "$features_dir"/*/requirements.mod; do
[ -e "$req_mod" ] || continue
while IFS='=' read -r key _; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the assumption that all requirements.mod files are of a plain key=value format. But since they get sourced there could be more complex setups, so this scanning for possible modifiers is fragile if we keep the way the requirements.mod files as is.

@yeoldegrove

yeoldegrove commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@nkraetzschmar good catch...

Either we need to adjust the way the requirements.mod files are evaluated to ensure that they are just key=value pairs, or we need a better way to dynamically determine the set of keys.

I like this being potentially dynamic for future use cases.

One idea I'd have: introduce a requirements_keys array and let the mod scripts dynamically add/remove keys there and then use that for the final output. So have something like

I like this idea but would keep the initial array minimal and only include what is not set in features, e.g. non-bool arch:

requirements_keys=(arch)

Each feature's requirements.mod file would need to be adapted (coordinated PR) e.g.

requirements_keys+=(uefi)
uefi=true

@yeoldegrove yeoldegrove requested a review from nkraetzschmar June 8, 2026 08:10
@yeoldegrove

Copy link
Copy Markdown
Contributor Author

@nkraetzschmar Please re-review.

Comment thread builder/image.requirements Fixed
yeoldegrove added a commit to gardenlinux/gardenlinux that referenced this pull request Jun 8, 2026
This is a companion PR to gardenlinux/builder#148

Signed-off-by: Eike Waldt <waldt@b1-systems.de>
On-behalf-of: SAP <eike.waldt@sap.com>
@yeoldegrove

Copy link
Copy Markdown
Contributor Author

gardenlinux/gardenlinux#4912 is a companion PR that extends the requirements_keys array in the features.

Use requirements_keys array to discover existing modifiers.

Signed-off-by: Eike Waldt <waldt@b1-systems.de>
On-behalf-of: SAP <eike.waldt@sap.com>
@yeoldegrove yeoldegrove force-pushed the feat/dynamic_requirements branch from 64264f6 to 17b7dc3 Compare June 8, 2026 08:17

@nkraetzschmar nkraetzschmar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@yeoldegrove yeoldegrove merged commit 6026df5 into main Jun 8, 2026
9 of 10 checks passed
@yeoldegrove yeoldegrove deleted the feat/dynamic_requirements branch June 8, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants