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

CLOUDP-234527 Remove mongocli #2688

Merged
merged 16 commits into from
Mar 4, 2024
Merged
  •  
  •  
  •  
File renamed without changes.
3 changes: 0 additions & 3 deletions CHANGELOG_MONGOCLI.md

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ For example please edit `./root/atlas/builder.go` to add your command builder me

### Adding a New Command

`atlascli` and `mongocli` have defined a basic structure for individual commands that should be followed.
For a `mongocli scope newCommand` command, a file `internal/cli/scope/new_command.go` should implement:
`atlascli` have defined a basic structure for individual commands that should be followed.
For a `atlas scope newCommand` command, a file `internal/cli/scope/new_command.go` should implement:

- A `ScopeNewCommandOpts` struct which handles the different options for the command.
- At least a `func (opts *ScopeNewCommandOpts) Run() error` function with the main command logic.
Expand Down
57 changes: 6 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
GOLANGCI_VERSION=v1.56.1
COVERAGE=coverage.out

MCLI_SOURCE_FILES?=./cmd/mongocli
MCLI_BINARY_NAME=mongocli
MCLI_VERSION?=$(shell git describe --match "mongocli/v*" | cut -d "v" -f 2)
MCLI_GIT_SHA?=$(shell git rev-parse HEAD)
MCLI_DESTINATION=./bin/$(MCLI_BINARY_NAME)
MCLI_INSTALL_PATH="${GOPATH}/bin/$(MCLI_BINARY_NAME)"
MCLI_E2E_BINARY?=../../../bin/${MCLI_BINARY_NAME}

ATLAS_SOURCE_FILES?=./cmd/atlas
ATLAS_BINARY_NAME=atlas
Expand All @@ -18,7 +12,6 @@ ATLAS_DESTINATION=./bin/$(ATLAS_BINARY_NAME)
ATLAS_INSTALL_PATH="${GOPATH}/bin/$(ATLAS_BINARY_NAME)"

LINKER_FLAGS=-s -w -X github.com/mongodb/mongodb-atlas-cli/internal/version.GitCommit=${MCLI_GIT_SHA}
MCLI_LINKER_FLAGS=${LINKER_FLAGS} -X github.com/mongodb/mongodb-atlas-cli/internal/config.ToolName=$(MCLI_BINARY_NAME) -X github.com/mongodb/mongodb-atlas-cli/internal/version.Version=${MCLI_VERSION}
ATLAS_LINKER_FLAGS=${LINKER_FLAGS} -X github.com/mongodb/mongodb-atlas-cli/internal/config.ToolName=atlascli -X github.com/mongodb/mongodb-atlas-cli/internal/version.Version=${ATLAS_VERSION}
ATLAS_E2E_BINARY?=../../../bin/${ATLAS_BINARY_NAME}

Expand All @@ -36,7 +29,6 @@ export PATH := $(shell go env GOPATH)/bin:$(PATH)
export PATH := ./bin:$(PATH)
export TERM := linux-m
export GO111MODULE := on
export MCLI_E2E_BINARY
export ATLAS_E2E_BINARY

.PHONY: pre-commit
Expand Down Expand Up @@ -115,49 +107,22 @@ gen-mocks: ## Generate mocks
go generate ./internal...

.PHONY: gen-docs
gen-docs: gen-docs-mongocli gen-docs-atlascli ## Generate docs for commands

.PHONY: gen-docs-mongocli
gen-docs-mongocli: ## Generate docs for mongocli commands
@echo "==> Generating docs for mongocli"
go run -ldflags "$(MCLI_LINKER_FLAGS)" ./tools/mongoclidocs/main.go

.PHONY: gen-docs-atlascli
gen-docs-atlascli: ## Generate docs for atlascli commands
@echo "==> Generating docs for atlascli"
go run -ldflags "$(ATLAS_LINKER_FLAGS)" ./tools/atlasclidocs/main.go
gen-docs: ## Generate docs for atlascli commands
@echo "==> Generating docs"
go run -ldflags "$(ATLAS_LINKER_FLAGS)" ./tools/docs/main.go

.PHONY: build
build: build-mongocli ## Generate a binary for mongocli

.PHONY: build-all
build-all: build-mongocli build-atlascli ## Generate a binary for both CLIs

.PHONY: build-mongocli
build-mongocli: ## Generate a mongocli binary in ./bin
@echo "==> Building $(MCLI_BINARY_NAME) binary"
go build -ldflags "$(MCLI_LINKER_FLAGS)" -o $(MCLI_DESTINATION) $(MCLI_SOURCE_FILES)

.PHONY: build-atlascli
build-atlascli: ## Generate a atlascli binary in ./bin
build: ## Generate an atlas binary in ./bin
@echo "==> Building $(ATLAS_BINARY_NAME) binary"
go build -ldflags "$(ATLAS_LINKER_FLAGS)" -o $(ATLAS_DESTINATION) $(ATLAS_SOURCE_FILES)

.PHONY: build-debug
build-debug: build-mongocli-debug build-atlascli-debug ## Generate binaries in ./bin for debugging both CLIs

.PHONY: build-mongocli-debug
build-mongocli-debug: ## Generate a binary in ./bin for debugging mongocli
@echo "==> Building $(MCLI_BINARY_NAME) binary for debugging"
go build -gcflags="$(DEBUG_FLAGS)" -ldflags "$(MCLI_LINKER_FLAGS)" -o $(MCLI_DESTINATION) $(MCLI_SOURCE_FILES)

.PHONY: build-atlascli-debug
build-atlascli-debug: ## Generate a binary in ./bin for debugging atlascli
build-debug: ## Generate a binary in ./bin for debugging atlascli
@echo "==> Building $(ATLAS_BINARY_NAME) binary for debugging"
go build -gcflags="$(DEBUG_FLAGS)" -ldflags "$(ATLAS_LINKER_FLAGS)" -o $(ATLAS_DESTINATION) $(ATLAS_SOURCE_FILES)

.PHONY: e2e-test
e2e-test: build-all ## Run E2E tests
e2e-test: build ## Run E2E tests
@echo "==> Running E2E tests..."
# the target assumes the MCLI_* environment variables are exported
$(TEST_CMD) -v -p 1 -parallel $(E2E_PARALLEL) -timeout $(E2E_TIMEOUT) -tags="$(E2E_TAGS)" ./test/e2e... $(E2E_EXTRA_ARGS)
Expand All @@ -178,16 +143,6 @@ unit-test: ## Run unit-tests
$(TEST_CMD) --tags="$(UNIT_TAGS)" -race -cover -count=1 -coverprofile $(COVERAGE) ./...

.PHONY: install
install: install-mongocli install-atlascli ## Install binaries in $GOPATH/bin for both CLIs

.PHONY: install-mongocli
install-mongocli: ## Install mongocli binary in $GOPATH/bin
@echo "==> Installing $(MCLI_BINARY_NAME) to $(MCLI_INSTALL_PATH)"
go install -ldflags "$(MCLI_LINKER_FLAGS)" $(MCLI_SOURCE_FILES)
@echo "==> Done..."

.PHONY: install-atlascli
install-atlascli: ## Install atlascli binary in $GOPATH/bin
@echo "==> Installing $(ATLAS_BINARY_NAME) to $(ATLAS_INSTALL_PATH)"
go install -ldflags "$(ATLAS_LINKER_FLAGS)" $(ATLAS_SOURCE_FILES)
@echo "==> Done..."
Expand Down
68 changes: 59 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,72 @@
## MongoDB Atlas CLI

![GO tests](https://github.com/mongodb/mongodb-atlas-cli/workflows/GO%20tests/badge.svg)
![golangci-lint](https://github.com/mongodb/mongodb-atlas-cli/workflows/golangci-lint/badge.svg)
The MongoDB Atlas CLI is a modern command line interface that enables you to manage MongoDB Atlas from the terminal.

The MongoDB Atlas CLI repository contains the following modern command line interfaces:
![atlascli-atlas-quickstart](https://user-images.githubusercontent.com/5663078/156184669-57c8ddce-6f0a-4e84-9311-2d996cb27942.gif)

- ![icon](https://user-images.githubusercontent.com/5663078/161288347-3d550b8c-bf06-47eb-88cb-25266383147f.png#gh-light-mode-only) ![icon](https://user-images.githubusercontent.com/5663078/161288344-33fa8e03-92ee-46ff-b490-38bf4dd8f379.png#gh-dark-mode-only)
[Atlas CLI](atlascli.md)
## Installing

- ![icon](https://user-images.githubusercontent.com/5663078/161288349-dfef2cd1-0e43-4c44-b5b9-45b7d62c85f6.png#gh-light-mode-only) ![icon](https://user-images.githubusercontent.com/5663078/161288351-0afd25c9-8a06-4a4b-b732-ecf315257aae.png#gh-dark-mode-only)
[MongoDB CLI](mongocli.md)
### Pre-built Binaries

Use simple, one-line commands to interact with MongoDB Atlas, Cloud Manager, or Ops Manager, and to automate management tasks for your deployments.
Download the appropriate version for your platform from [Atlas CLI releases](https://github.com/mongodb/mongodb-atlas-cli/releases).
After you download the library, you can run it from anywhere and don't need to install it into a global location.
This works well for shared hosts and other systems where you don't have a privileged account.

You can place this binary somewhere in your `PATH` for ease of use.
`/usr/local/bin` is the most probable location.

### Build From Source

#### Fetch Source

```bash
git clone https://github.com/mongodb/mongodb-atlas-cli.git
cd mongodb-atlas-cli
```

#### Build

To build `atlascli`, run:

```bash
make build
```

The resulting `atlas` binary is placed in `./bin`.

#### Install

To install the `atlas` binary in `$GOPATH/bin`, run:

```bash
make install
```

**Note:** running `make build` is not needed when running `make install`.


## Usage

To get a list of available commands, run `atlas help`
or check our documentation for more details.

### Configuring Atlas CLI
To use `atlascli`, open your terminal, run `atlas auth login`, and follow the prompted steps.

### Shell Completions

If you install via [homebrew](#hombrew-on-macos) no additional actions are needed.

To get specific instructions for your preferred shell, run:

```bash
atlas completion <bash|zsh|fish|powershell> --help
```

## Contributing

See our [CONTRIBUTING.md](CONTRIBUTING.md) guide.

## License

MongoDB CLI and Atlas CLI are released under the Apache 2.0 license. See [LICENSE](LICENSE)
MongoDB Atlas CLI is released under the Apache 2.0 license. See [LICENSE](LICENSE)
8 changes: 1 addition & 7 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To manually generate a new stable release you can run:
./scripts/release.sh atlascli/v1.0.0
```

**Note:** Please use the `atlascli/vX.Y.Z` or `mongocli/vX.Y.Z` format for the version to release
**Note:** Please use the `atlascli/vX.Y.Z` format for the version to release

This will do the following things:
1. Tag a new version, ie: `git tag -a -s atlascli/v1.0.0 -m "atlascli/v1.0.0"`
Expand All @@ -67,12 +67,6 @@ We use `go version` to generate the SBOM for Atlas CLI binaries. You can generat
go version -m <path_to_atlasCLI_binary>
```

## MongoCLI Binary
We use `go version` to generate the SBOM for MongoCLI binaries. You can generate the SBOM via the following command:
```bash
go version -m <path_to_mongoCLI_binary>
```

## Atlas CLI Docker image
We use `docker sbom` to generate the SBOM for the AtlasCLI docker image. You can generate the SBOM via the following command:
```bash
Expand Down
64 changes: 0 additions & 64 deletions atlascli.md

This file was deleted.

48 changes: 0 additions & 48 deletions build/ci/clean-up-cloud-manager.sh

This file was deleted.

Loading