Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,6 @@ All commits must meet these criteria:
Code reviews are required for all submissions via GitHub pull requests.
- make sure golang code is always formatted and golang-ci-lint is run


- I do not want you to be in the co-author signoff
- make sure all go code is go-fmt
1 change: 1 addition & 0 deletions app/cli/cmd/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func newOrganizationCmd() *cobra.Command {
newOrganizationUpdateCmd(),
newOrganizationSet(),
newOrganizationLeaveCmd(),
newOrganizationDeleteCmd(),
newOrganizationDescribeCmd(),
newOrganizationAPITokenCmd(),
newOrganizationMemberCmd(),
Expand Down
59 changes: 59 additions & 0 deletions app/cli/cmd/organization_delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// Copyright 2025 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 (
"fmt"

"github.com/chainloop-dev/chainloop/app/cli/internal/action"
"github.com/spf13/cobra"
)

func newOrganizationDeleteCmd() *cobra.Command {
var orgName string
cmd := &cobra.Command{
Use: "delete",
Short: "Delete an organization",
Long: "Delete an organization. Only organization owners can delete an organization.",
RunE: func(cmd *cobra.Command, _ []string) error {
ctx := cmd.Context()

fmt.Printf("You are about to delete the organization %q\n", orgName)
fmt.Println("This action will permanently delete the organization and all its data.")

// Ask for confirmation
if err := confirmDeletion(); err != nil {
return err
}

if err := action.NewOrganizationDelete(actionOpts).Run(ctx, orgName); err != nil {
return fmt.Errorf("deleting organization: %w", err)
}

// Clear local state if we just deleted the current organization
if err := setLocalOrganization(""); err != nil {
return fmt.Errorf("writing config file: %w", err)
}

logger.Info().Str("organization", orgName).Msg("Organization deleted")
return nil
},
}

cmd.Flags().StringVar(&orgName, "name", "", "organization name")
cobra.CheckErr(cmd.MarkFlagRequired("name"))
return cmd
}
35 changes: 35 additions & 0 deletions app/cli/documentation/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2193,6 +2193,41 @@ Options inherited from parent commands
-y, --yes Skip confirmation
```

### chainloop organization delete

Delete an organization

Synopsis

Delete an organization. Only organization owners can delete an organization.

```
chainloop organization delete [flags]
```

Options

```
-h, --help help for delete
--name string organization 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)
-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 organization describe

Describe the current organization
Expand Down
36 changes: 36 additions & 0 deletions app/cli/internal/action/organization_delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// Copyright 2025 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 action

import (
"context"

pb "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1"
)

type OrganizationDelete struct {
cfg *ActionsOpts
}

func NewOrganizationDelete(cfg *ActionsOpts) *OrganizationDelete {
return &OrganizationDelete{cfg}
}

func (action *OrganizationDelete) Run(ctx context.Context, orgName string) error {
client := pb.NewOrganizationServiceClient(action.cfg.CPConnection)
_, err := client.Delete(ctx, &pb.OrganizationServiceDeleteRequest{Name: orgName})
return err
}
Loading
Loading