canonical / rockcraft

Tool to create OCI Images using the language from Snapcraft and Charmcraft.
GNU General Public License v3.0
34 stars 42 forks source link

some commands, like clean, should not need schema validation #613

Open cjdcordeiro opened 3 months ago

cjdcordeiro commented 3 months ago

Bug Description

Some commands, like clean, should not need such a strict schema validation, if all they gonna do is “clean”. IoW, if I want to clean my project, the YAML shouldn't have an impact on the operation.

To Reproduce

Write a bogus rockcraft.yaml and run rockcraft clean.

Environment

Any

rockcraft.yaml

name: my-rock
base: ubuntu@22.04 # the base environment for this rock
version: '0.1' # just for humans. Semantic versioning is recommended
summary: Single-line elevator pitch for your amazing rock # 79 char long summary
description: |
    This is my-rock-name's description. You have a paragraph or two to tell the
    most important story about it. Keep it under 100 words though,
    we live in tweetspace and your description wants to look good in the
    container registries out there.
platforms: # the platforms this rock should be built on and run on
    amd64:

some-unsupported-field: foo

parts:
    my-part:
        plugin: nil

Relevant log output

Bad rockcraft.yaml content:
- extra field 'some-unsupported-field' not permitted in top-level configuration                                                                                                                                                 
For more information, check out: https://documentation.ubuntu.com/rockcraft/en/stable/reference/rockcraft.yaml   
tigarmo commented 3 months ago

I agree in the general sense but not with the example: the name, platforms and base are how we keep track of the instances (so we wouldn't know what to clean without them):


❯ lxc --project=rockcraft list
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
|                             NAME                              |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| base-instance-rockcraft-buildd-base-v7-c-a38d05774a6de0cf6ab1 | STOPPED |      |      | CONTAINER | 0         |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| rockcraft-hello-on-amd64-for-amd64-16398450                   | STOPPED |      |      | CONTAINER | 0         |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| rockcraft-redis-on-amd64-for-amd64-16519802                   | STOPPED |      |      | CONTAINER | 0         |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
cjdcordeiro commented 3 months ago

True, good point. I choose the wrong attribute to remove :laughing: (updating the description)