← Back to issue list

"name" validation is broken for names with 2 characters

View original Github issue

Metadata

Project
rockcraft
Number
#943
Type
issue
State
open
Author
cjdcordeiro
Labels
Status: Triaged Type: Bug
Created
2025-08-26 11:15:30+00:00
Updated
2026-02-26 16:54:09+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Bug Description When packing a rock with a 2-characters name, Rockcraft will raise a project validation exception, claiming the `name` is invalid, but with the wrong reasons. Relevant code: https://github.com/canonical/rockcraft/blob/f5d1ebb189890519a37e3e1d3cce347cee5eee36/rockcraft/models/project.py#L50 ### To Reproduce Pack the rockcraft.yaml below. ### Environment Tested with the `latest/edge` and `latest/stable` versions of Rockcraft ### rockcraft.yaml ```yaml name: jq # see https://documentation.ubuntu.com/rockcraft/en/latest/explanation/bases/ # for more information about bases and using 'bare' bases for chiselled rocks base: ubuntu@24.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: parts: my-part: plugin: nil ``` ### Relevant log output ```shell Bad rockcraft.yaml content: - invalid name for rock: Names can only use ASCII lowercase letters, numbers, and hyphens. They must start with a lowercase letter, may not end with a hyphen, and may not have two hyphens in a row. (in field 'name') For more information, check out: https://documentation.ubuntu.com/rockcraft/en/latest/reference/rockcraft.yaml ```

Evaluation history

No evaluation history available.