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

snapshot #2831

Closed
wants to merge 6 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Release
on:
push:
tags: ['**']
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt update
sudo apt install goreleaser-pro
- run: ./build/package/generate-notices.sh
- run: |
VERSION_GIT="$(git tag --list "atlascli/v*" --sort=taggerdate | tail -1 | cut -d "v" -f 2)"
export VERSION_GIT
goreleaser --config "build/package/.goreleaser.yml" --rm-dist --release-notes "CHANGELOG.md" -p 1 --debug
33 changes: 33 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Snapshot
on:
pull_request:
push:
branches:
- master
permissions:
contents: write
jobs:
snapshot:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt update
sudo apt install goreleaser-pro
- run: ./build/package/generate-notices.sh
- run: |
VERSION_GIT="$(git tag --list "atlascli/v*" --sort=taggerdate | tail -1 | cut -d "v" -f 2)"
export VERSION_GIT
goreleaser --config "build/package/.goreleaser.yml" --rm-dist --release-notes "CHANGELOG.md" -p 1 --snapshot --debug
37 changes: 37 additions & 0 deletions .github/workflows/sync-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Sync Fork
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
sync-fork:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go install golang.org/x/tools/cmd/goimports@latest
- run: go install github.com/golang/mock/mockgen@latest
- run: |
find . -type f | grep -v .git | xargs sed -i'' 's|github.com/mongodb/mongodb-atlas-cli|github.com/fmenezes/mongodb-atlas-cli|'
find . -type f -name '*.go' -exec goimports -w {} +;
make gen-mocks
- uses: peter-evans/create-pull-request@v6
with:
title: Sync fork
commit-message: Sync fork
delete-branch: true
base: master
branch: sync-fork
body: |
Sync fork
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ please head over to our [feedback page](https://feedback.mongodb.com/forums/9308

## Reporting Issues

Please create a [GitHub issue](https://github.com/mongodb/mongodb-atlas-cli/issues/new?assignees=&labels=&template=bug_report.md) describing the kind of problem you're facing
Please create a [GitHub issue](https://github.com/fmenezes/mongodb-atlas-cli/issues/new?assignees=&labels=&template=bug_report.md) describing the kind of problem you're facing
with as much detail as possible, including things like operating system or anything else may be relevant to the issue.

## Auto-close Stale Issues and Pull Requests
Expand All @@ -56,7 +56,7 @@ To make the contribution process as seamless as possible, we ask for the followi
- Have test cases for the new code. If you have questions about how to do this, please ask in your pull request or check the [Building and Testing](#building-and-testing) section.
- Run `make fmt`.
- Add documentation if you are adding new features or changing functionality.
- Confirm that `make check` succeeds. [GitHub Actions](https://github.com/mongodb/mongodb-atlas-cli/actions).
- Confirm that `make check` succeeds. [GitHub Actions](https://github.com/fmenezes/mongodb-atlas-cli/actions).

### Development Setup

Expand Down Expand Up @@ -144,12 +144,12 @@ Depending on the feature you are building you might choose to:
For a command group, we need to create new cobra root command.
This command aggregates a number of subcommands that can perform network requests and return results

For example [teams](https://github.com/mongodb/mongodb-atlas-cli/tree/220c6c73f346f5c711a1c772b17f93a6811efc69/internal/cli/atlas/teams)
For example [teams](https://github.com/fmenezes/mongodb-atlas-cli/tree/220c6c73f346f5c711a1c772b17f93a6811efc69/internal/cli/atlas/teams)
command root provides the main execution point for `atlas teams` with subcommands like `atlas teams list`

Root command links to a number of child commands. Atlas CLI provides a number of patterns for child commands depending on the type of operation performed.
Each new feature might cover typical commands like `list` and `describe` along with dedicated actions.
For example [list command](https://github.com/mongodb/mongodb-atlas-cli/blob/220c6c73f346f5c711a1c772b17f93a6811efc69/internal/cli/atlas/teams/list.go).
For example [list command](https://github.com/fmenezes/mongodb-atlas-cli/blob/220c6c73f346f5c711a1c772b17f93a6811efc69/internal/cli/atlas/teams/list.go).
It is normal to duplicate existing commands and edit descriptions and methods for your own needs.

Additionally, after adding new command we need to add it to the main CLI root command.
Expand Down Expand Up @@ -197,7 +197,7 @@ Flags are a way to modify the command, also may be called "options". Flags alway
- `--booleanFlag`: this flag represents a boolean and it sets the related variable to true when the flag is used, false otherwise. Example: `--force`
- `--flagName value1,value2,..,valueN`: you will also find flags that accept a list of values. This type of flag can be very useful to represent data structures as `--role roleName1@db,roleName2@db`, `--privilege [email protected],[email protected]`, or `--key field:type`.
As shown in the examples, the standard format used to represent data structures consists of splitting the first value with the second one by at sign `@` or colon `:`, and the second value with the third one by a full stop `.`.
We recommend using configuration files for complex data structures that require more than three values. For an example of configuration files, see [mongocli atlas cluster create](https://github.com/mongodb/mongodb-atlas-cli/blob/f2e6d661a3eb2cfcf9baab5f9e0b1c0f872b8c14/internal/cli/atlas/clusters/create.go#L235).
We recommend using configuration files for complex data structures that require more than three values. For an example of configuration files, see [mongocli atlas cluster create](https://github.com/fmenezes/mongodb-atlas-cli/blob/f2e6d661a3eb2cfcf9baab5f9e0b1c0f872b8c14/internal/cli/atlas/clusters/create.go#L235).

#### Documentation Requirements

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ATLAS_VERSION?=$(shell git describe --match "atlascli/v*" | cut -d "v" -f 2)
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/atlascli/internal/version.GitCommit=${MCLI_GIT_SHA}
ATLAS_LINKER_FLAGS=${LINKER_FLAGS} -X github.com/mongodb/mongodb-atlas-cli/atlascli/internal/version.Version=${ATLAS_VERSION}
LINKER_FLAGS=-s -w -X github.com/fmenezes/mongodb-atlas-cli/atlascli/internal/version.GitCommit=${MCLI_GIT_SHA}
ATLAS_LINKER_FLAGS=${LINKER_FLAGS} -X github.com/fmenezes/mongodb-atlas-cli/atlascli/internal/version.Version=${ATLAS_VERSION}
ATLAS_E2E_BINARY?=../../../bin/${ATLAS_BINARY_NAME}

DEBUG_FLAGS=all=-N -l
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The MongoDB Atlas CLI is a modern command line interface that enables you to man

### Pre-built Binaries

Download the appropriate version for your platform from [Atlas CLI releases](https://github.com/mongodb/mongodb-atlas-cli/releases).
Download the appropriate version for your platform from [Atlas CLI releases](https://github.com/fmenezes/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.

Expand All @@ -20,7 +20,7 @@ You can place this binary somewhere in your `PATH` for ease of use.
#### Fetch Source

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

Expand Down
6 changes: 3 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Use the instructions bellow as a fallback.

Package Managers are published after a stable release happens, in which binaries are stored in github releases and also uploaded to our download center (https://www.mongodb.com/try/download/atlascli and https://www.mongodb.com/try/download/mongocli).

* [Chocolatey](http://chocolatey.org) release is triggered in https://github.com/mongodb-forks/chocolatey-packages/, the Github Action will trigger every weekday at 4pm (UTC) to check if there are any new releases in https://github.com/mongodb/mongodb-atlas-cli/releases/.
* [Chocolatey](http://chocolatey.org) release is triggered in https://github.com/mongodb-forks/chocolatey-packages/, the Github Action will trigger every weekday at 4pm (UTC) to check if there are any new releases in https://github.com/fmenezes/mongodb-atlas-cli/releases/.

* [Homebrew](http://brew.sh/) release is triggered in https://github.com/Homebrew/homebrew-core/, which is not maintained by MongoDB rather by homebrew community.

* Yum and Apt are handled internally via evergreen tasks `push_stable_atlascli_generate` and `push_stable_mongocli_generate`.

## Docker Image
Our Docker image release for AtlasCLI is managed through the [docker-release.yml](.github/workflows/docker-release.yml) workflow. This process is automated to run daily, ensuring the latest versions of the image dependencies are updated.
![github_action](https://github.com/mongodb/mongodb-atlas-cli/assets/5663078/fd54ccda-7794-4139-af92-dbde0c278e78)
![github_action](https://github.com/fmenezes/mongodb-atlas-cli/assets/5663078/fd54ccda-7794-4139-af92-dbde0c278e78)
### Release Steps
#### Step 1: Build and Stage
The AtlasCLI Docker image is built from the ([Dockerfile](Dockerfile)) and tagged in three ways: `latest`, `vX.Y.Z` (reflecting the latest release version, e.g., `v1.22.0`), and `vX.Y.Z-date` (adding the current date, e.g., `v1.22.0-2024-01-01`). This image is initially published to a staging registry to prepare for signature in the next step.
Expand Down Expand Up @@ -55,7 +55,7 @@ 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"`
2. Publish the new tag, ie `git push origin atlascli/v1.0.0`
3. The [evergreen](build/ci/release.yml) release task will run after a tag event from master.
4. If everything goes smoothly the release will be published in the [releases page](https://github.com/mongodb/mongodb-atlas-cli/releases), and [download center](https://www.mongodb.com/try/download/mongocli).
4. If everything goes smoothly the release will be published in the [releases page](https://github.com/fmenezes/mongodb-atlas-cli/releases), and [download center](https://www.mongodb.com/try/download/mongocli).


# Generate the SBOM
Expand Down
18 changes: 9 additions & 9 deletions build/ci/evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ variables:
GO111MODULE: "on"
GOROOT: ${go_root}
GOPATH: ${go_base_path}${workdir}
ADD_PATH: "${go_bin}:${go_base_path}${workdir}/bin:${go_base_path}${workdir}/src/github.com/mongodb/mongodb-atlas-cli/bin"
ADD_PATH: "${go_bin}:${go_base_path}${workdir}/bin:${go_base_path}${workdir}/src/github.com/fmenezes/mongodb-atlas-cli/bin"
GOPROXY: ${go_proxy}
- &go_options
add_to_path:
- ${go_bin}
- ${go_base_path}${workdir}/bin
- ${go_base_path}${workdir}/src/github.com/mongodb/mongodb-atlas-cli/bin
- ${go_base_path}${workdir}/src/github.com/fmenezes/mongodb-atlas-cli/bin
include_expansions_in_env:
- go_base_path
- go_proxy
- workdir
working_dir: src/github.com/mongodb/mongodb-atlas-cli
working_dir: src/github.com/fmenezes/mongodb-atlas-cli
env:
<<: *go_env
functions:
"clone":
- command: git.get_project
type: setup
params:
directory: src/github.com/mongodb/mongodb-atlas-cli
directory: src/github.com/fmenezes/mongodb-atlas-cli
"build":
- command: subprocess.exec
type: test
Expand Down Expand Up @@ -95,7 +95,7 @@ functions:
type: setup
params:
<<: *go_options
working_dir: src/github.com/mongodb/mongodb-atlas-cli/bin
working_dir: src/github.com/fmenezes/mongodb-atlas-cli/bin
shell: bash
script: |
set -Eeou pipefail
Expand All @@ -105,13 +105,13 @@ functions:
- command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-atlas-cli/bin
working_dir: src/github.com/fmenezes/mongodb-atlas-cli/bin
binary: ../build/ci/install_podman.sh
"setup operator":
command: subprocess.exec
type: setup
params:
working_dir: src/github.com/mongodb/mongodb-atlas-cli
working_dir: src/github.com/fmenezes/mongodb-atlas-cli
env:
MCLI_ORG_ID: ${atlas_org_id}
MCLI_PRIVATE_API_KEY: ${atlas_private_api_key}
Expand All @@ -135,7 +135,7 @@ functions:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
- src/github.com/mongodb/mongodb-atlas-cli/tasks.json
- src/github.com/fmenezes/mongodb-atlas-cli/tasks.json
remote_file: ${project}/dist/${revision}_${created_at}/atlascli/${task_type}/
bucket: mongodb-mongocli-build
permissions: public-read
Expand All @@ -150,7 +150,7 @@ pre:
post:
- command: attach.xunit_results
params:
files: ["src/github.com/mongodb/mongodb-atlas-cli/*.xml"]
files: ["src/github.com/fmenezes/mongodb-atlas-cli/*.xml"]
tasks:
- name: compile
tags: ["code_health"]
Expand Down
Loading
Loading