← Back to issue list

meta: implement pass-through of properties to snap.yaml

View original Github issue

Metadata

Project
snapcraft
Number
#2053
Type
pull request
State
merged
Author
kalikiana
Labels
—
Created
Updated
Closed

Current evaluation

Merged #2053 as f9b75a974, adding global and app-local passthrough metadata, ambiguity checks, and warnings for unvalidated snap.yaml properties.

Resolution: closed resolved

Reason: PR #2053 was merged as commit f9b75a974. It implemented the passthrough feature requested in snapcraft#2026.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- This PR introduces a new **pass-through** keyword to `snapcraft.yaml` which comes in two forms, a global and an app-local property [as proposed in the forum](https://forum.snapcraft.io/t/support-for-passthrough-into-snap-yaml/4698). As proposed, the key is just defined as a dictionary (object in the schema) and not validated, but instead applied in `snap_packaging.py` where its use will be logged and ambiguous keys will raise an error. The original snapcraft.yaml is used to validate what values have been specified as opposed to default values filled in by Snapcraft. Note that, as discussed offline, properties like `name` or `command` are not special-cased and not supported by pass-through due to their being strings processed by Snapcraft. The following tests are added/ modified: - tests.unit.test_errors - To verify AmbiguousPassThroughError - tests.unit.test_meta.PassThroughTestCase - To verify that a) a new key not present in the schema can be added b) an existing key can be overridden c) a key both present in the schema and pass-through raising an error d) defaults can be overridden rather than error out because of the check for amiguity e) a warning being logged for using pass-through. Each of these is tested with the global and the apps form. I locally ran the tests: - `./runtests.sh tests/unit` with unrelated failures in [tests.unit.test_lifecycle.CoreSetupTestCase.test_core_setup_if_docker_env](https://bugs.launchpad.net/snapcraft/+bug/1752576), `tests.unit.test_mangling.TestClearExecstack.test_execstack_clears` and `tests.unit.test_elf`. - `./runtests.sh tests/integration` with one unrelated failure in [tests.integration.general.test_parser.TestParserWikis](https://bugs.launchpad.net/snapcraft/+bug/1752580) - `./runtests.sh static`: Everything passed Manual test steps: - cd tests/integration/snaps/basic - Add some pass-through properties: pass-through: foo: bar confinement: next-generation apps: foo: command: echo daemon: simple pass-through: foo: bar daemon: complex - snapcraft - Observe the error "Failed to pass-through keys to snap metadata: 'daemon' is specified as both a regular key and in pass-through. Remove one of the keys.". - Fix the error by removing "daemon: simple" from the "foo" app. - snapcraft - Observe the error "Failed to pass-through keys to snap metadata: 'confinement' is specified as both a regular key and in pass-through. Remove one of the keys.". - Fix the error by removing "confinement: classic" from the top. - snapcraft - Observe that that the build succeeds with two warnings: Pass-through is being used to add experimental properties to 'foo' that have not been validated. The snap cannot be released to the store. Pass-through is being used to add experimental properties to 'snapcraft.yaml' that have not been validated. The snap cannot be released to the store. - grep -C 3 foo prime/meta/snap.yaml confinement: next-generation grade: stable apps: foo: command: command-foo.wrapper daemon: complex foo: bar foo: bar - Observe keys being propagated to snap.yaml without validation.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #2053 as f9b75a974, adding global and app-local passthrough metadata, ambiguity checks, and warnings for unvalidated snap.yaml properties.
stealth/space-bunny-alpha — closed resolved Merged in #2053 as f9b75a974, adding global and app-local pass-through properties to snap.yaml with ambiguity checks and warnings for unvalidated metadata.
stealth/space-bunny-alpha — closed resolved Merged pass-through support in #2053, forwarding global and app-local snapcraft.yaml properties to snap.yaml with ambiguity checks and warnings.
qwen/qwen3.6-35b-a3b — — Merged implementation of a pass-through keyword in snapcraft.yaml, enabling arbitrary properties to be forwarded to snap.yaml without validation. Approved by reviewers and passed CI checks.
qwen3.6-35b-a3b-mtp-q6 — — Merged pass-through support in snapcraft.yaml to inject unvalidated properties into snap.yaml. Raises errors for ambiguous keys and logs warnings for experimental properties. Reviewers suggested extending to hooks.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#2026 (confidence 99%)

    The passthrough feature issue was implemented by this merged PR.

Related issues

Issue Project State Summary Similarity
#2026 Implement a passthrough feature snapcraft closed Passthrough for new snapd keywords shipped in PR #2053 (commit f9b75a974, 'meta: implement passthrough of properties to snap.yaml'), later softened by #2091 and scrubbed for snap.yaml in #2914.
76%
#1862197 passthrough field being added to snap.yaml snapcraft (launchpad) closed App-level `passthrough` keys were copied verbatim into the generated meta/snap.yaml, triggering manual review on store builds. Fixed by merged PR snapcore/snapcraft#2914 (commit da9508fd3), released in snapcraft 3.10; passthrough is now dropped from snap.yaml.
74%
#2914 meta: ensure Application passthrough is scrubbed for snap.yaml snapcraft merged Merged PR #2914 fixed snap.yaml generation to scrub Application passthrough metadata; commit da9508fd3 added unit and spread coverage.
73%