Skip to content

Commit f551118

Browse files
authored
feat(cli): ask for the organization and project on trace init (#3418)
1 parent 151ee6a commit f551118

43 files changed

Lines changed: 5389 additions & 251 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎app/cli/cmd/artifact.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func wrappedArtifactConn(cpConn *grpc.ClientConn, role pb.CASCredentialsServiceG
4848
}
4949

5050
if apiInsecure() {
51-
logger.Warn().Msg("API contacted in insecure mode")
51+
logger.Debug().Msg("API contacted in insecure mode")
5252
}
5353

5454
var opts = []grpcconn.Option{

‎app/cli/cmd/root.go‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ var (
5252
defaultCASAPI = "api.cas.chainloop.dev:443"
5353
apiToken string
5454
flagYes bool
55+
// authTokenIsUser records whether the credentials in use are a user session
56+
// rather than an API token. Commands that behave differently for the two,
57+
// such as `trace init` skipping organization selection for org-scoped API
58+
// tokens, read it instead of parsing the token again.
59+
authTokenIsUser bool
5560
)
5661

5762
const (
@@ -119,13 +124,14 @@ func NewRootCmd(l zerolog.Logger) *cobra.Command {
119124
}
120125

121126
if apiInsecure() {
122-
logger.Warn().Msg("API contacted in insecure mode")
127+
logger.Debug().Msg("API contacted in insecure mode")
123128
}
124129

125130
authToken, isUserToken, err := loadAuthToken(cmd)
126131
if err != nil {
127132
return err
128133
}
134+
authTokenIsUser = isUserToken
129135

130136
// If the auth token is not set and the command supports federated auth, we try to discover the runner and use the federated token for the runner if available
131137
if authToken == "" && cmdSupportsFederatedAuth(cmd) {

‎app/cli/cmd/trace.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
// traceContractFlagDesc documents the --contract flag `trace init` and
2323
// `trace run` share.
24-
const traceContractFlagDesc = `workflow contract to attach when creating the workflow; it must already exist (default: "chainloop-ai-coding-session" when the organization has it, an empty contract otherwise)`
24+
const traceContractFlagDesc = `workflow contract to attach when creating the workflow; it must already exist and be usable by the project (default: "chainloop-ai-coding-session" when the organization has it, an empty contract otherwise)`
2525

2626
// newTraceCmd creates the trace parent command with all subcommands.
2727
func newTraceCmd() *cobra.Command {

0 commit comments

Comments
 (0)