feat(cli): allow setting project name in .chainloop.yaml#3065
Open
waveywaves wants to merge 1 commit intochainloop-dev:mainfrom
Open
feat(cli): allow setting project name in .chainloop.yaml#3065waveywaves wants to merge 1 commit intochainloop-dev:mainfrom
waveywaves wants to merge 1 commit intochainloop-dev:mainfrom
Conversation
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/cli/cmd/config.go">
<violation number="1" location="app/cli/cmd/config.go:165">
P2: Added `.chainloop` `organization` field is unused, causing a silent no-op that can mislead users.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
| type DotChainloopConfig struct { | ||
| ProjectVersion string `yaml:"projectVersion"` | ||
| Project string `yaml:"project"` | ||
| Organization string `yaml:"organization"` |
There was a problem hiding this comment.
P2: Added .chainloop organization field is unused, causing a silent no-op that can mislead users.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/cli/cmd/config.go, line 165:
<comment>Added `.chainloop` `organization` field is unused, causing a silent no-op that can mislead users.</comment>
<file context>
@@ -161,4 +161,6 @@ func isDir(filename string) bool {
type DotChainloopConfig struct {
ProjectVersion string `yaml:"projectVersion"`
+ Project string `yaml:"project"`
+ Organization string `yaml:"organization"`
}
</file context>
Extend DotChainloopConfig to support a `project` field so that `chainloop attestation init` can read the project name from the config file when the --project flag is not provided. Precedence: CLI flag > .chainloop.yaml > default. Example .chainloop.yaml: project: my-project projectVersion: v1.2.0 Note: organization override from .chainloop.yaml is not included in this PR because the org is baked into the gRPC connection credentials during PersistentPreRunE, before att init's PreRunE runs. Supporting org override requires loading the config earlier in the command lifecycle — left for follow-up discussion. Fixes: chainloop-dev#3063 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
2abca03 to
50ce228
Compare
Contributor
Author
|
@migmartri @jiparis Ready for review. Extends |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3063.
Extends
.chainloop.yamlto support aprojectfield, sochainloop attestation initcan resolve the project name from config when--projectis not provided.Changes
config.go: AddedProjectandOrganizationfields toDotChainloopConfigstructattestation_init.go: Extended the PreRunE config loader to populateprojectNamefrom config when the CLI flag is empty. Same precedence pattern asprojectVersion: CLI flag >.chainloop.yaml> default.MarkFlagRequired("project"): The flag is no longer required by cobra since the value can come from config. The existing deprecation warning at line 156 still fires when neither flag nor config provides a project name.Example
.chainloop.yaml```yaml
project: my-project
projectVersion: v1.2.0
```
Note on organization
The
Organizationfield is added to the struct for forward-compatibility, but org override is not wired up in this PR. The organization is baked into the gRPC connection credentials duringPersistentPreRunE(root.go:169), beforeatt init'sPreRunEruns. Supporting org from config requires loading.chainloop.yamlearlier in the command lifecycle — left for follow-up discussion.Test plan
go build ./...passesatt initwith--projectflag still works as beforeatt initwithout--projectreads from.chainloop.yaml🤖 Generated with Claude Code