-
Notifications
You must be signed in to change notification settings - Fork 20
Description
What needs to get done
CraftSpreadYaml model at craft_application/models/spread.py does not accept the environment key which limits the ways in which the spread test can be set up.
specific example
in chisel-releases we use the environment key to add an entry to the PATH with extra libraries. there we run the tests with spread directly, and all is great.
i've been working on the rust-rock recently, and i wanted to implement this kind of pattern (which would eventually hopefully be adopted by into the rocks-template), however, when trying it out, the test fails in the cli (relevant logs pasted below in case the cli logs are no longer available). i've tracked the issue down to the fact that the builder calls rockcraft test rather than using spread (called by the oci-factory). from there + actually looking at the python stacktrace, i've narrowed it down to CraftSpreadYaml being self-proclaimedly only a simplified version.
2025-09-26 14:43:15.904 rockcraft internal error: 1 validation error for CraftSpreadYaml
2025-09-26 14:43:15.904 environment
2025-09-26 14:43:15.904 Extra inputs are not permitted [type=extra_forbidden, input_value={'SHARED_LIBRARIES': '$PR...PATH:$SHARED_LIBRARIES'}, input_type=dict]
2025-09-26 14:43:15.904 For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden
2025-09-26 14:43:15.911 Traceback (most recent call last):
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_application/application.py", line 650, in run
2025-09-26 14:43:15.912 return_code = self._run_inner()
2025-09-26 14:43:15.912 ^^^^^^^^^^^^^^^^^
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_application/application.py", line 627, in _run_inner
2025-09-26 14:43:15.912 return_code = dispatcher.run() or os.EX_OK
2025-09-26 14:43:15.912 ^^^^^^^^^^^^^^^^
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 564, in run
2025-09-26 14:43:15.912 return self._loaded_command.run(self._parsed_command_args)
2025-09-26 14:43:15.912 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_application/commands/base.py", line 200, in run
2025-09-26 14:43:15.912 result = self._run(parsed_args, **kwargs) or result
2025-09-26 14:43:15.912 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 684, in _run
2025-09-26 14:43:15.912 testing_service.test(
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_application/services/testing.py", line 69, in test
2025-09-26 14:43:15.912 self.process_spread_yaml(temp_spread_file, pack_state)
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_application/services/testing.py", line 108, in process_spread_yaml
2025-09-26 14:43:15.912 simple = models.CraftSpreadYaml.unmarshal(data)
2025-09-26 14:43:15.912 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-26 14:43:15.912 File "/snap/rockcraft/3592/lib/python3.12/site-packages/craft_application/models/base.py", line 64, in unmarshal
2025-09-26 14:43:15.913 return cls.model_validate(data)
2025-09-26 14:43:15.913 ^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-26 14:43:15.913 File "/snap/rockcraft/3592/lib/python3.12/site-packages/pydantic/main.py", line 705, in model_validate
2025-09-26 14:43:15.913 return cls.__pydantic_validator__.validate_python(
2025-09-26 14:43:15.913 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-09-26 14:43:15.913 pydantic_core._pydantic_core.ValidationError: 1 validation error for CraftSpreadYaml
2025-09-26 14:43:15.913 environment
2025-09-26 14:43:15.913 Extra inputs are not permitted [type=extra_forbidden, input_value={'SHARED_LIBRARIES': '$PR...PATH:$SHARED_LIBRARIES'}, input_type=dict]
2025-09-26 14:43:15.913 For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden
2025-09-26 14:43:15.913 Full execution log: '/home/ubuntu/.local/state/rockcraft/log/rockcraft-20250926-144007.309280.log'
Why it needs to get done
it would be really great if this functionality would be added so we can bump the craft_application version in rockcraft and configure our tests better. hope it's not tricky and that i've diagnosed the issue correctly.