[bug]: config apply -f fails silently to parse configuration files using the configurations wrapper
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in cmd/harbor/root/configurations/apply.go and inspect how the YAML/JSON data is unmarshaled into models.Configurations. Reproduce the issue with harbor config apply -f config.yaml, then verify that the documented configurations wrapper is applied while the flat format remains compatible. Done means the command no longer reports no changes for nested configuration input.
Written by the indexing model from the issue text.
Description
Description
The harbor config apply command fails silently when applying configuration files that nest configuration parameters under a top-level configurations: key (which is the format officially documented in the command synopsis). Instead of applying the configurations, the command unmarshals an empty configurations struct and outputs ✓ No changes detected. without applying any updates or returning an error.
Steps to Reproduce
- Create a configuration file named
config.yamlwith the following nested structure:
configurations:
authmode: db_auth
- Run the command:
harbor config apply -f config.yaml - Observe the output:
✓ No changes detected.
Expected Behavior
The configuration options nested under the configurations key should be parsed successfully and applied/updated on the Harbor server.
Actual Behavior
The CLI silently ignores all fields nested under the configurations wrapper because the parser attempts to unmarshal the file directly into a flat *models.Configurations struct, which has no matching field for configurations.
Environment
- OS: Windows / Linux / macOS
- Tool version: Latest main (v0.9.0-dev)
- Other relevant details: Go version 1.26.3
Additional Context
I have verified the root cause in cmd/harbor/root/configurations/apply.go. The parser directly unmarshals the YAML/JSON data into var configurations *models.Configurations without checking for the top-level wrapper first:
if err := yaml.Unmarshal(data, &configurations); err != nil {
return fmt.Errorf("failed to parse YAML: %v", err)
}
This can be resolved by first attempting to parse the nested structure via a wrapper struct, and falling back to the flat format to preserve backward compatibility.
- Dominant language
- Go
- Stars
- 163
- Forks
- 212
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from goharbor/harbor-cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
goharbor/harbor-cli#1102 ·
-
[bug]: harbor webhook list cmd renders both interactive ui and json when format specified is json Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
goharbor/harbor-cli#1098 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
goharbor/harbor-cli#1096 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
goharbor/harbor-cli#1080 ·
-
bug status/has-approved-pr
Difficulty 1/5 Under an hour Newbie friendliness 90/100
goharbor/harbor-cli#1072 · 1 comment ·
All issues in goharbor/harbor-cli
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100