Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/cli/cmd/workflow_workflow_run.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2023 The Chainloop Authors.
// Copyright 2023-2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,8 +21,10 @@ import (

func newWorkflowWorkflowRunCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "workflow-run",
Aliases: []string{"run"},
// Keep "run" as the canonical name so the usage and help output read
// "chainloop workflow run" instead of "chainloop workflow workflow-run".
Use: "run",
Aliases: []string{"workflow-run"},
Short: "Workflow Runs related operations",
}

Expand Down
72 changes: 72 additions & 0 deletions app/cli/cmd/workflow_workflow_run_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// Copyright 2026 The Chainloop Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cmd

import (
"testing"

"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

// The workflow run command is reachable both as "run" and through its legacy
// "workflow-run" alias, but the usage/help output must always advertise the
// canonical "chainloop workflow run" path.
func TestWorkflowRunCommandPath(t *testing.T) {
const (
workflowCmd = "workflow"
canonicalRun = "chainloop workflow run"
)

testCases := []struct {
name string
args []string
expectedPath string
}{
{
name: "canonical name",
args: []string{workflowCmd, "run"},
expectedPath: canonicalRun,
},
{
name: "legacy workflow-run alias",
args: []string{workflowCmd, "workflow-run"},
expectedPath: canonicalRun,
},
{
name: "canonical name through the workflow alias",
args: []string{"wf", "run"},
expectedPath: canonicalRun,
},
{
name: "subcommand keeps the canonical parent path",
args: []string{workflowCmd, "workflow-run", "describe"},
expectedPath: "chainloop workflow run describe",
},
}

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
root := &cobra.Command{Use: appName}
root.AddCommand(newWorkflowCmd())

cmd, _, err := root.Find(tc.args)
require.NoError(t, err)
assert.Equal(t, tc.expectedPath, cmd.CommandPath())
})
}
}
90 changes: 45 additions & 45 deletions app/cli/documentation/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4110,50 +4110,14 @@ Options inherited from parent commands
-y, --yes Skip confirmation
```

### chainloop workflow update

Update an existing workflow

```
chainloop workflow update [flags]
```

Options

```
--contract string the name of an existing contract
--description string workflow description
-h, --help help for update
--name string workflow name
--project string project name
--team string team name
```

Options inherited from parent commands

```
--artifact-cas string URL for the Artifacts Content Addressable Storage API ($CHAINLOOP_ARTIFACT_CAS_API) (default "api.cas.chainloop.dev:443")
--artifact-cas-ca string CUSTOM CA file for the Artifacts CAS API (optional) ($CHAINLOOP_ARTIFACT_CAS_API_CA)
-c, --config string Path to an existing config file (default is $HOME/.config/chainloop/config.toml)
--control-plane string URL for the Control Plane API ($CHAINLOOP_CONTROL_PLANE_API) (default "api.cp.chainloop.dev:443")
--control-plane-ca string CUSTOM CA file for the Control Plane API (optional) ($CHAINLOOP_CONTROL_PLANE_API_CA)
--debug Enable debug/verbose logging mode
-i, --insecure Skip TLS transport during connection to the control plane ($CHAINLOOP_API_INSECURE)
--max-recv-msg-size int Max size in bytes for incoming gRPC messages (0 = default 33554432) ($CHAINLOOP_API_MAX_RECV_MSG_SIZE)
-n, --org string organization name
-o, --output string Output format, valid options are json and table (default "table")
-t, --token string API token. NOTE: Alternatively use the env variable CHAINLOOP_TOKEN
-y, --yes Skip confirmation
```

### chainloop workflow workflow-run
### chainloop workflow run

Workflow Runs related operations

Options

```
-h, --help help for workflow-run
-h, --help help for run
```

Options inherited from parent commands
Expand All @@ -4173,12 +4137,12 @@ Options inherited from parent commands
-y, --yes Skip confirmation
```

#### chainloop workflow workflow-run describe
#### chainloop workflow run describe

View a Workflow Run

```
chainloop workflow workflow-run describe [flags]
chainloop workflow run describe [flags]
```

Options
Expand Down Expand Up @@ -4210,17 +4174,17 @@ Options inherited from parent commands
-y, --yes Skip confirmation
```

#### chainloop workflow workflow-run help
#### chainloop workflow run help

Help about any command

Synopsis

Help provides help for any command in the application.
Simply type workflow-run help [path to command] for full details.
Simply type run help [path to command] for full details.

```
chainloop workflow workflow-run help [command] [flags]
chainloop workflow run help [command] [flags]
```

Options
Expand All @@ -4246,12 +4210,12 @@ Options inherited from parent commands
-y, --yes Skip confirmation
```

#### chainloop workflow workflow-run list
#### chainloop workflow run list

List workflow runs

```
chainloop workflow workflow-run list [flags]
chainloop workflow run list [flags]
```

Options
Expand Down Expand Up @@ -4285,3 +4249,39 @@ Options inherited from parent commands
-y, --yes Skip confirmation
```

### chainloop workflow update

Update an existing workflow

```
chainloop workflow update [flags]
```

Options

```
--contract string the name of an existing contract
--description string workflow description
-h, --help help for update
--name string workflow name
--project string project name
--team string team name
```

Options inherited from parent commands

```
--artifact-cas string URL for the Artifacts Content Addressable Storage API ($CHAINLOOP_ARTIFACT_CAS_API) (default "api.cas.chainloop.dev:443")
--artifact-cas-ca string CUSTOM CA file for the Artifacts CAS API (optional) ($CHAINLOOP_ARTIFACT_CAS_API_CA)
-c, --config string Path to an existing config file (default is $HOME/.config/chainloop/config.toml)
--control-plane string URL for the Control Plane API ($CHAINLOOP_CONTROL_PLANE_API) (default "api.cp.chainloop.dev:443")
--control-plane-ca string CUSTOM CA file for the Control Plane API (optional) ($CHAINLOOP_CONTROL_PLANE_API_CA)
--debug Enable debug/verbose logging mode
-i, --insecure Skip TLS transport during connection to the control plane ($CHAINLOOP_API_INSECURE)
--max-recv-msg-size int Max size in bytes for incoming gRPC messages (0 = default 33554432) ($CHAINLOOP_API_MAX_RECV_MSG_SIZE)
-n, --org string organization name
-o, --output string Output format, valid options are json and table (default "table")
-t, --token string API token. NOTE: Alternatively use the env variable CHAINLOOP_TOKEN
-y, --yes Skip confirmation
```

Loading