fix global environment expansion
Metadata
Current evaluation
Merged fix for global environment expansion preventing CRAFT_ variable setup before parts lifecycle. Updates tests, adds CRAFT_PROJECT_VERSION to spread tests, and resolves issue #333 after local verification and approval.
Suggested action: —
No scores available.
Issue body
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Fixes https://github.com/canonical/rockcraft/issues/333
In this PR:
- fix the global variable expansion which was not being called and thus resulting in `CRAFT_` variables not being set before running the parts' lifecycle steps
- refactor the project loading so that it returns a YAML instead of the project itself. The latter can still be retrieved by explicitly calling the `unmarshal` function
- adjust the unit tests accordingly
- add `CRAFT_PROJECT_VERSION` to a spread test
**NOTE:** Although it works, I feel there might be a better way to handle this, by fiddling with the callbacks and `ProjectInfo` directly in the craft-parts module. Why can't the variable expansion be handled by the craft-parts, implicitly? I.e. the `PartsLifecycle` already takes `project_vars` as an argument, so it doesn't need access to the whole YAML
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for global environment expansion preventing CRAFT_ variable setup before parts lifecycle. Updates tests, adds CRAFT_PROJECT_VERSION to spread tests, and resolves issue #333 after local verification and approval. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for global environment expansion preventing CRAFT_ variables from setting before parts lifecycle steps. Refactored project loading to return YAML. Resolves #333 after local verification, with future craft-application refactoring planned. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix ensuring CRAFT_ variables expand correctly before parts lifecycle steps. Refactored project loading to return YAML and updated tests. Marked as a temporary workaround pending craft-application rebasing. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #226 environment: expand global variables | craft-parts | merged | Global environment variables in parts values are now expanded. Merged after single reviewer approval and passing CI checks, resolving CRAFT-1073. Changes span 7 files with 340 additions and 1 deletion. | |
| #186 executor: standardize environment variable prefix | craft-parts | merged | Merged. Standardized part scriptlet environment variables to a common CRAFT_ prefix, replacing application-specific prefixes. Added CRAFT_PROJECT_DIR, rebased on main, and approved by reviewer. |