Skip to content

Commit

Permalink
Merge branch 'main' of ssh://github.com/otterize/otterize-cli into or…
Browse files Browse the repository at this point in the history
…isho/fix_slices_change
  • Loading branch information
orishoshan committed Jul 25, 2024
2 parents 619cf21 + a1f6411 commit 497af93
Show file tree
Hide file tree
Showing 22 changed files with 1,982 additions and 353 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/golangci-lint.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
name: golangci
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-go@v3
with:
go-version: 1.22
- uses: actions/checkout@v3

- name: go vet
run: go vet ./...
working-directory: .

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -43,4 +51,18 @@ jobs:
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
# skip-build-cache: true

markdownlint:
name: Check for Markdown errors
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

# Tip: run the markdown lint action locally with '--fix' to automatically fix some of the issues:
# docker run -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "**/*.md" --fix
- uses: articulate/actions-markdownlint@v1
with:
config: .markdownlint.json
files: '**/*.md'
83 changes: 44 additions & 39 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

version: 2

builds:
- id: linux
goos:
Expand Down Expand Up @@ -137,7 +140,7 @@ brews:

# GitHub/GitLab repository to push the formula to
# Gitea is not supported yet, but the support coming
tap:
repository:
owner: otterize
name: homebrew-otterize

Expand All @@ -151,7 +154,7 @@ brews:

# Folder inside the repository to put the formula.
# Default is the root folder.
folder: Formula
directory: Formula

# Your app's homepage.
# Default is empty.
Expand All @@ -164,43 +167,45 @@ brews:
# Default is empty.
license: "Apache-2.0"

scoop:
# Template for the url which is determined by the given Token (github or gitlab)
# Default for github is "https://github.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
# Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/-/releases/{{ .Tag }}/downloads/{{ .ArtifactName }}"
# Default for gitea is "https://gitea.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
url_template: "https://get.otterize.com/{{ .ProjectName }}/{{ .Tag }}/{{ .ArtifactName }}"
name: otterize-cli

# Repository to push the app manifest to.
bucket:
owner: otterize
name: scoop-otterize-cli

# Optionally a branch can be provided.
# Defaults to the default repository branch.
branch: main

# Git author used to commit to the repository.
# Defaults are shown.
commit_author:
name: otterizebot
email: otterizebot@users.noreply.github.com

# The project name and current git tag are used in the format string.
commit_msg_template: "Scoop update for {{ .ProjectName }} version {{ .Tag }}"

# Your app's homepage.
# Default is empty.
homepage: "https://github.com/otterize/otterize-cli"

# Your app's description.
# Default is empty.
description: "Otterize CLI"

# Your app's license
# Default is empty.
license: "Apache-2.0"
scoops:
# You can have multiple scoop configs
-
# Template for the url which is determined by the given Token (github or gitlab)
# Default for github is "https://github.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
# Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/-/releases/{{ .Tag }}/downloads/{{ .ArtifactName }}"
# Default for gitea is "https://gitea.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
url_template: "https://get.otterize.com/{{ .ProjectName }}/{{ .Tag }}/{{ .ArtifactName }}"
name: otterize-cli

# Repository to push the app manifest to.
repository:
owner: otterize
name: scoop-otterize-cli

# Optionally a branch can be provided.
# Defaults to the default repository branch.
branch: main

# Git author used to commit to the repository.
# Defaults are shown.
commit_author:
name: otterizebot
email: otterizebot@users.noreply.github.com

# The project name and current git tag are used in the format string.
commit_msg_template: "Scoop update for {{ .ProjectName }} version {{ .Tag }}"

# Your app's homepage.
# Default is empty.
homepage: "https://github.com/otterize/otterize-cli"

# Your app's description.
# Default is empty.
description: "Otterize CLI"

# Your app's license
# Default is empty.
license: "Apache-2.0"

blobs:
# You can have multiple blob configs
Expand Down
5 changes: 5 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"default": true,
"MD013": false,
"MD033": false
}
6 changes: 3 additions & 3 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at help@otterize.com. All
reported by contacting the project team at <help@otterize.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand All @@ -68,9 +68,9 @@ members of the project's leadership.
## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
<https://www.contributor-covenant.org/faq>
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The Otterize CLI is a command-line utility used to control and interact with the
See the [CLI command reference](https://docs.otterize.com/reference/cli) for how to use it.

Example output from running the network mapper on the [Google Cloud microservices demo](https://github.com/GoogleCloudPlatform/microservices-demo):

```bash
$ otterize mapper list
cartservice in namespace ecommerce calls:
Expand All @@ -37,44 +38,57 @@ recommendationservice in namespace ecommerce calls:
```

## Installation instructions & usage with the network mapper

### Install the network mapper using Helm

```bash
helm repo add otterize https://helm.otterize.com
helm repo update
helm install network-mapper otterize/network-mapper -n otterize-system --create-namespace --wait
```

### Install Otterize CLI to query data from the network mapper

Mac

```bash
brew install otterize/otterize/otterize-cli
```

Linux 64-bit

```bash
wget https://get.otterize.com/otterize-cli/v1.0.2/otterize_linux_x86_64.tar.gz
wget https://get.otterize.com/otterize-cli/v1.0.5/otterize_linux_x86_64.tar.gz
tar xf otterize_linux_x86_64.tar.gz
sudo cp otterize /usr/local/bin
```

Windows

```bash
scoop bucket add otterize-cli https://github.com/otterize/scoop-otterize-cli
scoop update
scoop install otterize-cli
```
For more platforms, see [the installation guide](https://docs.otterize.com/installation#install-the-otterize-cli).

For more platforms, see [the installation guide](https://docs.otterize.com/installation#install-the-otterize-cli).

## Contributing

1. Feel free to fork and open a pull request! Include tests and document your code in [Godoc style](https://go.dev/blog/godoc)
2. In your pull request, please refer to an existing issue or open a new one.
3. See our [Contributor License Agreement](https://github.com/otterize/cla/).

## Slack

[Join the Otterize Slack!](https://joinslack.otterize.com)

## Usage Telemetry
## Usage Telemetry

The CLI reports anonymous usage information back to the Otterize team, to help the team understand how the software is used in the community and what aspects users find useful. No personal or organizational identifying information is transmitted in these metrics: they only reflect patterns of usage. You may opt out at any time through a single configuration flag.

To **disable** sending usage information:

- Using a flag: `--telemetry-enabled=false`.
- Via an environment variable: `OTTERIZE_TELEMETRY_ENABLED=false`.

Expand Down
4 changes: 2 additions & 2 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/cmd/integrations/create/create-github-integration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package create

import (
"github.com/otterize/otterize-cli/src/pkg/output"
"github.com/spf13/cobra"
)

var CreateGithubIntegrationCmd = &cobra.Command{
Use: "github",
Short: "Create a GitHub integration",
Args: cobra.NoArgs,
SilenceUsage: true,
RunE: func(_ *cobra.Command, args []string) error {
output.PrintStdout("To create a GitHub integration, you need to authorize Otterize Cloud on your GitHub account. To do that, use Otterize Cloud at https://app.otterize.com/integrations")
return nil
},
}
1 change: 1 addition & 0 deletions src/cmd/integrations/create/create-integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ func init() {
CreateIntegrationCmd.AddCommand(CreateKubernetesIntegrationCmd)
CreateIntegrationCmd.AddCommand(CreateGenericIntegrationCmd)
CreateIntegrationCmd.AddCommand(CreateDatabaseIntegrationCmd)
CreateIntegrationCmd.AddCommand(CreateGithubIntegrationCmd)
}
12 changes: 7 additions & 5 deletions src/cmd/integrations/create/create-kubernetes-integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
)

const (
EnvironmentIDKey = "env-id"
ClusterIDKey = "cluster-id"
EnvironmentIDKey = "env-id"
IntegrationNameKey = "name"
IntegrationNameShorthand = "n"
)

var CreateKubernetesIntegrationCmd = &cobra.Command{
Expand All @@ -33,7 +34,7 @@ var CreateKubernetesIntegrationCmd = &cobra.Command{
r, err := c.CreateKubernetesIntegrationMutationWithResponse(ctxTimeout,
cloudapi.CreateKubernetesIntegrationMutationJSONRequestBody{
EnvironmentId: lo.Ternary(viper.IsSet(EnvironmentIDKey), lo.ToPtr(viper.GetString(EnvironmentIDKey)), nil),
ClusterId: viper.GetString(ClusterIDKey),
Name: viper.GetString(IntegrationNameKey),
})
if err != nil {
return err
Expand All @@ -46,6 +47,7 @@ var CreateKubernetesIntegrationCmd = &cobra.Command{

func init() {
CreateKubernetesIntegrationCmd.Flags().String(EnvironmentIDKey, "", "default environment id")
CreateKubernetesIntegrationCmd.Flags().String(ClusterIDKey, "", "cluster id")
cobra.CheckErr(CreateKubernetesIntegrationCmd.MarkFlagRequired(ClusterIDKey))
CreateKubernetesIntegrationCmd.Flags().StringP(IntegrationNameKey, IntegrationNameShorthand, "", "integration name")
cobra.CheckErr(CreateKubernetesIntegrationCmd.MarkFlagRequired(EnvironmentIDKey))
cobra.CheckErr(CreateKubernetesIntegrationCmd.MarkFlagRequired(IntegrationNameKey))
}
Loading

0 comments on commit 497af93

Please sign in to comment.