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
61 changes: 61 additions & 0 deletions cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/massdriver-cloud/mass/pkg/api"
"github.com/massdriver-cloud/mass/pkg/commands/pkg"
"github.com/massdriver-cloud/mass/pkg/files"
"github.com/massdriver-cloud/mass/pkg/prettylogs"

"github.com/charmbracelet/glamour"
"github.com/charmbracelet/lipgloss"
Expand Down Expand Up @@ -122,6 +123,16 @@ func NewCmdPkg() *cobra.Command {
}
pkgDestroyCmd.Flags().BoolP("force", "f", false, "Skip confirmation prompt")

pkgResetCmd := &cobra.Command{
Use: `reset <project>-<env>-<manifest>`,
Short: "Reset package status to 'Initialized'",
Example: `mass package reset api-prod-db`,
Long: helpdocs.MustRender("package/reset"),
Args: cobra.ExactArgs(1),
RunE: runPkgReset,
}
pkgResetCmd.Flags().BoolP("force", "f", false, "Skip confirmation prompt")

pkgCmd.AddCommand(pkgConfigureCmd)
pkgCmd.AddCommand(pkgDeployCmd)
pkgCmd.AddCommand(pkgExportCmd)
Expand All @@ -130,6 +141,7 @@ func NewCmdPkg() *cobra.Command {
pkgCmd.AddCommand(pkgCreateCmd)
pkgCmd.AddCommand(pkgVersionCmd)
pkgCmd.AddCommand(pkgDestroyCmd)
pkgCmd.AddCommand(pkgResetCmd)

return pkgCmd
}
Expand Down Expand Up @@ -456,3 +468,52 @@ func runPkgDestroy(cmd *cobra.Command, args []string) error {

return nil
}

func runPkgReset(cmd *cobra.Command, args []string) error {
ctx := context.Background()

packageSlugOrID := args[0]

force, err := cmd.Flags().GetBool("force")
if err != nil {
return err
}

cmd.SilenceUsage = true

mdClient, mdClientErr := client.New()
if mdClientErr != nil {
return fmt.Errorf("error initializing massdriver client: %w", mdClientErr)
}

// Get package details for confirmation
pkgDetails, err := api.GetPackage(ctx, mdClient, packageSlugOrID)
if err != nil {
return err
}

// Prompt for confirmation unless --force is used
if !force {
fmt.Printf("%s: This will reset package `%s` to 'Initialized' state and delete deployment history.\n", prettylogs.Orange("WARNING"), pkgDetails.Slug)
fmt.Printf("Type `%s` to confirm reset: ", pkgDetails.Slug)
reader := bufio.NewReader(os.Stdin)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)

if answer != pkgDetails.Slug {
fmt.Println("Reset cancelled.")
return nil
}
}

pkg, err := pkg.RunReset(ctx, mdClient, packageSlugOrID)
if err != nil {
return err
}

var name = lipgloss.NewStyle().SetString(pkg.Slug).Foreground(lipgloss.Color("#7D56F4"))
msg := fmt.Sprintf("✅ Package %s reset successfully", name)
fmt.Println(msg)

return nil
}
6 changes: 0 additions & 6 deletions docs/generated/mass_artifact.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ Manage artifacts

Artifacts represent infrastructure resources and connections in Massdriver. They can be provisioned by bundles or manually imported.

## Commands
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these command blocks are redundant - Cobra already shows a list of available commands. Additionally many of them were out of date and missing new commands recently added.


- `get`: Retrieve an artifact's details and metadata
- `download`: Download an artifact in the specified format
- `import`: Import a custom artifact


### Options

Expand Down
4 changes: 0 additions & 4 deletions docs/generated/mass_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ Credential management

Manage credential artifacts in your organization.

## Commands

- `list`: List all credential artifacts


### Options

Expand Down
7 changes: 0 additions & 7 deletions docs/generated/mass_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ Artifact definitions are used to:
- Control how artifacts are displayed in the UI
- Define connections between artifacts

## Commands

- `get`: Retrieve an artifact definition's schema and metadata
- `list`: List all available artifact definitions
- `publish`: Publish a new or updated artifact definition
- `delete`: Delete an artifact definition (requires administrator permissions)


### Options

Expand Down
7 changes: 0 additions & 7 deletions docs/generated/mass_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ Environment management

Environments can be modeled by application stage (production, staging, development), by region (prod-usw, prod-eu), and even ephemerally per developer (alice-dev, bob-dev).

## Commands

- `export`: Export an environment to local filesystem
- `get`: Retrieve environment details and configuration
- `list`: List all environments in a project
- `default`: Set an artifact as the default connection for an environment


### Options

Expand Down
61 changes: 61 additions & 0 deletions docs/generated/mass_logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
id: mass_logs.md
slug: /cli/commands/mass_logs
title: Mass Logs
sidebar_label: Mass Logs
---
## mass logs

Get deployment logs

### Synopsis

# Get Deployment Logs

Retrieves and outputs the log stream for a specific deployment. The logs are dumped to stdout in their original format.

## Usage

```bash
mass logs <deployment-id>
```

Where `<deployment-id>` is the UUID of the deployment.

## Examples

```bash
# Get logs for a deployment
mass logs 12345678-1234-1234-1234-123456789012

# Pipe logs to a file
mass logs 12345678-1234-1234-1234-123456789012 > deployment.log
```

## Notes

- Logs are output to stdout in their original format
- This command does not support tailing/following logs - it dumps all available logs
- The deployment ID can be found in the Massdriver UI or from deployment-related commands


```
mass logs [deployment-id] [flags]
```

### Examples

```
# Get logs for a deployment
mass logs 12345678-1234-1234-1234-123456789012
```

### Options

```
-h, --help help for logs
```

### SEE ALSO

* [mass](/cli/commands/mass) - Massdriver Cloud CLI
9 changes: 1 addition & 8 deletions docs/generated/mass_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ Packages are used to:
- Manage environment-specific settings
- Connect different components together

## Commands

- `configure`: Update package configuration
- `deploy`: Deploy a package to an environment
- `export`: Export a package to your local filesystem
- `get`: Retrieve package details and configuration
- `patch`: Update individual package parameter values


### Options

Expand All @@ -45,4 +37,5 @@ Packages are used to:
* [mass package export](/cli/commands/mass_package_export) - Export packages
* [mass package get](/cli/commands/mass_package_get) - Get a package
* [mass package patch](/cli/commands/mass_package_patch) - Patch individual package parameter values
* [mass package reset](/cli/commands/mass_package_reset) - Reset package status to 'Initialized'
* [mass package version](/cli/commands/mass_package_version) - Set package version
49 changes: 49 additions & 0 deletions docs/generated/mass_package_reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
id: mass_package_reset.md
slug: /cli/commands/mass_package_reset
title: Mass Package Reset
sidebar_label: Mass Package Reset
---
## mass package reset

Reset package status to 'Initialized'

### Synopsis

# Reset Package Status

This command allows you to reset a package status back to 'Initialized'. This should only be used when a package is in an unrecoverable state - common situations include a package stuck in 'Pending' due to deployment issues, or a package that cannot be successfully decommissioned due to deployment failures.

## Examples

You can reset the package using the `slug` identifier.

The `slug` can be found by hovering over the bundle in the Massdriver diagram. The package slug is a combination of the `<project-slug>-<env-slug>-<manifest-slug>`

Reset and delete the deployment history:

```shell
mass package reset ecomm-prod-vpc
```


```
mass package reset <project>-<env>-<manifest> [flags]
```

### Examples

```
mass package reset api-prod-db
```

### Options

```
-f, --force Skip confirmation prompt
-h, --help help for reset
```

### SEE ALSO

* [mass package](/cli/commands/mass_package) - Manage packages of IaC deployed in environments.
6 changes: 0 additions & 6 deletions docs/generated/mass_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ Project management

A project can encompass many environments (permanent or ephemeral) and manages the parity across those environments.

## Commands

- `export`: Export a project to your local filesystem
- `get`: Retrieve project details and configuration
- `list`: List all projects in your organization


### Options

Expand Down
6 changes: 0 additions & 6 deletions docs/helpdocs/artifact.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Manage Massdriver artifacts

Artifacts represent infrastructure resources and connections in Massdriver. They can be provisioned by bundles or manually imported.

## Commands

- `get`: Retrieve an artifact's details and metadata
- `download`: Download an artifact in the specified format
- `import`: Import a custom artifact
4 changes: 0 additions & 4 deletions docs/helpdocs/credential.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Credential Management

Manage credential artifacts in your organization.

## Commands

- `list`: List all credential artifacts
7 changes: 0 additions & 7 deletions docs/helpdocs/definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,3 @@ Artifact definitions are used to:
- Specify how artifacts are created and managed
- Control how artifacts are displayed in the UI
- Define connections between artifacts

## Commands

- `get`: Retrieve an artifact definition's schema and metadata
- `list`: List all available artifact definitions
- `publish`: Publish a new or updated artifact definition
- `delete`: Delete an artifact definition (requires administrator permissions)
7 changes: 0 additions & 7 deletions docs/helpdocs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,3 @@
[Environments](https://docs.massdriver.cloud/concepts/environments) are the workspaces that bundles will be deployed to.

Environments can be modeled by application stage (production, staging, development), by region (prod-usw, prod-eu), and even ephemerally per developer (alice-dev, bob-dev).

## Commands

- `export`: Export an environment to local filesystem
- `get`: Retrieve environment details and configuration
- `list`: List all environments in a project
- `default`: Set an artifact as the default connection for an environment
8 changes: 0 additions & 8 deletions docs/helpdocs/package.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,3 @@ Packages are used to:
- Configure application services
- Manage environment-specific settings
- Connect different components together

## Commands

- `configure`: Update package configuration
- `deploy`: Deploy a package to an environment
- `export`: Export a package to your local filesystem
- `get`: Retrieve package details and configuration
- `patch`: Update individual package parameter values
15 changes: 15 additions & 0 deletions docs/helpdocs/package/reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Reset Package Status

This command allows you to reset a package status back to 'Initialized'. This should only be used when a package is in an unrecoverable state - common situations include a package stuck in 'Pending' due to deployment issues, or a package that cannot be successfully decommissioned due to deployment failures.

## Examples

You can reset the package using the `slug` identifier.

The `slug` can be found by hovering over the bundle in the Massdriver diagram. The package slug is a combination of the `<project-slug>-<env-slug>-<manifest-slug>`

Reset and delete the deployment history:

```shell
mass package reset ecomm-prod-vpc
```
6 changes: 0 additions & 6 deletions docs/helpdocs/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@
[Projects](https://docs.massdriver.cloud/concepts/projects) act as permission and replication boundaries in Massdriver.

A project can encompass many environments (permanent or ephemeral) and manages the parity across those environments.

## Commands

- `export`: Export a project to your local filesystem
- `get`: Retrieve project details and configuration
- `list`: List all projects in your organization
Loading
Loading