Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove 'n' from the name flag #86

Merged
merged 4 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
10 changes: 9 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ linters:

linters-settings:
gofmt:
simplify: true
simplify: true
issues:
exclude-dirs:
- '.*pkg/mod.*'
- '.*go/.*'
- '.*Cellar.*' # Skip Homebrew Go installation directory
- '.*libexec.*'
exclude-files:
- '.*toolchain@.*'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ print_home:


local.deploy: local.build ## Deploys locally built Helm plugin
@rm -rf ${HOME}/Library/helm/plugins/helm-kanvas-snapshot/bin/helm-kanvas-snapshot
@rm -rf ${HOME}/Library/helm/plugins/helm-kanvas-snapshot/bin/helm-kanvas-snapshot
@cp helm-images ${HOME}/Library/helm/plugins/helm-kanvas-snapshot/bin/helm-kanvas-snapshot


Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ To install the Meshery Snapshot Helm Plugin, use the following steps:
Once the plugin is installed, you can generate a snapshot using either a packaged or unpackaged Helm chart.

```bash
helm helm-kanvas-snapshot -f <chart-URI> [-n <snapshot-name>] [-e <email>]
helm helm-kanvas-snapshot -f <chart-URI> [--name <snapshot-name>] [-e <email>]
```

- **`-f`**, **`--file`**: (required) path or URL to the Helm chart (required).
- **`-n`**, **`--name`**: (optional) name for the snapshot. If not provided, a name will be auto-generated based on the chart name.
- **`--name`**: (optional) name for the snapshot. If not provided, a name will be auto-generated based on the chart name.
- **`-e`, **`--email`**: (optional) email address to notify when snapshot is ready. If not provided, a link to the snapshot will be displayed in the terminal.

**Example**

To generate a snapshot for a Helm chart located at `https://meshery.io/charts/v0.8.0-meshery.tar.gz`, you can use:

```bash
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz -n meshery-chart
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz --name meshery-chart
```

## Contributing
Expand Down Expand Up @@ -128,7 +128,7 @@ helm plugin install kanvas-snapshot
Once the plugin is built, you can test it locally. For example, to generate a snapshot for a Helm chart, run the following command:

```bash
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz -n meshery-chart
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz --name meshery-chart
```

This command will trigger the snapshot generation process. If everything is set up correctly, you should see a visual snapshot URL or receive the snapshot via email, depending on the options you specified.
Expand Down
17 changes: 9 additions & 8 deletions cmd/kanvas-snapshot/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@

Example usage:

helm kanvas-snapshot -n nginx-helm -f https://meshery.github.io/meshery.io/charts/meshery-v0.7.109.tgz -e your-email@example.com
helm kanvas-snapshot -f https://meshery.github.io/meshery.io/charts/meshery-v0.7.109.tgz -e your-email@example.com --name nginx-helm

Flags:
-f, --file string URI to Helm chart (required)
-n, --name string (optional name for the Meshery design
-f, --file string URI to Helm chart (required)
-e, --email string email address to notify when snapshot is ready (required)
--name string (optional name for the Meshery design
leecalcote marked this conversation as resolved.
Show resolved Hide resolved
-h Help for Helm Kanvas Snapshot plugin`,

RunE: func(_ *cobra.Command, _ []string) error {
Expand All @@ -66,9 +66,8 @@
handleError(errors.ErrCreatingMesheryDesign(err))
}

assetLocation := fmt.Sprintf("https://raw.githubusercontent.com/layer5labs/meshery-extensions-packages/master/action-assets/%s.png", designID)
assetLocation := fmt.Sprintf("https://raw.githubusercontent.com/layer5labs/meshery-extensions-packages/master/action-assets/helm-plugin-assets/%s.png", designID)

Check warning on line 69 in cmd/kanvas-snapshot/cmd.go

View check run for this annotation

Codecov / codecov/patch

cmd/kanvas-snapshot/cmd.go#L69

Added line #L69 was not covered by tests

// Generate Snapshot
err = GenerateSnapshot(designID, assetLocation, WorkflowAccessToken)
if err != nil {
handleError(errors.ErrGeneratingSnapshot(err))
Expand Down Expand Up @@ -243,14 +242,16 @@
MesheryAPIBaseURL = mesheryAPIBaseURL
WorkflowAccessToken = workflowAccessToken
generateKanvasSnapshotCmd.Flags().StringVarP(&chartURI, "file", "f", "", "URI to Helm chart (required)")
generateKanvasSnapshotCmd.Flags().StringVarP(&designName, "design-name", "n", "", "Optional name for the Meshery design")
generateKanvasSnapshotCmd.Flags().StringVar(&designName, "name", "", "Optional name for the Meshery design")

Check warning on line 245 in cmd/kanvas-snapshot/cmd.go

View check run for this annotation

Codecov / codecov/patch

cmd/kanvas-snapshot/cmd.go#L245

Added line #L245 was not covered by tests
generateKanvasSnapshotCmd.Flags().StringVarP(&email, "email", "e", "", "Optional email to associate with the Meshery design")

_ = generateKanvasSnapshotCmd.MarkFlagRequired("file")

if err := generateKanvasSnapshotCmd.Execute(); err != nil {
Log.Error(err)
os.Exit(1)
errors.ErrHTTPPostRequest(err)
generateKanvasSnapshotCmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
return nil
})

Check warning on line 254 in cmd/kanvas-snapshot/cmd.go

View check run for this annotation

Codecov / codecov/patch

cmd/kanvas-snapshot/cmd.go#L251-L254

Added lines #L251 - L254 were not covered by tests
}
}

Expand Down
Binary file removed cmd/kanvas-snapshot/kanvas-snapshot
Binary file not shown.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/meshery/helm-kanvas-snapshot

go 1.21.8
go 1.23
Copy link
Member

Choose a reason for hiding this comment

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

👍


toolchain go1.23.4

require (
Expand Down
Loading