Skip to content

Commit 64516d5

Browse files
stefan4hfmenezeskyuan-mongodb
authored
CLOUDP-222047: Plugins system (#3208)
Co-authored-by: Filipe Constantinov Menezes <[email protected]> Co-authored-by: kyuan-mongodb <[email protected]>
1 parent ec19f97 commit 64516d5

40 files changed

+4392
-22
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ linters-settings:
4747
alias: kmsv1
4848
- pkg: github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli/config
4949
alias: cliconfig
50+
- pkg: github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli/plugin
51+
alias: pluginCmd
5052
misspell:
5153
locale: US
5254
ignore-words:

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Thanks for your interest in contributing to MongoDB Atlas CLI,
44
this document describes some guidelines necessary to participate in the community.
55

6+
If you want to extend the Atlas CLI with custom functionality, take a look at the [Atlas CLI Plugin Example](https://github.com/mongodb/atlas-cli-plugin-example) to learn more about creating plugins.
7+
68
## Asking Support Questions
79

810
MongoDB support is provided under MongoDB Atlas or Enterprise Advanced [support plans](https://support.mongodb.com/welcome).

build/ci/evergreen.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,62 @@ tasks:
192192
MCLI_OPS_MANAGER_URL: ${mcli_ops_manager_url}
193193
MCLI_SERVICE: cloud
194194
E2E_TAGS: atlas,clusters,sharded
195+
- name: atlas_plugin_install
196+
tags: ["e2e","atlas","plugin","install"]
197+
must_have_test_results: true
198+
commands:
199+
- func: "install gotestsum"
200+
- func: "e2e test"
201+
vars:
202+
MCLI_ORG_ID: ${atlas_org_id}
203+
MCLI_PROJECT_ID: ${atlas_project_id}
204+
MCLI_PRIVATE_API_KEY: ${atlas_private_api_key}
205+
MCLI_PUBLIC_API_KEY: ${atlas_public_api_key}
206+
MCLI_OPS_MANAGER_URL: ${mcli_ops_manager_url}
207+
MCLI_SERVICE: cloud
208+
E2E_TAGS: atlas,plugin,install
209+
- name: atlas_plugin_run
210+
tags: ["e2e","atlas","plugin"]
211+
must_have_test_results: true
212+
commands:
213+
- func: "install gotestsum"
214+
- func: "e2e test"
215+
vars:
216+
MCLI_ORG_ID: ${atlas_org_id}
217+
MCLI_PROJECT_ID: ${atlas_project_id}
218+
MCLI_PRIVATE_API_KEY: ${atlas_private_api_key}
219+
MCLI_PUBLIC_API_KEY: ${atlas_public_api_key}
220+
MCLI_OPS_MANAGER_URL: ${mcli_ops_manager_url}
221+
MCLI_SERVICE: cloud
222+
E2E_TAGS: atlas,plugin,run
223+
- name: atlas_plugin_uninstall
224+
tags: ["e2e","atlas","plugin"]
225+
must_have_test_results: true
226+
commands:
227+
- func: "install gotestsum"
228+
- func: "e2e test"
229+
vars:
230+
MCLI_ORG_ID: ${atlas_org_id}
231+
MCLI_PROJECT_ID: ${atlas_project_id}
232+
MCLI_PRIVATE_API_KEY: ${atlas_private_api_key}
233+
MCLI_PUBLIC_API_KEY: ${atlas_public_api_key}
234+
MCLI_OPS_MANAGER_URL: ${mcli_ops_manager_url}
235+
MCLI_SERVICE: cloud
236+
E2E_TAGS: atlas,plugin,uninstall
237+
- name: atlas_plugin_update
238+
tags: ["e2e","atlas","plugin"]
239+
must_have_test_results: true
240+
commands:
241+
- func: "install gotestsum"
242+
- func: "e2e test"
243+
vars:
244+
MCLI_ORG_ID: ${atlas_org_id}
245+
MCLI_PROJECT_ID: ${atlas_project_id}
246+
MCLI_PRIVATE_API_KEY: ${atlas_private_api_key}
247+
MCLI_PUBLIC_API_KEY: ${atlas_public_api_key}
248+
MCLI_OPS_MANAGER_URL: ${mcli_ops_manager_url}
249+
MCLI_SERVICE: cloud
250+
E2E_TAGS: atlas,plugin,update
195251
- name: atlas_clusters_m0_e2e
196252
tags: ["e2e","clusters","atlas"]
197253
must_have_test_results: true
@@ -1172,6 +1228,14 @@ buildvariants:
11721228
<<: *go_linux_version
11731229
tasks:
11741230
- name: ".e2e .atlas .streams"
1231+
- name: e2e_plugin
1232+
display_name: "E2E Plugin Tests"
1233+
run_on:
1234+
- rhel90-small
1235+
expansions:
1236+
<<: *go_linux_version
1237+
tasks:
1238+
- name: ".e2e .atlas .plugin"
11751239
patch_aliases:
11761240
- alias: "localdev"
11771241
variant_tags: ["localdev"]

cmd/atlas/atlas.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ func main() {
8383
}
8484

8585
rootCmd := root.Builder()
86-
8786
initTrack(rootCmd)
8887
trackInitError(loadConfig(), rootCmd)
8988

docs/command/atlas-plugin-install.txt

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
.. _atlas-plugin-install:
2+
3+
====================
4+
atlas plugin install
5+
====================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Install Atlas CLI plugin from a GitHub repository.
16+
17+
Install an Atlas CLI plugin from a GitHub repository.
18+
You can specify a GitHub repository using either the "<github-owner>/<github-repository-name>" format or a full URL.
19+
When you install the plugin, its latest release on GitHub is used by default.
20+
To install a specific version of the plugin, append the version number directly to the plugin name using the @ symbol.
21+
22+
MongoDB provides an example plugin: https://github.com/mongodb/atlas-cli-plugin-example
23+
24+
25+
Syntax
26+
------
27+
28+
.. code-block::
29+
:caption: Command Syntax
30+
31+
atlas plugin install [<github-owner>/<github-repository-name>] [options]
32+
33+
.. Code end marker, please don't delete this comment
34+
35+
Arguments
36+
---------
37+
38+
.. list-table::
39+
:header-rows: 1
40+
:widths: 20 10 10 60
41+
42+
* - Name
43+
- Type
44+
- Required
45+
- Description
46+
* - <github-owner>/<github-repository-name>
47+
- string
48+
- false
49+
- Repository identifier.
50+
51+
Options
52+
-------
53+
54+
.. list-table::
55+
:header-rows: 1
56+
:widths: 20 10 10 60
57+
58+
* - Name
59+
- Type
60+
- Required
61+
- Description
62+
* - -h, --help
63+
-
64+
- false
65+
- help for install
66+
67+
Inherited Options
68+
-----------------
69+
70+
.. list-table::
71+
:header-rows: 1
72+
:widths: 20 10 10 60
73+
74+
* - Name
75+
- Type
76+
- Required
77+
- Description
78+
* - -P, --profile
79+
- string
80+
- false
81+
- Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
82+
83+
Examples
84+
--------
85+
86+
.. code-block::
87+
:copyable: false
88+
89+
# Install the latest version of the plugin:
90+
atlas plugin install mongodb/atlas-cli-plugin-example
91+
atlas plugin install https://github.com/mongodb/atlas-cli-plugin-example
92+
93+
94+
.. code-block::
95+
:copyable: false
96+
97+
# Install a specific version of the plugin:
98+
atlas plugin install mongodb/[email protected]
99+
atlas plugin install https://github.com/mongodb/atlas-cli-plugin-example/@v1.2.3

docs/command/atlas-plugin-list.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.. _atlas-plugin-list:
2+
3+
=================
4+
atlas plugin list
5+
=================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Returns a list of all installed plugins.
16+
17+
Syntax
18+
------
19+
20+
.. code-block::
21+
:caption: Command Syntax
22+
23+
atlas plugin list [options]
24+
25+
.. Code end marker, please don't delete this comment
26+
27+
Options
28+
-------
29+
30+
.. list-table::
31+
:header-rows: 1
32+
:widths: 20 10 10 60
33+
34+
* - Name
35+
- Type
36+
- Required
37+
- Description
38+
* - -h, --help
39+
-
40+
- false
41+
- help for list
42+
43+
Inherited Options
44+
-----------------
45+
46+
.. list-table::
47+
:header-rows: 1
48+
:widths: 20 10 10 60
49+
50+
* - Name
51+
- Type
52+
- Required
53+
- Description
54+
* - -P, --profile
55+
- string
56+
- false
57+
- Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
58+
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
.. _atlas-plugin-uninstall:
2+
3+
======================
4+
atlas plugin uninstall
5+
======================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Uninstall Atlas CLI plugin.
16+
17+
Uninstall an Atlas CLI plugin.
18+
You can specify a plugin to uninstall using either the "<github-owner>/<github-repository-name>" format or the plugin name.
19+
20+
21+
Syntax
22+
------
23+
24+
.. code-block::
25+
:caption: Command Syntax
26+
27+
atlas plugin uninstall [plugin] [options]
28+
29+
.. Code end marker, please don't delete this comment
30+
31+
Arguments
32+
---------
33+
34+
.. list-table::
35+
:header-rows: 1
36+
:widths: 20 10 10 60
37+
38+
* - Name
39+
- Type
40+
- Required
41+
- Description
42+
* - plugin
43+
- string
44+
- false
45+
- Plugin identifier.
46+
47+
Options
48+
-------
49+
50+
.. list-table::
51+
:header-rows: 1
52+
:widths: 20 10 10 60
53+
54+
* - Name
55+
- Type
56+
- Required
57+
- Description
58+
* - -h, --help
59+
-
60+
- false
61+
- help for uninstall
62+
63+
Inherited Options
64+
-----------------
65+
66+
.. list-table::
67+
:header-rows: 1
68+
:widths: 20 10 10 60
69+
70+
* - Name
71+
- Type
72+
- Required
73+
- Description
74+
* - -P, --profile
75+
- string
76+
- false
77+
- Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
78+
79+
Examples
80+
--------
81+
82+
.. code-block::
83+
:copyable: false
84+
85+
# Uninstall a plugin:
86+
atlas plugin uninstall mongodb/atlas-cli-plugin-example
87+
atlas plugin uninstall atlas-cli-plugin-example

0 commit comments

Comments
 (0)